diff options
-rwxr-xr-x | configure | 3 | ||||
-rw-r--r-- | docs/bootindex.txt | 2 | ||||
-rw-r--r-- | docs/qdev-device-use.txt | 13 | ||||
-rw-r--r-- | hw/core/Makefile.objs | 2 | ||||
-rw-r--r-- | hw/core/register.c | 8 | ||||
-rw-r--r-- | hw/scsi/lsi53c895a.c | 10 | ||||
-rw-r--r-- | hw/sparc64/sun4u.c | 2 | ||||
-rw-r--r-- | hw/timer/altera_timer.c | 2 | ||||
-rw-r--r-- | hw/xtensa/sim.c | 10 | ||||
-rw-r--r-- | include/exec/memory.h | 2 | ||||
-rw-r--r-- | include/hw/mips/mips.h | 1 | ||||
-rw-r--r-- | memory_mapping.c | 1 | ||||
-rw-r--r-- | qapi/block-core.json | 30 | ||||
-rw-r--r-- | qapi/block.json | 2 | ||||
-rw-r--r-- | qemu-doc.texi | 21 | ||||
-rw-r--r-- | qemu-options.hx | 4 | ||||
-rw-r--r-- | qga/commands-posix.c | 4 | ||||
-rw-r--r-- | target/arm/cpu.c | 2 | ||||
-rw-r--r-- | tests/ide-test.c | 8 | ||||
-rw-r--r-- | tests/libqtest.c | 5 |
20 files changed, 69 insertions, 63 deletions
@@ -3042,14 +3042,13 @@ if test "$curses" != "no" ; then #include <curses.h> #include <wchar.h> int main(void) { - const char *s = curses_version(); wchar_t wch = L'w'; setlocale(LC_ALL, ""); resize_term(0, 0); addwstr(L"wide chars\n"); addnwstr(&wch, 1); add_wch(WACS_DEGREE); - return s != 0; + return 0; } EOF IFS=: diff --git a/docs/bootindex.txt b/docs/bootindex.txt index b9a8ba1..6937862 100644 --- a/docs/bootindex.txt +++ b/docs/bootindex.txt @@ -13,7 +13,7 @@ Let's assume we have a QEMU machine with two NICs (virtio, e1000) and two disks (IDE, virtio): qemu -drive file=disk1.img,if=none,id=disk1 - -device ide-drive,drive=disk1,bootindex=4 + -device ide-hd,drive=disk1,bootindex=4 -drive file=disk2.img,if=none,id=disk2 -device virtio-blk-pci,drive=disk2,bootindex=3 -netdev type=user,id=net0 -device virtio-net-pci,netdev=net0,bootindex=2 diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt index 4274fe9..1f297b5 100644 --- a/docs/qdev-device-use.txt +++ b/docs/qdev-device-use.txt @@ -31,8 +31,8 @@ A QEMU block device (drive) has a host and a guest part. In the general case, the guest device is connected to a controller device. For instance, the IDE controller provides two IDE buses, each -of which can have up to two ide-drive devices, and each ide-drive -device is a guest part, and is connected to a host part. +of which can have up to two devices, and each device is a guest part, +and is connected to a host part. Except we sometimes lump controller, bus(es) and drive device(s) all together into a single device. For instance, the ISA floppy @@ -399,12 +399,13 @@ type. some DEVNAMEs: default device suppressing DEVNAMEs - CD-ROM ide-cd, ide-drive, scsi-cd - isa-fdc's driveA isa-fdc + CD-ROM ide-cd, ide-drive, ide-hd, scsi-cd, scsi-hd + isa-fdc's driveA floppy, isa-fdc parallel isa-parallel serial isa-serial - VGA VGA, cirrus-vga, vmware-svga - virtioconsole virtio-serial-pci, virtio-serial-s390, virtio-serial + VGA VGA, cirrus-vga, isa-vga, isa-cirrus-vga, + vmware-svga, qxl-vga, virtio-vga + virtioconsole virtio-serial-pci, virtio-serial The default NIC is connected to a default part created along with it. It is *not* suppressed by configuring a NIC with -device (you may call diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index 91450b2..f8d7a4a 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -5,7 +5,7 @@ common-obj-y += fw-path-provider.o # irq.o needed for qdev GPIO handling: common-obj-y += irq.o common-obj-y += hotplug.o -obj-y += nmi.o +common-obj-y += nmi.o common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o common-obj-$(CONFIG_XILINX_AXI) += stream.o diff --git a/hw/core/register.c b/hw/core/register.c index da38ef3..900294b 100644 --- a/hw/core/register.c +++ b/hw/core/register.c @@ -195,8 +195,8 @@ void register_write_memory(void *opaque, hwaddr addr, } if (!reg) { - qemu_log_mask(LOG_GUEST_ERROR, "Write to unimplemented register at " \ - "address: %#" PRIx64 "\n", addr); + qemu_log_mask(LOG_GUEST_ERROR, "%s: write to unimplemented register " \ + "at address: %#" PRIx64 "\n", reg_array->prefix, addr); return; } @@ -224,8 +224,8 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, } if (!reg) { - qemu_log_mask(LOG_GUEST_ERROR, "Read to unimplemented register at " \ - "address: %#" PRIx64 "\n", addr); + qemu_log_mask(LOG_GUEST_ERROR, "%s: read to unimplemented register " \ + "at address: %#" PRIx64 "\n", reg_array->prefix, addr); return 0; } diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 595c260..3e56ab2 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -408,27 +408,25 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val); static void lsi_execute_script(LSIState *s); static void lsi_reselect(LSIState *s, lsi_request *p); -static inline int lsi_mem_read(LSIState *s, dma_addr_t addr, +static inline void lsi_mem_read(LSIState *s, dma_addr_t addr, void *buf, dma_addr_t len) { if (s->dmode & LSI_DMODE_SIOM) { address_space_read(&s->pci_io_as, addr, MEMTXATTRS_UNSPECIFIED, buf, len); - return 0; } else { - return pci_dma_read(PCI_DEVICE(s), addr, buf, len); + pci_dma_read(PCI_DEVICE(s), addr, buf, len); } } -static inline int lsi_mem_write(LSIState *s, dma_addr_t addr, +static inline void lsi_mem_write(LSIState *s, dma_addr_t addr, const void *buf, dma_addr_t len) { if (s->dmode & LSI_DMODE_DIOM) { address_space_write(&s->pci_io_as, addr, MEMTXATTRS_UNSPECIFIED, buf, len); - return 0; } else { - return pci_dma_write(PCI_DEVICE(s), addr, buf, len); + pci_dma_write(PCI_DEVICE(s), addr, buf, len); } } diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 18b8f8b..69f565d 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -214,7 +214,7 @@ static void isa_irq_handler(void *opaque, int n, int level) qemu_irq *irqs = opaque; int ivec; - assert(n < 16); + assert(n < ARRAY_SIZE(isa_irq_to_ivec)); ivec = isa_irq_to_ivec[n]; EBUS_DPRINTF("Set ISA IRQ %d level %d -> ivec 0x%x\n", n, level, ivec); if (ivec) { diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c index 6d48626..c9a0fc5 100644 --- a/hw/timer/altera_timer.c +++ b/hw/timer/altera_timer.c @@ -204,7 +204,7 @@ static void altera_timer_reset(DeviceState *dev) ptimer_stop(t->ptimer); ptimer_set_limit(t->ptimer, 0xffffffff, 1); - memset(t->regs, 0, ARRAY_SIZE(t->regs)); + memset(t->regs, 0, sizeof(t->regs)); } static Property altera_timer_properties[] = { diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index d2d1d3a..b27e28d 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -41,21 +41,21 @@ static void xtensa_create_memory_regions(const XtensaMemory *memory, const char *name) { unsigned i; - char *num_name = malloc(strlen(name) + sizeof(i) * 3 + 1); + GString *num_name = g_string_new(NULL); for (i = 0; i < memory->num; ++i) { MemoryRegion *m; - sprintf(num_name, "%s%u", name, i); - m = g_malloc(sizeof(*m)); - memory_region_init_ram(m, NULL, num_name, + g_string_printf(num_name, "%s%u", name, i); + m = g_new(MemoryRegion, 1); + memory_region_init_ram(m, NULL, num_name->str, memory->location[i].size, &error_fatal); vmstate_register_ram_global(m); memory_region_add_subregion(get_system_memory(), memory->location[i].addr, m); } - free(num_name); + g_string_free(num_name, true); } static uint64_t translate_phys_addr(void *opaque, uint64_t addr) diff --git a/include/exec/memory.h b/include/exec/memory.h index bfdc685..80e605a 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -17,9 +17,7 @@ #ifndef CONFIG_USER_ONLY #include "exec/cpu-common.h" -#ifndef CONFIG_USER_ONLY #include "exec/hwaddr.h" -#endif #include "exec/memattrs.h" #include "exec/ramlist.h" #include "qemu/queue.h" diff --git a/include/hw/mips/mips.h b/include/hw/mips/mips.h index e0065ce..16412dc 100644 --- a/include/hw/mips/mips.h +++ b/include/hw/mips/mips.h @@ -6,6 +6,7 @@ #define INITRD_PAGE_MASK (~((1 << 16) - 1)) #include "exec/memory.h" +#include "hw/irq.h" /* gt64xxx.c */ PCIBus *gt64120_register(qemu_irq *pic); diff --git a/memory_mapping.c b/memory_mapping.c index 6a39d71..a5d3855 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -337,6 +337,7 @@ void memory_mapping_filter(MemoryMappingList *list, int64_t begin, if (cur->phys_addr >= begin + length || cur->phys_addr + cur->length <= begin) { QTAILQ_REMOVE(&list->head, cur, next); + g_free(cur); list->num--; continue; } diff --git a/qapi/block-core.json b/qapi/block-core.json index ea0b3e8..88a7471 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1206,11 +1206,11 @@ # Example: # # -> { "execute": "blockdev-add", -# "arguments": { "options": { "driver": "qcow2", -# "node-name": "node1534", -# "file": { "driver": "file", -# "filename": "hd1.qcow2" }, -# "backing": "" } } } +# "arguments": { "driver": "qcow2", +# "node-name": "node1534", +# "file": { "driver": "file", +# "filename": "hd1.qcow2" }, +# "backing": "" } } # # <- { "return": {} } # @@ -3214,7 +3214,7 @@ # <- { "return": {} } # # -> { "execute": "x-blockdev-remove-medium", -# "arguments": { "device": "ide0-1-0" } } +# "arguments": { "id": "ide0-1-0" } } # # <- { "return": {} } # @@ -3245,10 +3245,10 @@ # # -> { "execute": "blockdev-add", # "arguments": { -# "options": { "node-name": "node0", -# "driver": "raw", -# "file": { "driver": "file", -# "filename": "fedora.iso" } } } } +# "node-name": "node0", +# "driver": "raw", +# "file": { "driver": "file", +# "filename": "fedora.iso" } } } # <- { "return": {} } # # -> { "execute": "x-blockdev-insert-medium", @@ -3624,7 +3624,7 @@ # means the device should be extended to avoid pausing for # disk exhaustion. # The event is one shot. Once triggered, it needs to be -# re-registered with another block-set-threshold command. +# re-registered with another block-set-write-threshold command. # # @node-name: graph node name on which the threshold was exceeded. # @@ -3701,10 +3701,10 @@ # 1. Add a new node to a quorum # -> { "execute": "blockdev-add", # "arguments": { -# "options": { "driver": "raw", -# "node-name": "new_node", -# "file": { "driver": "file", -# "filename": "test.raw" } } } } +# "driver": "raw", +# "node-name": "new_node", +# "file": { "driver": "file", +# "filename": "test.raw" } } } # <- { "return": {} } # -> { "execute": "x-blockdev-change", # "arguments": { "parent": "disk1", diff --git a/qapi/block.json b/qapi/block.json index 6a2fdc7..414b61b 100644 --- a/qapi/block.json +++ b/qapi/block.json @@ -180,7 +180,7 @@ # # Example: # -# -> { "execute": "eject", "arguments": { "device": "ide1-0-1" } } +# -> { "execute": "eject", "arguments": { "id": "ide1-0-1" } } # <- { "return": {} } ## { 'command': 'eject', diff --git a/qemu-doc.texi b/qemu-doc.texi index de0cc30..965ba59 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -34,6 +34,7 @@ * Introduction:: * QEMU PC System emulator:: * QEMU System emulator for non PC targets:: +* QEMU Guest Agent:: * QEMU User space emulator:: * Implementation notes:: * License:: @@ -396,7 +397,6 @@ snapshots. * vm_snapshots:: VM snapshots * qemu_img_invocation:: qemu-img Invocation * qemu_nbd_invocation:: qemu-nbd Invocation -* qemu_ga_invocation:: qemu-ga Invocation * disk_images_formats:: Disk image file formats * host_drives:: Using host drives * disk_images_fat_images:: Virtual FAT disk images @@ -490,11 +490,6 @@ state is not saved or restored properly (in particular USB). @include qemu-nbd.texi -@node qemu_ga_invocation -@subsection @code{qemu-ga} Invocation - -@include qemu-ga.texi - @node disk_images_formats @subsection Disk image file formats @@ -2685,6 +2680,12 @@ Note that this allows guest direct access to the host filesystem, so should only be used with trusted guest OS. @end table + +@node QEMU Guest Agent +@chapter QEMU Guest Agent invocation + +@include qemu-ga.texi + @node QEMU User space emulator @chapter QEMU User space emulator @@ -3020,10 +3021,10 @@ Run the emulation in single step mode. QEMU is a trademark of Fabrice Bellard. -QEMU is released under the GNU General Public License (TODO: add link). -Parts of QEMU have specific licenses, see file LICENSE. - -TODO (refer to file LICENSE, include it, include the GPL?) +QEMU is released under the +@url{https://www.gnu.org/licenses/gpl-2.0.txt,GNU General Public License}, +version 2. Parts of QEMU have specific licenses, see file +@url{http://git.qemu.org/?p=qemu.git;a=blob_plain;f=LICENSE,LICENSE}. @node Index @appendix Index diff --git a/qemu-options.hx b/qemu-options.hx index a6c9b9e..30c4f98 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -102,7 +102,7 @@ ETEXI DEF("accel", HAS_ARG, QEMU_OPTION_accel, "-accel [accel=]accelerator[,thread=single|multi]\n" " select accelerator (kvm, xen, hax or tcg; use 'help' for a list)\n" - " thread=single|multi (enable multi-threaded TCG)", QEMU_ARCH_ALL) + " thread=single|multi (enable multi-threaded TCG)\n", QEMU_ARCH_ALL) STEXI @item -accel @var{name}[,prop=@var{value}[,...]] @findex -accel @@ -262,7 +262,7 @@ STEXI Set default value of @var{driver}'s property @var{prop} to @var{value}, e.g.: @example -qemu-system-i386 -global ide-drive.physical_block_size=4096 -drive file=file,if=ide,index=0,media=disk +qemu-system-i386 -global ide-hd.physical_block_size=4096 disk-image.img @end example In particular, you can use this to set driver properties for devices which are diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 284ecc6..d8e4122 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -2197,12 +2197,10 @@ static void transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk, } } else { if (mem_blk->online != (strncmp(status, "online", 6) == 0)) { - char *new_state = mem_blk->online ? g_strdup("online") : - g_strdup("offline"); + const char *new_state = mem_blk->online ? "online" : "offline"; ga_write_sysfs_file(dirfd, "state", new_state, strlen(new_state), &local_err); - g_free(new_state); if (local_err) { error_free(local_err); result->response = diff --git a/target/arm/cpu.c b/target/arm/cpu.c index e748097..04a3fea 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1082,6 +1082,8 @@ static const ARMCPRegInfo cortexr5_cp_reginfo[] = { .access = PL1_RW, .type = ARM_CP_CONST }, { .name = "BTCM", .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 1, .access = PL1_RW, .type = ARM_CP_CONST }, + { .name = "DCACHE_INVAL", .cp = 15, .opc1 = 0, .crn = 15, .crm = 5, + .opc2 = 0, .access = PL1_W, .type = ARM_CP_NOP }, REGINFO_SENTINEL }; diff --git a/tests/ide-test.c b/tests/ide-test.c index 139ebc0..bfd79dd 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -796,11 +796,13 @@ static void cdrom_pio_impl(int nblocks) int i, j; uint8_t data; uint16_t limit; + size_t ret; /* Prepopulate the CDROM with an interesting pattern */ generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); - fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); + ret = fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); + g_assert_cmpint(ret, ==, patt_blocks); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " @@ -880,6 +882,7 @@ static void test_cdrom_pio_large(void) static void test_cdrom_dma(void) { static const size_t len = ATAPI_BLOCK_SIZE; + size_t ret; char *pattern = g_malloc(ATAPI_BLOCK_SIZE * 16); char *rx = g_malloc0(len); uintptr_t guest_buf; @@ -896,7 +899,8 @@ static void test_cdrom_dma(void) generate_pattern(pattern, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); - fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh); + ret = fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh); + g_assert_cmpint(ret, ==, 16); fclose(fh); send_dma_request(CMD_PACKET, 0, 1, prdt, 1, send_scsi_cdb_read10); diff --git a/tests/libqtest.c b/tests/libqtest.c index 84ecbd2..4a5492a 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -160,7 +160,10 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) const char *qemu_binary; qemu_binary = getenv("QTEST_QEMU_BINARY"); - g_assert(qemu_binary != NULL); + if (!qemu_binary) { + fprintf(stderr, "Environment variable QTEST_QEMU_BINARY required\n"); + exit(1); + } s = g_malloc(sizeof(*s)); |