Patch Round-up for stable 2.1.3, freeze on 2015-01-14
Subsystems (2)
Hi everyone,
The following new patches are queued for QEMU stable v2.1.3:
https://github.com/mdroth/qemu/commits/stable-2.1-staging
The release is planned for 2015-01-21:
http://wiki.qemu.org/Planning/2.1
Please respond here or CC [email protected] on any patches you think should be included in the release.
This is the last planned release for the QEMU 2.1 series, and it's quite a bit busier than usual for a final stable update so your scrutiny/testing is very appreciated.
Thanks!
----------------------------------------------------------------
Alexander Graf (2):
kvmclock: Ensure time in migration never goes backward
kvm: Fix memory slot page alignment logic
Andreas Färber (1):
ivshmem: Fix fd leak on error
Aurelien Jarno (1):
tcg/mips: fix store softmmu slow path
Damjan Marion (1):
vhost-user: fix VIRTIO_NET_F_MRG_RXBUF negotiation
Don Slutz (1):
hw/ide/core.c: Prevent SIGSEGV during migration
Dr. David Alan Gilbert (1):
xhci PCIe endpoint migration compatibility fix
Eduardo Habkost (2):
kvmclock: Add comment explaining why we need cpu_clean_all_dirty()
smbios: Fix assertion on socket count calculation
Fam Zheng (1):
qemu-iotests: Test missing "driver" key for blockdev-add
Gary R Hook (1):
block migration: fix return value
Gerd Hoffmann (5):
vmware-vga: CVE-2014-3689: turn off hw accel
vmware-vga: add vmsvga_verify_rect
vmware-vga: use vmsvga_verify_rect in vmsvga_update_rect
vmware-vga: use vmsvga_verify_rect in vmsvga_copy_rect
vmware-vga: use vmsvga_verify_rect in vmsvga_fill_rect
Gonglei (13):
qdev: Use NULL instead of local_err for qbus_child unrealize
qdev: Add cleanup logic in device_set_realized() to avoid resource leak
virtio-net: use aliases instead of duplicate qdev properties
virtio-net: fix virtio-net child refcount in transports virtio/vhost-scsi: use aliases instead of duplicate qdev properties virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in transports
virtio-serial: use aliases instead of duplicate qdev properties
virtio-serial: fix virtio-serial child refcount in transports
virtio-rng: use aliases instead of duplicate qdev properties
virtio-rng: fix virtio-rng child refcount in transports
virtio-balloon: fix virtio-balloon child refcount in transports
virtio-9p: use aliases instead of duplicate qdev properties
virtio-9p: fix virtio-9p child refcount in transports
Greg Kurz (1):
spapr_pci: map the MSI window in each PHB
Hannes Reinecke (1):
esp-pci: fixup deadlock with linux
Igor Mammedov (1):
pc: acpi: mark all possible CPUs as enabled in SRAT
Jan Kiszka (3):
pci: Use bus master address space for delivering MSI/MSI-X messages
pc: Fix disabling of vapic for compat PC models
Make qemu_shutdown_requested signal-safe
Jason Wang (1):
virtio-net: fix unmap leak
Kevin Wolf (3):
qcow2: Fix header extension size check qcow2.py: Add required padding for header extensions
block: Don't probe for unknown backing file format
Luiz Capitulino (2):
exec: file_ram_alloc(): print error when prealloc fails
virtio-balloon: fix integer overflow in memory stats feature
Marcelo Tosatti (2):
Introduce cpu_clean_all_dirty
kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculationMax Filippov (5):
hw/core/loader: implement address translation in uimage loader hw/xtensa/xtfpga: treat uImage load address as virtual
target-xtensa: add missing window check for entry
target-xtensa: fix translation for opcodes crossing page boundary
target-xtensa: test cross-page opcode
Max Reitz (14):
qcow2: Do not overflow when writing an L1 sector
block: Make essential BlockDriver objects public
block: Omit bdrv_find_format for essential drivers block/vvfat: qcow driver may not be found block/nfs: Add create_opts
block: Check create_opts before image creation
qemu-img: Check create_opts before image creation
qemu-img: Check create_opts before image amendment
iotests: Only kill NBD server if it runs
iotests: Add test for unsupported image creation
qcow2: Prevent numerical overflow
qcow2: Flushing the caches in qcow2_close may fail
qcow2: Respect bdrv_truncate() error block/raw-posix: Fix ret in raw_open_common()
Michael Roth (4):
qapi: add visit_start_union and visit_end_union
qapi: dealloc visitor, implement visit_start_union
tests: add QMP input visitor test for unions with no discriminator
tests: avoid running duplicate qom-tests
Michael S. Tsirkin (1):
virtio-pci: enable bus master for old guests
Paolo Bonzini (4):
vhost-scsi: use virtio_ldl_p
virtio-scsi: work around bug in old BIOSes
linuxboot: compute initrd loading address
linuxboot: fix loading old kernels
Pavel Dovgalyuk (1):
gdbstub: init mon_chr through qemu_chr_alloc
Peter Maydell (4):
hw/arm/virt: fix pl011 and pl031 irq flags hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)
exec: Handle multipage ranges in invalidate_and_set_dirty()
audio: Don't free hw resources until after hw backend is stopped
Petr Matousek (1):
vnc: sanitize bits_per_pixel from the client
Ray Strode (1):
libcacard: don't free sign buffer while sign op is pending
Sebastian Krahmer (1):
ivshmem: Fix potential OOB r/w access
Stefan Hajnoczi (2):
ivshmem: Check ivshmem_read() size argument
ivshmem: validate incoming_posn value from server
Stratos Psomadakis (1):
monitor: Reset HMP mon->rs in CHR_EVENT_OPEN
Ting Wang (1):
virtio-scsi: sense in virtio_scsi_command_complete
Zhang Haoyu (2):
snapshot: fix referencing wrong variable in while loop in do_delvm
snapshot: add bdrv_drain_all() to bdrv_snapshot_delete() to avoid concurrency problem
zhanghailiang (3):
pc-dimm: Don't check dimm->node when there is non-NUMA config
libcacard: fix resource leak
l2tpv3: fix possible double free
audio/audio_template.h | 2 +- block-migration.c | 10 +++- block.c | 36 ++++++------ block/nfs.c | 15 +++++ block/qcow2-cluster.c | 8 ++- block/qcow2.c | 33 +++++++---- block/raw-posix.c | 3 +- block/raw-win32.c | 2 +- block/raw_bsd.c | 2 +- block/snapshot.c | 4 ++ block/vvfat.c | 6 ++ cpus.c | 9 +++ exec.c | 7 +-- gdbstub.c | 2 +- hw/arm/boot.c | 2 +- hw/arm/virt.c | 4 +- hw/core/loader.c | 17 ++++-- hw/core/qdev.c | 66 +++++++++++++++------- hw/display/vmware_vga.c | 116 +++++++++++++++++++++++++------------- hw/i386/acpi-build.c | 11 +--- hw/i386/kvm/clock.c | 67 ++++++++++++++++++++++ hw/i386/pc_piix.c | 2 +- hw/i386/smbios.c | 2 +- hw/ide/core.c | 2 +- hw/m68k/an5206.c | 3 +- hw/m68k/dummy_m68k.c | 3 +- hw/m68k/mcf5208.c | 3 +- hw/mem/pc-dimm.c | 2 +- hw/microblaze/boot.c | 3 +- hw/misc/ivshmem.c | 66 ++++++++++++++++++++-- hw/net/vhost_net.c | 8 +-- hw/net/virtio-net.c | 5 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci/msi.c | 2 +- hw/pci/msix.c | 2 +- hw/ppc/e500.c | 3 +- hw/ppc/ppc440_bamboo.c | 3 +- hw/ppc/spapr.c | 1 - hw/ppc/spapr_pci.c | 81 +++++++++++++-------------- hw/s390x/s390-virtio-bus.c | 16 ++++-- hw/s390x/virtio-ccw.c | 18 +++--- hw/scsi/esp-pci.c | 2 + hw/scsi/vhost-scsi.c | 5 +- hw/scsi/virtio-scsi.c | 19 ++++++- hw/usb/hcd-xhci.c | 6 +- hw/virtio/virtio-balloon.c | 7 ++- hw/virtio/virtio-pci.c | 31 ++++++++--- hw/xtensa/xtfpga.c | 3 +- include/block/block_int.h | 8 +++ include/exec/ram_addr.h | 25 +++++++++ include/hw/i386/pc.h | 5 ++ include/hw/loader.h | 4 +- include/hw/pci-host/spapr.h | 2 +- include/hw/ppc/spapr.h | 2 - include/qapi/visitor-impl.h | 2 + include/qapi/visitor.h | 2 + include/sysemu/cpus.h | 1 + include/sysemu/kvm.h | 8 +++ kvm-all.c | 11 +++- libcacard/cac.c | 10 +++- libcacard/vscclient.c | 7 ++- monitor.c | 1 + net/l2tpv3.c | 1 - pc-bios/linuxboot.bin | Bin 1024 -> 1024 bytes pc-bios/optionrom/linuxboot.S | 66 ++++++++++++++++++++-- pc-bios/optionrom/optionrom.h | 21 ++++++- qapi/qapi-dealloc-visitor.c | 26 +++++++++ qapi/qapi-visit-core.c | 15 +++++ qemu-img.c | 21 +++++++ savevm.c | 11 ++-- scripts/qapi-visit.py | 6 ++ target-xtensa/cpu.h | 6 ++ target-xtensa/op_helper.c | 6 ++ target-xtensa/translate.c | 27 +++++++-- tcg/mips/tcg-target.c | 2 +- tests/Makefile | 3 +- tests/qapi-schema/qapi-schema-test.json | 10 ++++ tests/qapi-schema/qapi-schema-test.out | 3 + tests/qemu-iotests/026.out | 120 ++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/071.out | 8 +++ tests/qemu-iotests/080 | 2 + tests/qemu-iotests/080.out | 2 + tests/qemu-iotests/087 | 17 ++++++ tests/qemu-iotests/087.out | 13 +++++ tests/qemu-iotests/089.out | 2 + tests/qemu-iotests/113 | 76 +++++++++++++++++++++++++ tests/qemu-iotests/113.out | 15 +++++ tests/qemu-iotests/114 | 61 ++++++++++++++++++++ tests/qemu-iotests/114.out | 13 +++++ tests/qemu-iotests/common.rc | 4 +- tests/qemu-iotests/group | 2 + tests/qemu-iotests/qcow2.py | 4 ++ tests/tcg/xtensa/test_mmu.S | 26 ++++----- tests/test-qmp-input-strict.c | 17 ++++++ ui/vnc.c | 10 ++++ vl.c | 4 +- 96 files changed, 1175 insertions(+), 255 deletions(-) create mode 100755 tests/qemu-iotests/113 create mode 100644 tests/qemu-iotests/113.out create mode 100755 tests/qemu-iotests/114 create mode 100644 tests/qemu-iotests/114.out
PATCH 1/88 qdev: Use NULL instead of local_err for qbus_child unrealize
From: Gonglei <[email protected]>
Forcefully unrealize all children regardless of errors in earlier iterations (if any). We should keep going with cleanup operation rather than report an error immediately. Therefore store the first child unrealization failure and propagate it at the end. We also forcefully unregister vmsd and unrealize actual object, too.
--- hw/core/qdev.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
hw/core/qdev.c +7 -7
@@ -871,18 +871,18 @@ static void device_set_realized(Object *obj, bool value, Error **errp) } dev->pending_deleted_event = false; }else if (!value && dev->realized) { +Error **local_errp =NULL ; QLIST_FOREACH(bus, &dev->child_bus, sibling) { + local_errp = local_err ?NULL : &local_err;object_property_set_bool (OBJECT (bus), false,"realized" , - &local_err); -if (local_err !=NULL ) { -break ; - } + local_errp); } -if (qdev_get_vmsd (dev) && local_err ==NULL ) { +if (qdev_get_vmsd (dev)) {vmstate_unregister (dev,qdev_get_vmsd (dev), dev); } -if (dc->unrealize && local_err ==NULL ) { - dc->unrealize (dev, &local_err); +if (dc->unrealize) { + local_errp = local_err ?NULL : &local_err; + dc->unrealize (dev, local_errp); } dev->pending_deleted_event = true; }
Signature · 1 line
1.9.1
PATCH 2/88 qdev: Add cleanup logic in device_set_realized() to avoid resource leak
In reply to Michael RothFrom: Gonglei <[email protected]>
At present, this function doesn't have partial cleanup implemented, which will cause resource leaks in some scenarios.
Example:
1. Assume that "dc->realize(dev, &local_err)" executes successful and local_err == NULL;
2. device hotplug in hotplug_handler_plug() executes but fails (it is prone to occur). Then local_err != NULL;
3. error_propagate(errp, local_err) and return. But the resources which have been allocated in dc->realize() will be leaked.
Simple backtrace:
dc->realize()
|->device_realize
|->pci_qdev_init()
|->do_pci_register_device()
|->etc.Add fuller cleanup logic which assures that function can goto appropriate error label as local_err population is detected at each relevant point.
--- hw/core/qdev.c | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-)
hw/core/qdev.c +38 -14
@@ -834,12 +834,14 @@ static void device_set_realized(Object *obj, bool value, Error **errp) dc->realize (dev, &local_err); } -if (dev->parent_bus && dev->parent_bus->hotplug_handler && - local_err ==NULL ) { +if (local_err !=NULL ) { + goto fail; + } + +if (dev->parent_bus && dev->parent_bus->hotplug_handler) {hotplug_handler_plug (dev->parent_bus->hotplug_handler, dev, &local_err); - }else if (local_err ==NULL && -object_dynamic_cast (qdev_get_machine (),TYPE_MACHINE )) { + }else if (object_dynamic_cast (qdev_get_machine (),TYPE_MACHINE )) {HotplugHandler *hotplug_ctrl;MachineState *machine =MACHINE (qdev_get_machine ());MachineClass *mc =MACHINE_GET_CLASS (machine);
@@ -852,21 +854,24 @@ static void device_set_realized(Object *obj, bool value, Error **errp) } } -if (qdev_get_vmsd (dev) && local_err ==NULL ) { +if (local_err !=NULL ) { + goto post_realize_fail; + } + +if (qdev_get_vmsd (dev)) {vmstate_register_with_alias_id (dev,-1 ,qdev_get_vmsd (dev), dev, dev->instance_id_alias, dev->alias_required_for_version); } -if (local_err ==NULL ) { - QLIST_FOREACH(bus, &dev->child_bus, sibling) { -object_property_set_bool (OBJECT (bus), true,"realized" , + + QLIST_FOREACH(bus, &dev->child_bus, sibling) { +object_property_set_bool (OBJECT (bus), true,"realized" , &local_err); -if (local_err !=NULL ) { -break ; - } +if (local_err !=NULL ) { + goto child_realize_fail; } } -if (dev->hotplugged && local_err ==NULL ) { +if (dev->hotplugged) {device_reset (dev); } dev->pending_deleted_event = false;
@@ -888,11 +893,30 @@ static void device_set_realized(Object *obj, bool value, Error **errp) }if (local_err !=NULL ) { -error_propagate (errp, local_err); -return ; + goto fail; } dev->realized = value; +return ; + +child_realize_fail: + QLIST_FOREACH(bus, &dev->child_bus, sibling) { +object_property_set_bool (OBJECT (bus), false,"realized" , +NULL ); + } + +if (qdev_get_vmsd (dev)) { +vmstate_unregister (dev,qdev_get_vmsd (dev), dev); + } + +post_realize_fail: +if (dc->unrealize) { + dc->unrealize (dev,NULL ); + } + +fail: +error_propagate (errp, local_err); +return ; }static bool device_get_hotpluggable (Object *obj,Error **errp)
Signature · 1 line
1.9.1
PATCH 3/88 exec: file_ram_alloc(): print error when prealloc fails
In reply to Michael RothFrom: Luiz Capitulino <[email protected]>
If memory allocation fails when using the -mem-prealloc command-line option, QEMU exits without printing any error information to the user:
# qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages # echo $? 1
This commit adds an error message, so that we print instead:
# qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages qemu: unable to map backing store for hugepages: Cannot allocate memory
--- exec.c | 1 + 1 file changed, 1 insertion(+)
exec.c +1 -0
@@ -1130,6 +1130,7 @@ static void *file_ram_alloc(RAMBlock *block, error:if (mem_prealloc) { +error_report ("%s\n" ,error_get_pretty (*errp));exit (1 ); }return NULL ;
Signature · 1 line
1.9.1
PATCH 4/88 xhci PCIe endpoint migration compatibility fix
In reply to Michael RothFrom: "Dr. David Alan Gilbert" <[email protected]>
Add back the PCIe config capabilities on XHCI cards in non-PCIe slots, but only for machine types before 2.1.
This fixes a migration incompatibility in the XHCI PCI devices caused by:
058fdcf52cdbf57b67e7 - xhci: add endpoint cap on express bus only
Note that in fixing it for compatibility with older QEMUs, it breaks compatibility with existing QEMU 2.1's on older machine types.
The status before this patch was (if it used an XHCI adapter):
machine type | source qemu
any pre-2.1 - FAIL
any 2.1... - PASSWith this patch:
machine type | source qemu
any pre-2.1 - PASS
pre-2.1 2.1... - FAIL
2.1 2.1... - PASSA test to trigger it is to add '-device nec-usb-xhci,id=xhci,addr=0x12' to the command line.
--- hw/usb/hcd-xhci.c | 6 +++++- include/hw/i386/pc.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-)
hw/usb/hcd-xhci.c +5 -1
@@ -499,6 +499,7 @@ enum xhci_flags {XHCI_FLAG_USE_MSI =1 ,XHCI_FLAG_USE_MSI_X ,XHCI_FLAG_SS_FIRST , + XHCI_FLAG_FORCE_PCIE_ENDCAP, }; static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
@@ -3626,7 +3627,8 @@ static int usb_xhci_initfn(struct PCIDevice *dev)PCI_BASE_ADDRESS_SPACE_MEMORY |PCI_BASE_ADDRESS_MEM_TYPE_64 , &xhci->mem); -if (pci_bus_is_express (dev->bus)) { +if (pci_bus_is_express (dev->bus) || +xhci_get_flag (xhci,XHCI_FLAG_FORCE_PCIE_ENDCAP )) { ret =pcie_endpoint_cap_init (dev,0xa0 );assert (ret >=0 ); }
@@ -3818,6 +3820,8 @@ static Property xhci_properties[] = {DEFINE_PROP_BIT ("msix" , XHCIState, flags,XHCI_FLAG_USE_MSI_X , true),DEFINE_PROP_BIT ("superspeed-ports-first" , XHCIState, flags,XHCI_FLAG_SS_FIRST , true), +DEFINE_PROP_BIT ("force-pcie-endcap" , XHCIState, flags, +XHCI_FLAG_FORCE_PCIE_ENDCAP , false),DEFINE_PROP_UINT32 ("intrs" , XHCIState, numintrs,MAXINTRS ),DEFINE_PROP_UINT32 ("slots" , XHCIState, numslots,MAXSLOTS ), DEFINE_PROP_UINT32("p2", XHCIState, numports_2, 4),
include/hw/i386/pc.h +5 -0
@@ -318,6 +318,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .value = "off",\ },\ {\ + .driver = "nec-usb-xhci",\ + .property = "force-pcie-endcap",\ + .value = "on",\ + },\ + {\ .driver = "pci-serial",\ .property = "prog_if",\ .value = stringify(0),\
Signature · 1 line
1.9.1
PATCH 5/88 Introduce cpu_clean_all_dirty
In reply to Michael RothFrom: Marcelo Tosatti <[email protected]>
Introduce cpu_clean_all_dirty, to force subsequent cpu_synchronize_all_states to read in-kernel register state.
Conflicts:
kvm-all.c
*removed context dependency on kvm_cpu_synchronize_post_init
--- cpus.c | 9 +++++++++ include/sysemu/cpus.h | 1 + include/sysemu/kvm.h | 8 ++++++++ kvm-all.c | 5 +++++ 4 files changed, 23 insertions(+)
cpus.c +9 -0
@@ -523,6 +523,15 @@ void cpu_synchronize_all_post_init(void) } } +void cpu_clean_all_dirty (void ) +{ +CPUState *cpu; + +CPU_FOREACH (cpu) { +cpu_clean_state (cpu); + } +} +static int do_vm_stop (RunState state) {int ret =0 ;
include/sysemu/cpus.h +1 -0
@@ -10,6 +10,7 @@ void cpu_stop_current(void);void cpu_synchronize_all_states (void );void cpu_synchronize_all_post_reset (void );void cpu_synchronize_all_post_init (void ); +void cpu_clean_all_dirty (void );void qtest_clock_warp (int64_t dest);
include/sysemu/kvm.h +8 -0
@@ -348,6 +348,7 @@ int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr,void kvm_cpu_synchronize_state (CPUState *cpu);void kvm_cpu_synchronize_post_reset (CPUState *cpu);void kvm_cpu_synchronize_post_init (CPUState *cpu); +void kvm_cpu_clean_state (CPUState *cpu);/* generic hooks - to be moved/refactored once there are more users */
@@ -372,6 +373,13 @@ static inline void cpu_synchronize_post_init(CPUState *cpu) } } +static inline void cpu_clean_state (CPUState *cpu) +{ +if (kvm_enabled ()) { +kvm_cpu_clean_state (cpu); + } +} +int kvm_irqchip_add_msi_route (KVMState *s,MSIMessage msg);int kvm_irqchip_update_msi_route (KVMState *s,int virq,MSIMessage msg);void kvm_irqchip_release_virq (KVMState *s,int virq);
kvm-all.c +5 -0
@@ -1681,6 +1681,11 @@ void kvm_cpu_synchronize_post_init(CPUState *cpu) cpu->kvm_vcpu_dirty = false; } +void kvm_cpu_clean_state (CPUState *cpu) +{ + cpu->kvm_vcpu_dirty = false; +} +int kvm_cpu_exec (CPUState *cpu) {struct kvm_run *run = cpu->kvm_run;
Signature · 1 line
1.9.1
PATCH 6/88 kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation
In reply to Michael RothFrom: Marcelo Tosatti <[email protected]>
Ensure proper env->tsc value for kvmclock_current_nsec calculation.
--- hw/i386/kvm/clock.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/i386/kvm/clock.c +4 -0
@@ -16,6 +16,7 @@#include "qemu-common.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" +#include "sysemu/cpus.h" #include "hw/sysbus.h" #include "hw/kvm/clock.h"
@@ -75,6 +76,9 @@ static void kvmclock_vm_state_change(void *opaque, int running,if (s->clock_valid) {return ; } + +cpu_synchronize_all_states (); +cpu_clean_all_dirty (); ret =kvm_vm_ioctl (kvm_state,KVM_GET_CLOCK , &data);if (ret <0 ) {fprintf (stderr,"KVM_GET_CLOCK failed: %s\n" ,strerror (ret));
Signature · 1 line
1.9.1
PATCH 7/88 kvmclock: Ensure time in migration never goes backward
In reply to Michael RothFrom: Alexander Graf <[email protected]>
When we migrate we ask the kernel about its current belief on what the guest time would be. However, I've seen cases where the kvmclock guest structure indicates a time more recent than the kvm returned time.
To make sure we never go backwards, calculate what the guest would have seen as time at the point of migration and use that value instead of the kernel returned one when it's more recent. This bases the view of the kvmclock after migration on the
same foundation in host as well as guest.
--- hw/i386/kvm/clock.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
hw/i386/kvm/clock.c +49 -0
@@ -14,6 +14,7 @@*/ #include "qemu-common.h" +#include "qemu/host-utils.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" #include "sysemu/cpus.h"
@@ -35,6 +36,48 @@ typedef struct KVMClockState {bool clock_valid; } KVMClockState; +struct pvclock_vcpu_time_info { +uint32_t version; +uint32_t pad0; +uint64_t tsc_timestamp; +uint64_t system_time; +uint32_t tsc_to_system_mul; +int8_t tsc_shift; +uint8_t flags; +uint8_t pad[2 ]; +} __attribute__((__packed__ ));/* 32 bytes */ + +static uint64_t kvmclock_current_nsec (KVMClockState *s) +{ +CPUState *cpu = first_cpu; +CPUX86State *env = cpu->env_ptr; +hwaddr kvmclock_struct_pa = env->system_time_msr & ~1ULL ; +uint64_t migration_tsc = env->tsc; +struct pvclock_vcpu_time_info time; +uint64_t delta; +uint64_t nsec_lo; +uint64_t nsec_hi; +uint64_t nsec; + +if (!(env->system_time_msr &1ULL )) { +/* KVM clock not active */ +return 0 ; + } + +cpu_physical_memory_read (kvmclock_struct_pa, &time,sizeof (time)); + +assert (time.tsc_timestamp <= migration_tsc); + delta = migration_tsc - time.tsc_timestamp; +if (time.tsc_shift <0 ) { + delta >>= -time.tsc_shift; + }else { + delta <<= time.tsc_shift; + } + +mulu64 (&nsec_lo, &nsec_hi, delta, time.tsc_to_system_mul); + nsec = (nsec_lo >>32 ) | (nsec_hi <<32 ); +return nsec + time.system_time; +}static void kvmclock_vm_state_change (void *opaque,int running,RunState state)
@@ -46,9 +89,15 @@ static void kvmclock_vm_state_change(void *opaque, int running,if (running) {struct kvm_clock_data data; +uint64_t time_at_migration =kvmclock_current_nsec (s); s->clock_valid = false; +/* We can't rely on the migrated clock value, just discard it */ +if (time_at_migration) { + s->clock = time_at_migration; + } + data.clock = s->clock; data.flags =0 ; ret =kvm_vm_ioctl (kvm_state,KVM_SET_CLOCK , &data);
Signature · 1 line
1.9.1
PATCH 8/88 kvmclock: Add comment explaining why we need cpu_clean_all_dirty()
In reply to Michael RothFrom: Eduardo Habkost <[email protected]>
Try to explain why commit 317b0a6d8ba44e9bf8f9c3dbd776c4536843d82c needed a cpu_clean_all_dirty() call just after calling cpu_synchronize_all_states().
--- hw/i386/kvm/clock.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
hw/i386/kvm/clock.c +14 -0
@@ -127,7 +127,21 @@ static void kvmclock_vm_state_change(void *opaque, int running, }cpu_synchronize_all_states (); +/* In theory, the cpu_synchronize_all_states() call above wouldn't +* affect the rest of the code, as the VCPU state inside CPUState +* is supposed to always match the VCPU state on the kernel side. +* +* In practice, calling cpu_synchronize_state() too soon will load the +* kernel-side APIC state into X86CPU.apic_state too early, APIC state +* won't be reloaded later because CPUState.vcpu_dirty==true, and +* outdated APIC state may be migrated to another host. +* +* The real fix would be to make sure outdated APIC state is read +* from the kernel again when necessary. While this is not fixed, we +* need the cpu_clean_all_dirty() call below. +*/ cpu_clean_all_dirty (); + ret =kvm_vm_ioctl (kvm_state,KVM_GET_CLOCK , &data);if (ret <0 ) {fprintf (stderr,"KVM_GET_CLOCK failed: %s\n" ,strerror (ret));
Signature · 1 line
1.9.1
PATCH 9/88 pci: Use bus master address space for delivering MSI/MSI-X messages
In reply to Michael RothFrom: Jan Kiszka <[email protected]>
The spec says (and real HW confirms this) that, if the bus master bit is 0, the device will not generate any PCI accesses. MSI and MSI-X messages fall among these, so we should use the corresponding address space to deliver them. This will prevent delivery if bus master support is disabled.
--- hw/pci/msi.c | 2 +- hw/pci/msix.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
hw/pci/msi.c +1 -1
@@ -291,7 +291,7 @@ void msi_notify(PCIDevice *dev, unsigned int vector)"notify vector 0x%x" " address: 0x%" PRIx64" data: 0x%" PRIx32"\n" , vector, msg.address, msg.data); -stl_le_phys (&address_space_memory, msg.address, msg.data); +stl_le_phys (&dev->bus_master_as, msg.address, msg.data); }/* Normally called by pci_default_write_config(). */
hw/pci/msix.c +1 -1
@@ -439,7 +439,7 @@ void msix_notify(PCIDevice *dev, unsigned vector) msg =msix_get_message (dev, vector); -stl_le_phys (&address_space_memory, msg.address, msg.data); +stl_le_phys (&dev->bus_master_as, msg.address, msg.data); }void msix_reset (PCIDevice *dev)
Signature · 1 line
1.9.1
PATCH 10/88 virtio-pci: enable bus master for old guests
In reply to Michael RothFrom: "Michael S. Tsirkin" <[email protected]>
commit cc943c36faa192cd4b32af8fe5edb31894017d35
pci: Use bus master address space for delivering MSI/MSI-X messages
breaks virtio-net for rhel6.[56] x86 guests because they don't enable bus mastering for virtio PCI devices. For the same reason, rhel6.[56] ppc64 guests cannot boot on a virtio-blk disk anymore.
Old guests forgot to enable bus mastering, enable it automatically on DRIVER (guests use some devices before DRIVER_OK).
--- hw/virtio/virtio-pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
hw/virtio/virtio-pci.c +10 -0
@@ -314,6 +314,16 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)msix_unuse_all_vectors (&proxy->pci_dev); } +/* Linux before 2.6.34 drives the device without enabling +the PCI device bus master bit. Enable it automatically +for the guest. This is a PCI spec violation but so is +initiating DMA with bus master bit clear. */ +if (val == (VIRTIO_CONFIG_S_ACKNOWLEDGE |VIRTIO_CONFIG_S_DRIVER )) { +pci_default_write_config (&proxy->pci_dev,PCI_COMMAND , + proxy->pci_dev.config[PCI_COMMAND ] | +PCI_COMMAND_MASTER ,1 ); + } +/* Linux before 2.6.34 sets the device as OK without enabling the PCI device bus master bit. In this case we need to disable some safety checks. */
Signature · 1 line
1.9.1
PATCH 11/88 spapr_pci: map the MSI window in each PHB
In reply to Michael RothFrom: Greg Kurz <[email protected]>
On sPAPR, virtio devices are connected to the PCI bus and use MSI-X. Commit cc943c36faa192cd4b32af8fe5edb31894017d35 has modified MSI-X so that writes are made using the bus master address space and follow the IOMMU path.
Unfortunately, the IOMMU address space address space does not have an MSI window: the notification is silently dropped in unassigned_mem_write instead of reaching the guest... The most visible effect is that all virtio devices are non-functional on sPAPR since then. :(
This patch does the following:
1) map the MSI window into the IOMMU address space for each PHB
- since each PHB instantiates its own IOMMU address space, we can safely map the window at a fixed address (SPAPR_PCI_MSI_WINDOW)
- no real need to keep the MSI window setup in a separate function, the spapr_pci_msi_init() code moves to spapr_phb_realize().
2) kill the global MSI window as it is not needed in the end
--- hw/ppc/spapr.c | 1 - hw/ppc/spapr_pci.c | 53 ++++++++++++++++++++------------------------- include/hw/pci-host/spapr.h | 2 +- include/hw/ppc/spapr.h | 2 -- 4 files changed, 25 insertions(+), 33 deletions(-)
hw/ppc/spapr.c +0 -1
@@ -1377,7 +1377,6 @@ static void ppc_spapr_init(MachineState *machine)spapr_create_nvram (spapr);/* Set up PCI */ -spapr_pci_msi_init (spapr,SPAPR_PCI_MSI_WINDOW );spapr_pci_rtas_init (); phb =spapr_create_phb (spapr,0 );
hw/ppc/spapr_pci.c +24 -29
77 lines not on this page · raw message
include/hw/pci-host/spapr.h +1 -1
@@ -70,7 +70,7 @@ struct sPAPRPHBState {MemoryRegion memspace, iospace;hwaddr mem_win_addr, mem_win_size, io_win_addr, io_win_size; -MemoryRegion memwindow, iowindow; +MemoryRegion memwindow, iowindow, msiwindow;uint32_t dma_liobn;AddressSpace iommu_as;
include/hw/ppc/spapr.h +0 -2
@@ -13,8 +13,6 @@ struct sPAPRNVRAM; typedef struct sPAPREnvironment { struct VIOsPAPRBus *vio_bus; QLIST_HEAD(, sPAPRPHBState) phbs; - hwaddr msi_win_addr; - MemoryRegion msiwindow; struct sPAPRNVRAM *nvram; XICSState *icp;
Signature · 1 line
1.9.1
PATCH 12/88 hw/arm/virt: fix pl011 and pl031 irq flags
In reply to Michael RothFrom: Peter Maydell <[email protected]>
The pl011 and pl031 devices both use level triggered interrupts, but the device tree we construct was incorrectly telling the kernel to configure the GIC to treat them as edge triggered. This meant that output from the pl011 would hang after a while.
Message-id: [email protected]
--- hw/arm/virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/virt.c +2 -2
@@ -371,7 +371,7 @@ static void create_uart(const VirtBoardInfo *vbi, qemu_irq *pic) 2, base, 2, size);qemu_fdt_setprop_cells (vbi->fdt, nodename,"interrupts" ,GIC_FDT_IRQ_TYPE_SPI , irq, -GIC_FDT_IRQ_FLAGS_EDGE_LO_HI ); +GIC_FDT_IRQ_FLAGS_LEVEL_HI );qemu_fdt_setprop_cells (vbi->fdt, nodename,"clocks" , vbi->clock_phandle, vbi->clock_phandle); qemu_fdt_setprop(vbi->fdt, nodename, "clock-names",
@@ -396,7 +396,7 @@ static void create_rtc(const VirtBoardInfo *vbi, qemu_irq *pic) 2, base, 2, size);qemu_fdt_setprop_cells (vbi->fdt, nodename,"interrupts" ,GIC_FDT_IRQ_TYPE_SPI , irq, -GIC_FDT_IRQ_FLAGS_EDGE_LO_HI ); +GIC_FDT_IRQ_FLAGS_LEVEL_HI );qemu_fdt_setprop_cell (vbi->fdt, nodename,"clocks" , vbi->clock_phandle);qemu_fdt_setprop_string (vbi->fdt, nodename,"clock-names" ,"apb_pclk" );g_free (nodename);
Signature · 1 line
1.9.1
PATCH 13/88 gdbstub: init mon_chr through qemu_chr_alloc
In reply to Michael RothFrom: Pavel Dovgalyuk <[email protected]>
This patch initializes monitor for gdbstub with the qemu_chr_alloc function instead of just allocating the memory. Initialization function call is required, because it also creates chr_write_lock mutex, which is used when writing to this character device.
--- gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
gdbstub.c +1 -1
@@ -1707,7 +1707,7 @@ int gdbserver_start(const char *device)qemu_add_vm_change_state_handler (gdb_vm_state_change,NULL );/* Initialize a monitor terminal for gdb */ - mon_chr =g_malloc0 (sizeof (*mon_chr)); + mon_chr =qemu_chr_alloc (); mon_chr->chr_write = gdb_monitor_write;monitor_init (mon_chr,0 ); }else {
Signature · 1 line
1.9.1
PATCH 14/88 qapi: add visit_start_union and visit_end_union
In reply to Michael RothIn some cases an input visitor might bail out on filling out a struct for various reasons, such as missing fields when running in strict mode. In the case of a QAPI Union type, this may lead to cases where the .kind field which encodes the union type is uninitialized. Subsequently, other visitors, such as the dealloc visitor, may use this .kind value as if it were initialized, leading to assumptions about the union type which in this case may lead to segfaults. For example, freeing an integer value.
However, we can generally rely on the fact that the always-present .data void * field that we generate for these union types will always be NULL in cases where .kind is uninitialized (at least, there shouldn't be a reason where we'd do this purposefully).
So pass this information on to Visitor implementation via these optional start_union/end_union interfaces so this information can be used to guard against the situation above. We will make use of this information in a subsequent patch for the dealloc visitor.
--- include/qapi/visitor-impl.h | 2 ++ include/qapi/visitor.h | 2 ++ qapi/qapi-visit-core.c | 15 +++++++++++++++ scripts/qapi-visit.py | 6 ++++++ 4 files changed, 25 insertions(+)
include/qapi/visitor-impl.h +2 -0
@@ -55,6 +55,8 @@ struct Visitorvoid (*type_int64)(Visitor *v,int64_t *obj,const char *name,Error **errp);/* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ void (*type_size)(Visitor *v,uint64_t *obj,const char *name,Error **errp); +bool (*start_union)(Visitor *v,bool data_present,Error **errp); +void (*end_union)(Visitor *v,bool data_present,Error **errp); }; void input_type_enum(Visitor *v, int *obj, const char *strings[],
include/qapi/visitor.h +2 -0
@@ -58,5 +58,7 @@ void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp);void visit_type_bool (Visitor *v,bool *obj,const char *name,Error **errp);void visit_type_str (Visitor *v,char **obj,const char *name,Error **errp);void visit_type_number (Visitor *v,double *obj,const char *name,Error **errp); +bool visit_start_union (Visitor *v,bool data_present,Error **errp); +void visit_end_union (Visitor *v,bool data_present,Error **errp);#endif
qapi/qapi-visit-core.c +15 -0
@@ -58,6 +58,21 @@ void visit_end_list(Visitor *v, Error **errp) v->end_list (v, errp); } +bool visit_start_union (Visitor *v,bool data_present,Error **errp) +{ +if (v->start_union) { +return v->start_union (v, data_present, errp); + } +return true; +} + +void visit_end_union (Visitor *v,bool data_present,Error **errp) +{ +if (v->end_union) { + v->end_union (v, data_present, errp); + } +} +void visit_optional (Visitor *v,bool *present,const char *name,Error **errp) {
scripts/qapi-visit.py +6 -0
@@ -357,6 +357,9 @@ void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **e if (err) { goto out_obj; } + if (!visit_start_union(m, !!(*obj)->data, &err) || err) { + goto out_obj; + } switch ((*obj)->kind) { ''', disc_type = disc_type,
@@ -385,6 +388,9 @@ void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **e out_obj: error_propagate(errp, err); err = NULL; + visit_end_union(m, !!(*obj)->data, &err); + error_propagate(errp, err); + err = NULL; } visit_end_struct(m, &err); out:
Signature · 1 line
1.9.1
PATCH 15/88 qapi: dealloc visitor, implement visit_start_union
In reply to Michael RothIf the .data field of a QAPI Union is NULL, we don't need to free any of the union fields.
Make use of the new visit_start_union interface to access this information and instruct the generated code to not visit these fields when this occurs.
--- qapi/qapi-dealloc-visitor.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
qapi/qapi-dealloc-visitor.c +26 -0
@@ -162,6 +162,31 @@ static void qapi_dealloc_type_enum(Visitor *v, int *obj, const char *strings[], { } +/* If there's no data present, the dealloc visitor has nothing to free. +* Thus, indicate to visitor code that the subsequent union fields can +* be skipped. This is not an error condition, since the cleanup of the +* rest of an object can continue unhindered, so leave errp unset in +* these cases. +* +* NOTE: In cases where we're attempting to deallocate an object that +* may have missing fields, the field indicating the union type may +* be missing. In such a case, it's possible we don't have enough +* information to differentiate data_present == false from a case where +* data *is* present but happens to be a scalar with a value of 0. +* This is okay, since in the case of the dealloc visitor there's no +* work that needs to done in either situation. +* +* The current inability in QAPI code to more thoroughly verify a union +* type in such cases will likely need to be addressed if we wish to +* implement this interface for other types of visitors in the future, +* however. +*/ +static bool qapi_dealloc_start_union (Visitor *v,bool data_present, +Error **errp) +{ +return data_present; +} +Visitor *qapi_dealloc_get_visitor (QapiDeallocVisitor *v) {return &v->visitor;
@@ -191,6 +216,7 @@ QapiDeallocVisitor *qapi_dealloc_visitor_new(void) v->visitor.type_str = qapi_dealloc_type_str; v->visitor.type_number = qapi_dealloc_type_number; v->visitor.type_size = qapi_dealloc_type_size; + v->visitor.start_union = qapi_dealloc_start_union;QTAILQ_INIT (&v->stack);
Signature · 1 line
1.9.1
PATCH 16/88 tests: add QMP input visitor test for unions with no discriminator
In reply to Michael RothThis is more of an exercise of the dealloc visitor, where it may erroneously use an uninitialized discriminator field as indication that union fields corresponding to that discriminator field/type are present, which can lead to attempts to free random chunks of heap memory.
--- tests/qapi-schema/qapi-schema-test.json | 10 ++++++++++ tests/qapi-schema/qapi-schema-test.out | 3 +++ tests/test-qmp-input-strict.c | 17 +++++++++++++++++ 3 files changed, 30 insertions(+)
tests/qapi-schema/qapi-schema-test.json +10 -0
@@ -33,6 +33,9 @@ { 'type': 'UserDefB', 'data': { 'integer': 'int' } } +{ 'type': 'UserDefC', + 'data': { 'string1': 'str', 'string2': 'str' } } + { 'union': 'UserDefUnion', 'base': 'UserDefZero', 'data': { 'a' : 'UserDefA', 'b' : 'UserDefB' } }
@@ -47,6 +50,13 @@ # FIXME generated struct UserDefFlatUnion has members for direct base # UserDefOne, but lacks members for indirect base UserDefZero +# this variant of UserDefFlatUnion defaults to a union that uses fields with +# allocated types to test corner cases in the cleanup/dealloc visitor +{ 'union': 'UserDefFlatUnion2', + 'base': 'UserDefUnionBase', + 'discriminator': 'enum1', + 'data': { 'value1' : 'UserDefC', 'value2' : 'UserDefB', 'value3' : 'UserDefA' } } + { 'union': 'UserDefAnonUnion', 'discriminator': {}, 'data': { 'uda': 'UserDefA', 's': 'str', 'i': 'int' } }
tests/qapi-schema/qapi-schema-test.out +3 -0
@@ -6,9 +6,11 @@ OrderedDict([('type', 'UserDefNested'), ('data', OrderedDict([('string0', 'str'), ('dict1', OrderedDict([('string1', 'str'), ('dict2', OrderedDict([('userdef1', 'UserDefOne'), ('string2', 'str')])), ('*dict3', OrderedDict([('userdef2', 'UserDefOne'), ('string3', 'str')]))]))]))]), OrderedDict([('type', 'UserDefA'), ('data', OrderedDict([('boolean', 'bool')]))]), OrderedDict([('type', 'UserDefB'), ('data', OrderedDict([('integer', 'int')]))]), + OrderedDict([('type', 'UserDefC'), ('data', OrderedDict([('string1', 'str'), ('string2', 'str')]))]), OrderedDict([('union', 'UserDefUnion'), ('base', 'UserDefZero'), ('data', OrderedDict([('a', 'UserDefA'), ('b', 'UserDefB')]))]), OrderedDict([('type', 'UserDefUnionBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]), OrderedDict([('union', 'UserDefFlatUnion'), ('base', 'UserDefUnionBase'), ('discriminator', 'enum1'), ('data', OrderedDict([('value1', 'UserDefA'), ('value2', 'UserDefB'), ('value3', 'UserDefB')]))]), + OrderedDict([('union', 'UserDefFlatUnion2'), ('base', 'UserDefUnionBase'), ('discriminator', 'enum1'), ('data', OrderedDict([('value1', 'UserDefC'), ('value2', 'UserDefB'), ('value3', 'UserDefA')]))]), OrderedDict([('union', 'UserDefAnonUnion'), ('discriminator', OrderedDict()), ('data', OrderedDict([('uda', 'UserDefA'), ('s', 'str'), ('i', 'int')]))]), OrderedDict([('union', 'UserDefNativeListUnion'), ('data', OrderedDict([('integer', ['int']), ('s8', ['int8']), ('s16', ['int16']), ('s32', ['int32']), ('s64', ['int64']), ('u8', ['uint8']), ('u16', ['uint16']), ('u32', ['uint32']), ('u64', ['uint64']), ('number', ['number']), ('boolean', ['bool']), ('string', ['str'])]))]), OrderedDict([('command', 'user_def_cmd'), ('data', OrderedDict())]),
@@ -32,6 +34,7 @@ OrderedDict([('type', 'UserDefNested'), ('data', OrderedDict([('string0', 'str'), ('dict1', OrderedDict([('string1', 'str'), ('dict2', OrderedDict([('userdef1', 'UserDefOne'), ('string2', 'str')])), ('*dict3', OrderedDict([('userdef2', 'UserDefOne'), ('string3', 'str')]))]))]))]), OrderedDict([('type', 'UserDefA'), ('data', OrderedDict([('boolean', 'bool')]))]), OrderedDict([('type', 'UserDefB'), ('data', OrderedDict([('integer', 'int')]))]), + OrderedDict([('type', 'UserDefC'), ('data', OrderedDict([('string1', 'str'), ('string2', 'str')]))]), OrderedDict([('type', 'UserDefUnionBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]), OrderedDict([('type', 'UserDefOptions'), ('data', OrderedDict([('*i64', ['int']), ('*u64', ['uint64']), ('*u16', ['uint16']), ('*i64x', 'int'), ('*u64x', 'uint64')]))]), OrderedDict([('type', 'EventStructOne'), ('data', OrderedDict([('struct1', 'UserDefOne'), ('string', 'str'), ('*enum2', 'EnumOne')]))])]
tests/test-qmp-input-strict.c +17 -0
@@ -260,6 +260,21 @@ static void test_validate_fail_union_flat(TestInputVisitorData *data,qapi_free_UserDefFlatUnion (tmp); } +static void test_validate_fail_union_flat_no_discrim (TestInputVisitorData *data, +const void *unused) +{ +UserDefFlatUnion2 *tmp =NULL ; +Error *err =NULL ; +Visitor *v; + +/* test situation where discriminator field ('enum1' here) is missing */ + v =validate_test_init (data,"{ 'string': 'c', 'string1': 'd', 'string2': 'e' }" ); + +visit_type_UserDefFlatUnion2 (v, &tmp,NULL , &err); +g_assert (err); +qapi_free_UserDefFlatUnion2 (tmp); +} +static void test_validate_fail_union_anon (TestInputVisitorData *data,const void *unused) {
@@ -310,6 +325,8 @@ int main(int argc, char **argv) &testdata, test_validate_fail_union);validate_test_add ("/visitor/input-strict/fail/union-flat" , &testdata, test_validate_fail_union_flat); +validate_test_add ("/visitor/input-strict/fail/union-flat-no-discriminator" , + &testdata, test_validate_fail_union_flat_no_discrim);validate_test_add ("/visitor/input-strict/fail/union-anon" , &testdata, test_validate_fail_union_anon);
Signature · 1 line
1.9.1
PATCH 17/88 qemu-iotests: Test missing "driver" key for blockdev-add
In reply to Michael RothFrom: Fam Zheng <[email protected]>
--- tests/qemu-iotests/087 | 17 +++++++++++++++++ tests/qemu-iotests/087.out | 13 +++++++++++++ 2 files changed, 30 insertions(+)
tests/qemu-iotests/087 +17 -0
@@ -218,6 +218,23 @@ run_qemu <<EOF { "execute": "quit" } EOF +echo +echo === Missing driver === +echo + +_make_test_img -o encryption=on $size +run_qemu -S <<EOF +{ "execute": "qmp_capabilities" } +{ "execute": "blockdev-add", + "arguments": { + "options": { + "id": "disk" + } + } + } +{ "execute": "quit" } +EOF + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/087.out +13 -0
@@ -64,4 +64,17 @@ QMP_VERSION {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": true}} + +=== Missing driver === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 encryption=on +Testing: -S +QMP_VERSION +{"return": {}} +{"error": {"class": "GenericError", "desc": "Invalid parameter type for 'driver', expected: string"}} +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": true}} + *** done
Signature · 1 line
1.9.1
PATCH 18/88 monitor: Reset HMP mon->rs in CHR_EVENT_OPEN
In reply to Michael RothFrom: Stratos Psomadakis <[email protected]>
Commit cdaa86a54 ("Add G_IO_HUP handler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor, tcp_chr_read() will detect the G_IO_HUP condition and call tcp_chr_disconnect() to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for each tcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without calling readline_restart() on mon->rs in CHR_EVENT_OPEN, future HMP commands will fail.
--- monitor.c | 1 + 1 file changed, 1 insertion(+)
monitor.c +1 -0
@@ -5243,6 +5243,7 @@ static void monitor_event(void *opaque, int event)monitor_printf (mon,"QEMU %s monitor - type 'help' for more " "information\n" ,QEMU_VERSION );if (!mon->mux_out) { +readline_restart (mon->rs);readline_show_prompt (mon->rs); } mon->reset_seen =1 ;
Signature · 1 line
1.9.1
PATCH 19/88 virtio-balloon: fix integer overflow in memory stats feature
In reply to Michael RothFrom: Luiz Capitulino <[email protected]>
When a QMP client changes the polling interval time by setting the guest-stats-polling-interval property, the interval value is stored and manipulated as an int64_t variable.
However, the balloon_stats_change_timer() function, which is used to set the actual timer with the interval value, takes an int instead, causing an overflow for big interval values.
This commit fix this bug by changing balloon_stats_change_timer() to take an int64_t and also it limits the polling interval value to UINT_MAX to avoid other kinds of overflow.
--- hw/virtio/virtio-balloon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +6 -1
@@ -87,7 +87,7 @@ static void balloon_stats_destroy_timer(VirtIOBalloon *s) } } -static void balloon_stats_change_timer (VirtIOBalloon *s,int secs) +static void balloon_stats_change_timer (VirtIOBalloon *s,int64_t secs) {timer_mod (s->stats_timer,qemu_clock_get_ms (QEMU_CLOCK_VIRTUAL ) + secs *1000 ); }
@@ -170,6 +170,11 @@ static void balloon_stats_set_poll_interval(Object *obj, struct Visitor *v,return ; } +if (value >UINT_MAX ) { +error_setg (errp,"timer value is too big" ); +return ; + } +if (value == s->stats_poll_interval) {return ; }
Signature · 1 line
1.9.1
PATCH 20/88 vhost-user: fix VIRTIO_NET_F_MRG_RXBUF negotiation
In reply to Michael RothFrom: Damjan Marion <[email protected]>
Header length check should happen only if backend is kernel. For user backend there is no reason to reset this bit.
vhost-user code does not define .has_vnet_hdr_len so VIRTIO_NET_F_MRG_RXBUF cannot be negotiated even if both sides support it.
--- hw/net/vhost_net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/net/vhost_net.c +4 -4
@@ -163,11 +163,11 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)if (r <0 ) { goto fail; } -if (!qemu_has_vnet_hdr_len (options->net_backend, -sizeof (struct virtio_net_hdr_mrg_rxbuf ))) { - net->dev.features &= ~(1 <<VIRTIO_NET_F_MRG_RXBUF ); - }if (backend_kernel) { +if (!qemu_has_vnet_hdr_len (options->net_backend, +sizeof (struct virtio_net_hdr_mrg_rxbuf ))) { + net->dev.features &= ~(1 <<VIRTIO_NET_F_MRG_RXBUF ); + }if (~net->dev.features & net->dev.backend_features) { fprintf(stderr, "vhost lacks feature mask %" PRIu64 " for backend\n",
Signature · 1 line
1.9.1
PATCH 21/88 ivshmem: Check ivshmem_read() size argument
In reply to Michael RothFrom: Stefan Hajnoczi <[email protected]>
The third argument to the fd_read() callback implemented by ivshmem_read() is the number of bytes, not a flags field. Fix this and check we received enough bytes before accessing the buffer pointer.
--- hw/misc/ivshmem.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
hw/misc/ivshmem.c +28 -2
@@ -24,6 +24,7 @@#include "migration/migration.h" #include "qapi/qmp/qerror.h" #include "qemu/event_notifier.h" +#include "qemu/fifo8.h" #include "sysemu/char.h" #include <sys/mman.h>
@@ -73,6 +74,7 @@ typedef struct IVShmemState {CharDriverState **eventfd_chr;CharDriverState *server_chr; +Fifo8 incoming_fifo;MemoryRegion ivshmem_mmio;/* We might need to register the BAR before we actually have the memory.
@@ -420,14 +422,35 @@ static void increase_dynamic_storage(IVShmemState *s, int new_min_size) { } } -static void ivshmem_read (void *opaque,const uint8_t * buf,int flags) +static void ivshmem_read (void *opaque,const uint8_t *buf,int size) {IVShmemState *s = opaque;int incoming_fd, tmp_fd;int guest_max_eventfd;long incoming_posn; -memcpy (&incoming_posn, buf,sizeof (long )); +if (fifo8_is_empty (&s->incoming_fifo) && size ==sizeof (incoming_posn)) { +memcpy (&incoming_posn, buf, size); + }else { +const uint8_t *p; +uint32_t num; + +IVSHMEM_DPRINTF ("short read of %d bytes\n" , size); + num =MAX (size,sizeof (long ) -fifo8_num_used (&s->incoming_fifo)); +fifo8_push_all (&s->incoming_fifo, buf, num); +if (fifo8_num_used (&s->incoming_fifo) <sizeof (incoming_posn)) { +return ; + } + size -= num; + buf += num; + p =fifo8_pop_buf (&s->incoming_fifo,sizeof (incoming_posn), &num); +g_assert (num ==sizeof (incoming_posn)); +memcpy (&incoming_posn, p,sizeof (incoming_posn)); +if (size >0 ) { +fifo8_push_all (&s->incoming_fifo, buf, size); + } + } +/* pick off s->server_chr->msgfd and store it, posn should accompany msg */ tmp_fd =qemu_chr_fe_get_msgfd (s->server_chr);IVSHMEM_DPRINTF ("posn is %ld, fd is %d\n" , incoming_posn, tmp_fd);
@@ -659,6 +682,8 @@ static int pci_ivshmem_init(PCIDevice *dev) s->ivshmem_size =ivshmem_get_size (s); } +fifo8_create (&s->incoming_fifo,sizeof (long )); +register_savevm (DEVICE (dev),"ivshmem" ,0 ,0 , ivshmem_save, ivshmem_load, dev);
@@ -795,6 +820,7 @@ static void pci_ivshmem_uninit(PCIDevice *dev)memory_region_destroy (&s->ivshmem);memory_region_destroy (&s->bar);unregister_savevm (DEVICE (dev),"ivshmem" , s); +fifo8_destroy (&s->incoming_fifo); }static Property ivshmem_properties[] = {
Signature · 1 line
1.9.1
PATCH 22/88 ivshmem: validate incoming_posn value from server
In reply to Michael RothFrom: Stefan Hajnoczi <[email protected]>
Check incoming_posn to avoid out-of-bounds array accesses if the ivshmem server on the host sends invalid values.
--- hw/misc/ivshmem.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/misc/ivshmem.c +8 -0
@@ -385,6 +385,9 @@ static void close_guest_eventfds(IVShmemState *s, int posn)if (!ivshmem_has_feature (s,IVSHMEM_IOEVENTFD )) {return ; } +if (posn <0 || posn >= s->nb_peers) { +return ; + } guest_curr_max = s->peers[posn].nb_eventfds;
@@ -451,6 +454,11 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size) } } +if (incoming_posn <-1 ) { +IVSHMEM_DPRINTF ("invalid incoming_posn %ld\n" , incoming_posn); +return ; + } +/* pick off s->server_chr->msgfd and store it, posn should accompany msg */ tmp_fd =qemu_chr_fe_get_msgfd (s->server_chr);IVSHMEM_DPRINTF ("posn is %ld, fd is %d\n" , incoming_posn, tmp_fd);
Signature · 1 line
1.9.1
PATCH 23/88 ivshmem: Fix potential OOB r/w access
In reply to Michael RothFrom: Sebastian Krahmer <[email protected]>
Fix OOB access via malformed incoming_posn parameters and check that requested memory is actually alloc'ed.
--- hw/misc/ivshmem.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
hw/misc/ivshmem.c +23 -4
@@ -29,6 +29,7 @@#include <sys/mman.h> #include <sys/types.h> +#include <limits.h> #define PCI_VENDOR_ID_IVSHMEM PCI_VENDOR_ID_REDHAT_QUMRANET#define PCI_DEVICE_ID_IVSHMEM 0x1110
@@ -406,14 +407,24 @@ static void close_guest_eventfds(IVShmemState *s, int posn)/* this function increase the dynamic storage need to store data about other * guests */ -static void increase_dynamic_storage (IVShmemState *s,int new_min_size) { +static int increase_dynamic_storage (IVShmemState *s,int new_min_size) +{int j, old_nb_alloc; +/* check for integer overflow */ +if (new_min_size >=INT_MAX /sizeof (Peer) -1 || new_min_size <=0 ) { +return -1 ; + } + old_nb_alloc = s->nb_peers; -while (new_min_size >= s->nb_peers) - s->nb_peers = s->nb_peers *2 ; +if (new_min_size >= s->nb_peers) { +/* +1 because #new_min_size is used as last array index */ + s->nb_peers = new_min_size +1 ; + }else { +return 0 ; + }IVSHMEM_DPRINTF ("bumping storage to %d guests\n" , s->nb_peers); s->peers =g_realloc (s->peers, s->nb_peers *sizeof (Peer));
@@ -423,6 +434,8 @@ static void increase_dynamic_storage(IVShmemState *s, int new_min_size) { s->peers[j].eventfds =NULL ; s->peers[j].nb_eventfds =0 ; } + +return 0 ; }static void ivshmem_read (void *opaque,const uint8_t *buf,int size)
@@ -465,7 +478,13 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size)/* make sure we have enough space for this guest */ if (incoming_posn >= s->nb_peers) { -increase_dynamic_storage (s, incoming_posn); +if (increase_dynamic_storage (s, incoming_posn) <0 ) { +error_report ("increase_dynamic_storage() failed" ); +if (tmp_fd !=-1 ) { +close (tmp_fd); + } +return ; + } }if (tmp_fd ==-1 ) {
Signature · 1 line
1.9.1
PATCH 24/88 ivshmem: Fix fd leak on error
In reply to Michael RothFrom: Andreas Färber <[email protected]>
--- hw/misc/ivshmem.c | 1 + 1 file changed, 1 insertion(+)
hw/misc/ivshmem.c +1 -0
@@ -508,6 +508,7 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size)if (incoming_fd ==-1 ) {fprintf (stderr,"could not allocate file descriptor %s\n" ,strerror (errno)); +close (tmp_fd);return ; }
Signature · 1 line
1.9.1
PATCH 25/88 pc-dimm: Don't check dimm->node when there is non-NUMA config
In reply to Michael RothFrom: zhanghailiang <[email protected]>
It should not break memory hotplug feature if there is non-NUMA option.
This patch would also allow to use pc-dimm as replacement for initial memory for non-NUMA configs.
Note: After this patch, the memory hotplug can work normally for Linux guest OS when there is non-NUMA option and NUMA option. But not support Windows guest OS to hotplug memory with no-NUMA config, actully, it's Windows limitation.
--- hw/mem/pc-dimm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/mem/pc-dimm.c +1 -1
@@ -252,7 +252,7 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp)error_setg (errp,"'" PC_DIMM_MEMDEV_PROP "' property is not set" );return ; } -if (dimm->node >= nb_numa_nodes) { +if ((nb_numa_nodes >0 ) && (dimm->node >= nb_numa_nodes)) {error_setg (errp,"'DIMM property " PC_DIMM_NODE_PROP " has value %" PRIu32"' which exceeds the number of numa nodes: %d" , dimm->node, nb_numa_nodes);
Signature · 1 line
1.9.1
PATCH 26/88 tests: avoid running duplicate qom-tests
In reply to Michael RothSince 3687d532 we've been unconditionally adding qom-test to our qtests for every arch. However, some archs inherit their tests from Makefile variables for other archs, such as i386/x86_64, microblaze/microblazeel, and xtensa/xtensaeb. Since these are evaluated in a lazy manner, we ultimately end up adding qom-test twice.
In the case x86_64, where we have a large number of machine types that we rerun qom-test for, this has lead to a fairly noticeable increase in the overall run-time of make check (78s vs. 42s on my machine). Similar speed-ups are visible for other such archs, but not nearly as significant.
Fix this by only adding qom-test to an arch's test list if it's not already present.
--- tests/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/Makefile +2 -1
@@ -187,7 +187,8 @@ check-qtest-xtensaeb-y = $(check-qtest-xtensa-y) # qom-test works for all sysemu architectures: $(foreach target,$(SYSEMU_TARGET_LIST), \ - $(eval check-qtest-$(target)-y += tests/qom-test$(EXESUF))) + $(if $(findstring tests/qom-test$(EXESUF), $(check-qtest-$(target)-y)),, \ + $(eval check-qtest-$(target)-y += tests/qom-test$(EXESUF)))) check-qapi-schema-y := $(addprefix tests/qapi-schema/, \ comments.json empty.json funny-char.json indented-expr.json \
Signature · 1 line
1.9.1
PATCH 27/88 snapshot: fix referencing wrong variable in while loop in do_delvm
In reply to Michael RothFrom: Zhang Haoyu <[email protected]>
The while loop variabal is "bs1",
but "bs" is always passed to bdrv_snapshot_delete_by_id_or_name. Broken in commit a89d89d, v1.7.0.
--- savevm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
savevm.c +5 -6
@@ -1245,19 +1245,18 @@ int load_vmstate(const char *name)void do_delvm (Monitor *mon,const QDict *qdict) { -BlockDriverState *bs, *bs1; +BlockDriverState *bs;Error *err =NULL ;const char *name =qdict_get_str (qdict,"name" ); - bs =find_vmstate_bs (); -if (!bs) { +if (!find_vmstate_bs ()) {monitor_printf (mon,"No block device supports snapshots\n" );return ; } - bs1 =NULL ; -while ((bs1 =bdrv_next (bs1))) { -if (bdrv_can_snapshot (bs1)) { + bs =NULL ; +while ((bs =bdrv_next (bs))) { +if (bdrv_can_snapshot (bs)) {bdrv_snapshot_delete_by_id_or_name (bs, name, &err);if (err) { monitor_printf(mon,
Signature · 1 line
1.9.1
PATCH 28/88 smbios: Fix assertion on socket count calculation
In reply to Michael RothFrom: Eduardo Habkost <[email protected]>
QEMU currently allows the number of VCPUs to not be a multiple of the number of threads per socket, but the smbios socket count calculation introduced by commit c97294ec1b9e36887e119589d456557d72ab37b5 doesn't take that into account, triggering an assertion. e.g.:
$ ./x86_64-softmmu/qemu-system-x86_64 -smp 4,sockets=2,cores=6,threads=1 qemu-system-x86_64: /home/ehabkost/rh/proj/virt/qemu/hw/i386/smbios.c:825: smbios_get_tables: Assertion `smbios_smp_sockets >= 1' failed. Aborted (core dumped)
Socket count calculation doesn't belong to smbios.c and should eventually be moved to the main SMP topology configuration code. But while we don't move the code, at least make it correct by rounding up the division.
--- hw/i386/smbios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/smbios.c +1 -1
@@ -821,7 +821,7 @@ void smbios_get_tables(uint8_t **tables, size_t *tables_len,smbios_build_type_2_table ();smbios_build_type_3_table (); - smbios_smp_sockets = smp_cpus / (smp_cores * smp_threads); + smbios_smp_sockets =DIV_ROUND_UP (smp_cpus, smp_cores * smp_threads);assert (smbios_smp_sockets >=1 );for (i =0 ; i < smbios_smp_sockets; i++) {
Signature · 1 line
1.9.1
PATCH 29/88 vhost-scsi: use virtio_ldl_p
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
This helps for cross-endian configurations.
--- hw/scsi/vhost-scsi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/scsi/vhost-scsi.c +3 -2
@@ -23,6 +23,7 @@#include "hw/virtio/vhost.h" #include "hw/virtio/virtio-scsi.h" #include "hw/virtio/virtio-bus.h" +#include "hw/virtio/virtio-access.h" /* Features supported by host kernel. */ static const int kernel_feature_bits[] = {
@@ -163,8 +164,8 @@ static void vhost_scsi_set_config(VirtIODevice *vdev,VirtIOSCSIConfig *scsiconf = (VirtIOSCSIConfig *)config;VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (vdev); -if ((uint32_t )ldl_p (&scsiconf->sense_size) != vs->sense_size || - (uint32_t )ldl_p (&scsiconf->cdb_size) != vs->cdb_size) { +if ((uint32_t )virtio_ldl_p (vdev, &scsiconf->sense_size) != vs->sense_size || + (uint32_t )virtio_ldl_p (vdev, &scsiconf->cdb_size) != vs->cdb_size) {error_report ("vhost-scsi does not support changing the sense data and CDB sizes" );exit (1 ); }
Signature · 1 line
1.9.1
PATCH 30/88 virtio-net: use aliases instead of duplicate qdev properties
In reply to Michael RothFrom: Gonglei <[email protected]>
virtio-net-pci, virtio-net-s390, and virtio-net-ccw all duplicate the qdev properties of their VirtIONet child. This approach does not work well with string or pointer properties since we must be careful about leaking or double-freeing them.
Use the QOM alias property to forward property accesses to the VirtIONet child. This way no duplication is necessary.
--- hw/s390x/s390-virtio-bus.c | 3 +-- hw/s390x/virtio-ccw.c | 3 +-- hw/virtio/virtio-pci.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-)
hw/s390x/s390-virtio-bus.c +1 -2
@@ -161,6 +161,7 @@ static void s390_virtio_net_instance_init(Object *obj)VirtIONetS390 *dev =VIRTIO_NET_S390 (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_NET );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static int s390_virtio_blk_init (VirtIOS390Device *s390_dev)
@@ -493,10 +494,8 @@ static unsigned virtio_s390_get_features(DeviceState *d)/**************** S390 Virtio Bus Device Descriptions *******************/ static Property s390_virtio_net_properties[] = { -DEFINE_NIC_PROPERTIES (VirtIONetS390, vdev.nic_conf),DEFINE_VIRTIO_COMMON_FEATURES (VirtIOS390Device, host_features),DEFINE_VIRTIO_NET_FEATURES (VirtIOS390Device, host_features), -DEFINE_VIRTIO_NET_PROPERTIES (VirtIONetS390, vdev.net_conf),DEFINE_PROP_END_OF_LIST (), };
hw/s390x/virtio-ccw.c +1 -2
@@ -794,6 +794,7 @@ static void virtio_ccw_net_instance_init(Object *obj)VirtIONetCcw *dev =VIRTIO_NET_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_NET );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static int virtio_ccw_blk_init (VirtioCcwDevice *ccw_dev)
@@ -1374,8 +1375,6 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)static Property virtio_ccw_net_properties[] = {DEFINE_PROP_STRING ("devno" , VirtioCcwDevice, bus_id),DEFINE_VIRTIO_NET_FEATURES (VirtioCcwDevice, host_features[0 ]), -DEFINE_VIRTIO_NET_PROPERTIES (VirtIONetCcw, vdev.net_conf), -DEFINE_NIC_PROPERTIES (VirtIONetCcw, vdev.nic_conf),DEFINE_PROP_BIT ("ioeventfd" , VirtioCcwDevice, flags,VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT , true),DEFINE_PROP_END_OF_LIST (),
hw/virtio/virtio-pci.c +1 -2
@@ -1427,8 +1427,6 @@ static Property virtio_net_properties[] = { VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, false), DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), DEFINE_VIRTIO_NET_FEATURES(VirtIOPCIProxy, host_features), -DEFINE_NIC_PROPERTIES (VirtIONetPCI, vdev.nic_conf), -DEFINE_VIRTIO_NET_PROPERTIES (VirtIONetPCI, vdev.net_conf), DEFINE_PROP_END_OF_LIST(), };
@@ -1469,6 +1467,7 @@ static void virtio_net_pci_instance_init(Object *obj)VirtIONetPCI *dev =VIRTIO_NET_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_NET );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static const TypeInfo virtio_net_pci_info = {
Signature · 1 line
1.9.1
PATCH 31/88 virtio-net: fix virtio-net child refcount in transports
In reply to Michael RothFrom: Gonglei <[email protected]>
object_initialize() leaves the object with a refcount of 1. object_property_add_child() adds its own reference which is dropped again when the property is deleted.
The upshot of this is that we always have a refcount >= 1. Upon hot unplug the virtio-net child is not finalized!
Drop our reference after the child property has been added to the parent.
--- hw/s390x/s390-virtio-bus.c | 1 + hw/s390x/virtio-ccw.c | 1 + hw/virtio/virtio-pci.c | 1 + 3 files changed, 3 insertions(+)
hw/s390x/s390-virtio-bus.c +1 -0
@@ -161,6 +161,7 @@ static void s390_virtio_net_instance_init(Object *obj)VirtIONetS390 *dev =VIRTIO_NET_S390 (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_NET );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev));qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }
hw/s390x/virtio-ccw.c +1 -0
@@ -794,6 +794,7 @@ static void virtio_ccw_net_instance_init(Object *obj)VirtIONetCcw *dev =VIRTIO_NET_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_NET );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev));qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }
hw/virtio/virtio-pci.c +1 -0
@@ -1467,6 +1467,7 @@ static void virtio_net_pci_instance_init(Object *obj)VirtIONetPCI *dev =VIRTIO_NET_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_NET );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev));qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }
Signature · 1 line
1.9.1
PATCH 32/88 virtio/vhost-scsi: use aliases instead of duplicate qdev properties
In reply to Michael RothFrom: Gonglei <[email protected]>
{virtio, vhost}-scsi-{pci, s390, ccw} all duplicate the qdev properties of their VirtIOSCSI/VHostSCSI child. This approach does not work well with string or pointer properties since we must be careful about leaking or double-freeing them.
Use the QOM alias property to forward property accesses to the VirtIOSCSI/VHostSCSI child. This way no duplication is necessary.
--- hw/s390x/s390-virtio-bus.c | 4 ++-- hw/s390x/virtio-ccw.c | 4 ++-- hw/virtio/virtio-pci.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
hw/s390x/s390-virtio-bus.c +2 -2
@@ -258,6 +258,7 @@ static void s390_virtio_scsi_instance_init(Object *obj)VirtIOSCSIS390 *dev =VIRTIO_SCSI_S390 (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }#ifdef CONFIG_VHOST_SCSI
@@ -279,6 +280,7 @@ static void s390_vhost_scsi_instance_init(Object *obj)VHostSCSIS390 *dev =VHOST_SCSI_S390 (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VHOST_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); + qdev_alias_all_properties(DEVICE(&dev->vdev), obj); }#endif
@@ -614,7 +616,6 @@ static const TypeInfo virtio_s390_device_info = { };static Property s390_virtio_scsi_properties[] = { -DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSIS390, vdev.parent_obj.conf),DEFINE_VIRTIO_COMMON_FEATURES (VirtIOS390Device, host_features),DEFINE_VIRTIO_SCSI_FEATURES (VirtIOS390Device, host_features),DEFINE_PROP_END_OF_LIST (),
@@ -640,7 +641,6 @@ static const TypeInfo s390_virtio_scsi = {#ifdef CONFIG_VHOST_SCSI static Property s390_vhost_scsi_properties[] = {DEFINE_VIRTIO_COMMON_FEATURES (VirtIOS390Device, host_features), -DEFINE_VHOST_SCSI_PROPERTIES (VHostSCSIS390, vdev.parent_obj.conf),DEFINE_PROP_END_OF_LIST (), };
hw/s390x/virtio-ccw.c +2 -2
@@ -938,6 +938,7 @@ static void virtio_ccw_scsi_instance_init(Object *obj)VirtIOSCSICcw *dev =VIRTIO_SCSI_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }#ifdef CONFIG_VHOST_SCSI
@@ -959,6 +960,7 @@ static void vhost_ccw_scsi_instance_init(Object *obj)VHostSCSICcw *dev =VHOST_SCSI_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VHOST_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); + qdev_alias_all_properties(DEVICE(&dev->vdev), obj); }#endif
@@ -1481,7 +1483,6 @@ static const TypeInfo virtio_ccw_balloon = {static Property virtio_ccw_scsi_properties[] = {DEFINE_PROP_STRING ("devno" , VirtioCcwDevice, bus_id), -DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSICcw, vdev.parent_obj.conf),DEFINE_VIRTIO_SCSI_FEATURES (VirtioCcwDevice, host_features[0 ]),DEFINE_PROP_BIT ("ioeventfd" , VirtioCcwDevice, flags,VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT , true),
@@ -1510,7 +1511,6 @@ static const TypeInfo virtio_ccw_scsi = {#ifdef CONFIG_VHOST_SCSI static Property vhost_ccw_scsi_properties[] = {DEFINE_PROP_STRING ("devno" , VirtioCcwDevice, bus_id), -DEFINE_VHOST_SCSI_PROPERTIES (VirtIOSCSICcw, vdev.parent_obj.conf),DEFINE_PROP_END_OF_LIST (), };
hw/virtio/virtio-pci.c +2 -2
@@ -1137,7 +1137,6 @@ static Property virtio_scsi_pci_properties[] = {DEFINE_PROP_UINT32 ("vectors" , VirtIOPCIProxy, nvectors,DEV_NVECTORS_UNSPECIFIED ),DEFINE_VIRTIO_SCSI_FEATURES (VirtIOPCIProxy, host_features), -DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSIPCI, vdev.parent_obj.conf), DEFINE_PROP_END_OF_LIST(), };
@@ -1189,6 +1188,7 @@ static void virtio_scsi_pci_instance_init(Object *obj)VirtIOSCSIPCI *dev =VIRTIO_SCSI_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static const TypeInfo virtio_scsi_pci_info = {
@@ -1205,7 +1205,6 @@ static const TypeInfo virtio_scsi_pci_info = {static Property vhost_scsi_pci_properties[] = {DEFINE_PROP_UINT32 ("vectors" , VirtIOPCIProxy, nvectors,DEV_NVECTORS_UNSPECIFIED ), -DEFINE_VHOST_SCSI_PROPERTIES (VHostSCSIPCI, vdev.parent_obj.conf),DEFINE_PROP_END_OF_LIST (), };
@@ -1245,6 +1244,7 @@ static void vhost_scsi_pci_instance_init(Object *obj)VHostSCSIPCI *dev =VHOST_SCSI_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VHOST_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static const TypeInfo vhost_scsi_pci_info = {
Signature · 1 line
1.9.1
PATCH 33/88 virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in transports
In reply to Michael RothFrom: Gonglei <[email protected]>
object_initialize() leaves the object with a refcount of 1. object_property_add_child() adds its own reference which is dropped again when the property is deleted.
The upshot of this is that we always have a refcount >= 1. Upon hot unplug the virtio-scsi/vhost-scsi child is not finalized!
Drop our reference after the child property has been added to the parent.
--- hw/s390x/s390-virtio-bus.c | 2 ++ hw/s390x/virtio-ccw.c | 2 ++ hw/virtio/virtio-pci.c | 2 ++ 3 files changed, 6 insertions(+)
hw/s390x/s390-virtio-bus.c +2 -0
@@ -258,6 +258,7 @@ static void s390_virtio_scsi_instance_init(Object *obj)VirtIOSCSIS390 *dev =VIRTIO_SCSI_S390 (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev));qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }
@@ -280,6 +281,7 @@ static void s390_vhost_scsi_instance_init(Object *obj)VHostSCSIS390 *dev =VHOST_SCSI_S390 (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VHOST_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev)); qdev_alias_all_properties(DEVICE(&dev->vdev), obj); }#endif
hw/s390x/virtio-ccw.c +2 -0
@@ -938,6 +938,7 @@ static void virtio_ccw_scsi_instance_init(Object *obj)VirtIOSCSICcw *dev =VIRTIO_SCSI_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev));qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }
@@ -960,6 +961,7 @@ static void vhost_ccw_scsi_instance_init(Object *obj)VHostSCSICcw *dev =VHOST_SCSI_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VHOST_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev)); qdev_alias_all_properties(DEVICE(&dev->vdev), obj); }#endif
hw/virtio/virtio-pci.c +2 -0
@@ -1188,6 +1188,7 @@ static void virtio_scsi_pci_instance_init(Object *obj)VirtIOSCSIPCI *dev =VIRTIO_SCSI_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev));qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }
@@ -1244,6 +1245,7 @@ static void vhost_scsi_pci_instance_init(Object *obj)VHostSCSIPCI *dev =VHOST_SCSI_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VHOST_SCSI );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +object_unref (OBJECT (&dev->vdev));qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }
Signature · 1 line
1.9.1
PATCH 34/88 virtio-serial: use aliases instead of duplicate qdev properties
In reply to Michael RothFrom: Gonglei <[email protected]>
virtio-serial-{pci, s390, ccw} all duplicate the qdev properties of their VirtIOSerial child. This approach does not work well with string or pointer properties since we must be careful about leaking or double-freeing them.
Use the QOM alias property to forward property accesses to the VirtIOSerial child. This way no duplication is necessary.
--- hw/s390x/s390-virtio-bus.c | 2 +- hw/s390x/virtio-ccw.c | 2 +- hw/virtio/virtio-pci.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
hw/s390x/s390-virtio-bus.c +1 -1
@@ -226,6 +226,7 @@ static void s390_virtio_serial_instance_init(Object *obj)VirtIOSerialS390 *dev =VIRTIO_SERIAL_S390 (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SERIAL );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static int s390_virtio_scsi_init (VirtIOS390Device *s390_dev)
@@ -537,7 +538,6 @@ static const TypeInfo s390_virtio_blk = { };static Property s390_virtio_serial_properties[] = { -DEFINE_VIRTIO_SERIAL_PROPERTIES (VirtIOSerialS390, vdev.serial),DEFINE_PROP_END_OF_LIST (), };
hw/s390x/virtio-ccw.c +1 -1
@@ -852,6 +852,7 @@ static void virtio_ccw_serial_instance_init(Object *obj)VirtioSerialCcw *dev =VIRTIO_SERIAL_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SERIAL );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static int virtio_ccw_balloon_init (VirtioCcwDevice *ccw_dev)
@@ -1432,7 +1433,6 @@ static const TypeInfo virtio_ccw_blk = {static Property virtio_ccw_serial_properties[] = {DEFINE_PROP_STRING ("devno" , VirtioCcwDevice, bus_id), -DEFINE_VIRTIO_SERIAL_PROPERTIES (VirtioSerialCcw, vdev.serial),DEFINE_PROP_BIT ("ioeventfd" , VirtioCcwDevice, flags,VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT , true),DEFINE_PROP_END_OF_LIST (),
hw/virtio/virtio-pci.c +1 -1
@@ -1389,7 +1389,6 @@ static Property virtio_serial_pci_properties[] = { VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), -DEFINE_VIRTIO_SERIAL_PROPERTIES (VirtIOSerialPCI, vdev.serial), DEFINE_PROP_END_OF_LIST(), };
@@ -1412,6 +1411,7 @@ static void virtio_serial_pci_instance_init(Object *obj)VirtIOSerialPCI *dev =VIRTIO_SERIAL_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SERIAL );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static const TypeInfo virtio_serial_pci_info = {
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 34/88] virtio-serial: use aliases instead of duplicate qdev properties
Quoted 12 lines · Michael Roth
From: Gonglei <[email protected]>
virtio-serial-{pci, s390, ccw} all duplicate the qdev properties of their VirtIOSerial child. This approach does not work well with string or pointer properties since we must be careful about leaking or double-freeing them.
Use the QOM alias property to forward property accesses to the VirtIOSerial child. This way no duplication is necessary.
hw/s390x/s390-virtio-bus.c static const TypeInfo s390_virtio_blk = { · line 542
Quoted 6 lines
hw/s390x/s390-virtio-bus.c +0
-1@@ -537,7 +538,6 @@ static const TypeInfo s390_virtio_blk = { };static Property s390_virtio_serial_properties[] = { -DEFINE_VIRTIO_SERIAL_PROPERTIES (VirtIOSerialS390, vdev.serial),DEFINE_PROP_END_OF_LIST (), };
This hunk leaves us with a Property array which has nothing in it except the list terminator, which is a bit pointless... Since this is now in master perhaps a cleanup patch is in order.
(noticed while I was fixing conflicts in a recent pullreq)
-- PMM
PATCH 35/88 virtio-serial: fix virtio-serial child refcount in transports
In reply to Michael RothFrom: Gonglei <[email protected]>
object_initialize() leaves the object with a refcount of 1. object_property_add_child() adds its own reference which is dropped again when the property is deleted.
The upshot of this is that we always have a refcount >= 1. Upon hot unplug the virtio-serial child is not finalized!
Drop our reference after the child property has been added to the parent.
--- hw/s390x/s390-virtio-bus.c | 1 + hw/s390x/virtio-ccw.c | 1 + hw/virtio/virtio-pci.c | 1 + 3 files changed, 3 insertions(+)
hw/s390x/s390-virtio-bus.c +1 -0
@@ -227,6 +227,7 @@ static void s390_virtio_serial_instance_init(Object *obj)object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SERIAL );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL );qdev_alias_all_properties (DEVICE (&dev->vdev), obj); +object_unref (OBJECT (&dev->vdev)); }static int s390_virtio_scsi_init (VirtIOS390Device *s390_dev)
hw/s390x/virtio-ccw.c +1 -0
@@ -853,6 +853,7 @@ static void virtio_ccw_serial_instance_init(Object *obj)object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SERIAL );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL );qdev_alias_all_properties (DEVICE (&dev->vdev), obj); +object_unref (OBJECT (&dev->vdev)); }static int virtio_ccw_balloon_init (VirtioCcwDevice *ccw_dev)
hw/virtio/virtio-pci.c +1 -0
@@ -1412,6 +1412,7 @@ static void virtio_serial_pci_instance_init(Object *obj)object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_SERIAL );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL );qdev_alias_all_properties (DEVICE (&dev->vdev), obj); +object_unref (OBJECT (&dev->vdev)); }static const TypeInfo virtio_serial_pci_info = {
Signature · 1 line
1.9.1
PATCH 36/88 virtio-rng: use aliases instead of duplicate qdev properties
In reply to Michael RothFrom: Gonglei <[email protected]>
virtio-rng-{pci, s390, ccw} all duplicate the qdev properties of their VirtIORNG child.
This approach does not work well with string or pointer properties since we must be careful about leaking or double-freeing them.
Use the QOM alias property to forward property accesses to the VirtIORNG child. This way no duplication is necessary.
--- hw/s390x/s390-virtio-bus.c | 2 +- hw/s390x/virtio-ccw.c | 2 +- hw/virtio/virtio-pci.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
hw/s390x/s390-virtio-bus.c +1 -1
@@ -311,6 +311,7 @@ static void s390_virtio_rng_instance_init(Object *obj)VirtIORNGS390 *dev =VIRTIO_RNG_S390 (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_RNG );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, (Object **)&dev->vdev.conf.rng, qdev_prop_allow_set_link_before_realize,
@@ -561,7 +562,6 @@ static const TypeInfo s390_virtio_serial = {static Property s390_virtio_rng_properties[] = {DEFINE_VIRTIO_COMMON_FEATURES (VirtIOS390Device, host_features), -DEFINE_VIRTIO_RNG_PROPERTIES (VirtIORNGS390, vdev.conf),DEFINE_PROP_END_OF_LIST (), };
hw/s390x/virtio-ccw.c +1 -1
@@ -1542,6 +1542,7 @@ static void virtio_ccw_rng_instance_init(Object *obj)VirtIORNGCcw *dev =VIRTIO_RNG_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_RNG );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, (Object **)&dev->vdev.conf.rng, qdev_prop_allow_set_link_before_realize,
@@ -1550,7 +1551,6 @@ static void virtio_ccw_rng_instance_init(Object *obj)static Property virtio_ccw_rng_properties[] = {DEFINE_PROP_STRING ("devno" , VirtioCcwDevice, bus_id), -DEFINE_VIRTIO_RNG_PROPERTIES (VirtIORNGCcw, vdev.conf),DEFINE_PROP_BIT ("ioeventfd" , VirtioCcwDevice, flags,VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT , true),DEFINE_PROP_END_OF_LIST (),
hw/virtio/virtio-pci.c +1 -1
@@ -1485,7 +1485,6 @@ static const TypeInfo virtio_net_pci_info = {/* virtio-rng-pci */ static Property virtio_rng_pci_properties[] = { -DEFINE_VIRTIO_RNG_PROPERTIES (VirtIORngPCI, vdev.conf),DEFINE_PROP_END_OF_LIST (), };
@@ -1527,6 +1526,7 @@ static void virtio_rng_initfn(Object *obj)VirtIORngPCI *dev =VIRTIO_RNG_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_RNG );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, (Object **)&dev->vdev.conf.rng, qdev_prop_allow_set_link_before_realize,
Signature · 1 line
1.9.1
PATCH 37/88 virtio-rng: fix virtio-rng child refcount in transports
In reply to Michael RothFrom: Gonglei <[email protected]>
object_initialize() leaves the object with a refcount of 1. object_property_add_child() adds its own reference which is dropped again when the property is deleted.
The upshot of this is that we always have a refcount >= 1. Upon hot unplug the virtio-rng child is not finalized!
Drop our reference after the child property has been added to the parent.
--- hw/s390x/s390-virtio-bus.c | 1 + hw/s390x/virtio-ccw.c | 1 + hw/virtio/virtio-pci.c | 1 + 3 files changed, 3 insertions(+)
hw/s390x/s390-virtio-bus.c +1 -0
@@ -312,6 +312,7 @@ static void s390_virtio_rng_instance_init(Object *obj)object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_RNG );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL );qdev_alias_all_properties (DEVICE (&dev->vdev), obj); +object_unref (OBJECT (&dev->vdev)); object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, (Object **)&dev->vdev.conf.rng, qdev_prop_allow_set_link_before_realize,
hw/s390x/virtio-ccw.c +1 -0
@@ -1543,6 +1543,7 @@ static void virtio_ccw_rng_instance_init(Object *obj)object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_RNG );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL );qdev_alias_all_properties (DEVICE (&dev->vdev), obj); +object_unref (OBJECT (&dev->vdev)); object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, (Object **)&dev->vdev.conf.rng, qdev_prop_allow_set_link_before_realize,
hw/virtio/virtio-pci.c +1 -0
@@ -1527,6 +1527,7 @@ static void virtio_rng_initfn(Object *obj)object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_RNG );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL );qdev_alias_all_properties (DEVICE (&dev->vdev), obj); +object_unref (OBJECT (&dev->vdev)); object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, (Object **)&dev->vdev.conf.rng, qdev_prop_allow_set_link_before_realize,
Signature · 1 line
1.9.1
PATCH 38/88 virtio-balloon: fix virtio-balloon child refcount in transports
In reply to Michael RothFrom: Gonglei <[email protected]>
object_initialize() leaves the object with a refcount of 1. object_property_add_child() adds its own reference which is dropped again when the property is deleted.
The upshot of this is that we always have a refcount >= 1. Upon hot unplug the virtio-balloon child is not finalized!
Drop our reference after the child property has been added to the parent.
--- hw/s390x/virtio-ccw.c | 2 +- hw/virtio/virtio-pci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
hw/s390x/virtio-ccw.c +1 -1
@@ -900,7 +900,7 @@ static void virtio_ccw_balloon_instance_init(Object *obj)VirtIOBalloonCcw *dev =VIRTIO_BALLOON_CCW (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_BALLOON );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); - +object_unref (OBJECT (&dev->vdev));object_property_add (obj,"guest-stats" ,"guest statistics" , balloon_ccw_stats_get_all,NULL ,NULL , dev,NULL );
hw/virtio/virtio-pci.c +1 -1
@@ -1327,7 +1327,7 @@ static void virtio_balloon_pci_instance_init(Object *obj)VirtIOBalloonPCI *dev =VIRTIO_BALLOON_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_BALLOON );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); - +object_unref (OBJECT (&dev->vdev));object_property_add (obj,"guest-stats" ,"guest statistics" , balloon_pci_stats_get_all,NULL ,NULL , dev,NULL );
Signature · 1 line
1.9.1
PATCH 39/88 virtio-9p: use aliases instead of duplicate qdev properties
In reply to Michael RothFrom: Gonglei <[email protected]>
virtio-9p-pci all duplicate the qdev properties of their V9fsState child. This approach does not work well with string or pointer properties since we must be careful about leaking or double-freeing them.
Use the QOM alias property to forward property accesses to the V9fsState child. This way no duplication is necessary.
--- hw/virtio/virtio-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-pci.c +1 -1
@@ -924,7 +924,6 @@ static Property virtio_9p_pci_properties[] = {DEFINE_PROP_BIT ("ioeventfd" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT , true),DEFINE_PROP_UINT32 ("vectors" , VirtIOPCIProxy, nvectors,2 ), -DEFINE_VIRTIO_9P_PROPERTIES (V9fsPCIState, vdev.fsconf), DEFINE_PROP_END_OF_LIST(), };
@@ -948,6 +947,7 @@ static void virtio_9p_pci_instance_init(Object *obj)V9fsPCIState *dev =VIRTIO_9P_PCI (obj);object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_9P );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +qdev_alias_all_properties (DEVICE (&dev->vdev), obj); }static const TypeInfo virtio_9p_pci_info = {
Signature · 1 line
1.9.1
PATCH 40/88 virtio-9p: fix virtio-9p child refcount in transports
In reply to Michael RothFrom: Gonglei <[email protected]>
object_initialize() leaves the object with a refcount of 1. object_property_add_child() adds its own reference which is dropped again when the property is deleted.
The upshot of this is that we always have a refcount >= 1. Upon unplug the virtio-9p child is not finalized!
Drop our reference after the child property has been added to the parent.
--- hw/virtio/virtio-pci.c | 1 + 1 file changed, 1 insertion(+)
hw/virtio/virtio-pci.c +1 -0
@@ -948,6 +948,7 @@ static void virtio_9p_pci_instance_init(Object *obj)object_initialize (&dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_9P );object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL );qdev_alias_all_properties (DEVICE (&dev->vdev), obj); +object_unref (OBJECT (&dev->vdev)); }static const TypeInfo virtio_9p_pci_info = {
Signature · 1 line
1.9.1
PATCH 41/88 pc: Fix disabling of vapic for compat PC models
In reply to Michael RothFrom: Jan Kiszka <[email protected]>
We used to be able to address both the QEMU and the KVM APIC via "apic". This doesn't work anymore. So we need to use their parent class to turn off the vapic on machines that should not expose them.
--- hw/i386/pc_piix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
@@ -646,7 +646,7 @@ static QEMUMachine pc_machine_v1_1 = { .property = "class",\ .value = stringify(PCI_CLASS_MEMORY_RAM),\ },{\ - .driver = "apic",\ + .driver = "apic-common",\ .property = "vapic",\ .value = "off",\ },{\
Signature · 1 line
1.9.1
PATCH 42/88 vmware-vga: CVE-2014-3689: turn off hw accel
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
Quick & easy stopgap for CVE-2014-3689: We just compile out the hardware acceleration functions which lack sanity checks. Thankfully we have capability bits for them (SVGA_CAP_RECT_COPY and SVGA_CAP_RECT_FILL), so guests should deal just fine, in theory.
Subsequent patches will add the missing checks and re-enable the hardware acceleration emulation.
--- hw/display/vmware_vga.c | 2 ++ 1 file changed, 2 insertions(+)
hw/display/vmware_vga.c +2 -0
@@ -29,8 +29,10 @@#include "hw/pci/pci.h" #undef VERBOSE +#if 0 #define HW_RECT_ACCEL #define HW_FILL_ACCEL +#endif #define HW_MOUSE_ACCEL #include "vga_int.h"
Signature · 1 line
1.9.1
PATCH 43/88 vmware-vga: add vmsvga_verify_rect
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
Add verification function for rectangles, returning true if verification passes and false otherwise.
--- hw/display/vmware_vga.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-)
hw/display/vmware_vga.c +52 -1
@@ -294,8 +294,59 @@ enum { SVGA_CURSOR_ON_RESTORE_TO_FB = 3, }; +static inline bool vmsvga_verify_rect (DisplaySurface *surface, +const char *name, +int x,int y,int w,int h) +{ +if (x <0 ) { +fprintf (stderr,"%s: x was < 0 (%d)\n" , name, x); +return false; + } +if (x >SVGA_MAX_WIDTH ) { +fprintf (stderr,"%s: x was > %d (%d)\n" , name,SVGA_MAX_WIDTH , x); +return false; + } +if (w <0 ) { +fprintf (stderr,"%s: w was < 0 (%d)\n" , name, w); +return false; + } +if (w >SVGA_MAX_WIDTH ) { +fprintf (stderr,"%s: w was > %d (%d)\n" , name,SVGA_MAX_WIDTH , w); +return false; + } +if (x + w >surface_width (surface)) { +fprintf (stderr,"%s: width was > %d (x: %d, w: %d)\n" , + name,surface_width (surface), x, w); +return false; + } + +if (y <0 ) { +fprintf (stderr,"%s: y was < 0 (%d)\n" , name, y); +return false; + } +if (y >SVGA_MAX_HEIGHT ) { +fprintf (stderr,"%s: y was > %d (%d)\n" , name,SVGA_MAX_HEIGHT , y); +return false; + } +if (h <0 ) { +fprintf (stderr,"%s: h was < 0 (%d)\n" , name, h); +return false; + } +if (h >SVGA_MAX_HEIGHT ) { +fprintf (stderr,"%s: h was > %d (%d)\n" , name,SVGA_MAX_HEIGHT , h); +return false; + } +if (y + h >surface_height (surface)) { +fprintf (stderr,"%s: update height > %d (y: %d, h: %d)\n" , + name,surface_height (surface), y, h); +return false; + } + +return true; +} +static inline void vmsvga_update_rect (struct vmsvga_state_s *s, -int x,int y,int w,int h) +int x,int y,int w,int h) {DisplaySurface *surface =qemu_console_surface (s->vga.con);int line;
Signature · 1 line
1.9.1
PATCH 44/88 vmware-vga: use vmsvga_verify_rect in vmsvga_update_rect
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
Switch vmsvga_update_rect over to use vmsvga_verify_rect. Slight change in behavior: We don't try to automatically fixup rectangles any more. In case we find invalid update requests we'll do a full-screen update instead.
--- hw/display/vmware_vga.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-)
hw/display/vmware_vga.c +4 -28
@@ -356,36 +356,12 @@ static inline void vmsvga_update_rect(struct vmsvga_state_s *s,uint8_t *src;uint8_t *dst; -if (x <0 ) { -fprintf (stderr,"%s: update x was < 0 (%d)\n" , __func__, x); - w += x; +if (!vmsvga_verify_rect (surface, __func__, x, y, w, h)) { +/* go for a fullscreen update as fallback */ x =0 ; - } -if (w <0 ) { -fprintf (stderr,"%s: update w was < 0 (%d)\n" , __func__, w); - w =0 ; - } -if (x + w >surface_width (surface)) { -fprintf (stderr,"%s: update width too large x: %d, w: %d\n" , - __func__, x, w); - x =MIN (x,surface_width (surface)); - w =surface_width (surface) - x; - } - -if (y <0 ) { -fprintf (stderr,"%s: update y was < 0 (%d)\n" , __func__, y); - h += y; y =0 ; - } -if (h <0 ) { -fprintf (stderr,"%s: update h was < 0 (%d)\n" , __func__, h); - h =0 ; - } -if (y + h >surface_height (surface)) { -fprintf (stderr,"%s: update height too large y: %d, h: %d\n" , - __func__, y, h); - y =MIN (y,surface_height (surface)); - h =surface_height (surface) - y; + w =surface_width (surface); + h =surface_height (surface); } bypl =surface_stride (surface);
Signature · 1 line
1.9.1
PATCH 45/88 vmware-vga: use vmsvga_verify_rect in vmsvga_copy_rect
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
Add verification to vmsvga_copy_rect, re-enable HW_RECT_ACCEL.
--- hw/display/vmware_vga.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
hw/display/vmware_vga.c +14 -6
@@ -29,8 +29,8 @@#include "hw/pci/pci.h" #undef VERBOSE -#if 0 #define HW_RECT_ACCEL +#if 0 #define HW_FILL_ACCEL #endif #define HW_MOUSE_ACCEL
@@ -406,7 +406,7 @@ static inline void vmsvga_update_rect_flush(struct vmsvga_state_s *s) }#ifdef HW_RECT_ACCEL -static inline void vmsvga_copy_rect (struct vmsvga_state_s *s, +static inline int vmsvga_copy_rect (struct vmsvga_state_s *s,int x0,int y0,int x1,int y1,int w,int h) {DisplaySurface *surface =qemu_console_surface (s->vga.con);
@@ -417,6 +417,13 @@ static inline void vmsvga_copy_rect(struct vmsvga_state_s *s,int line = h;uint8_t *ptr[2 ]; +if (!vmsvga_verify_rect (surface,"vmsvga_copy_rect/src" , x0, y0, w, h)) { +return -1 ; + } +if (!vmsvga_verify_rect (surface,"vmsvga_copy_rect/dst" , x1, y1, w, h)) { +return -1 ; + } +if (y1 > y0) { ptr[0 ] = vram + bypp * x0 + bypl * (y0 + h -1 ); ptr[1 ] = vram + bypp * x1 + bypl * (y1 + h -1 );
@@ -432,6 +439,7 @@ static inline void vmsvga_copy_rect(struct vmsvga_state_s *s, }vmsvga_update_rect_delayed (s, x1, y1, w, h); +return 0 ; }#endif
@@ -625,12 +633,12 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) width =vmsvga_fifo_read (s); height =vmsvga_fifo_read (s);#ifdef HW_RECT_ACCEL -vmsvga_copy_rect (s, x, y, dx, dy, width, height); -break ; -#else +if (vmsvga_copy_rect (s, x, y, dx, dy, width, height) ==0 ) { +break ; + } +#endif args =0 ; goto badcmd; -#endif case SVGA_CMD_DEFINE_CURSOR : len -=8 ;
Signature · 1 line
1.9.1
PATCH 46/88 vmware-vga: use vmsvga_verify_rect in vmsvga_fill_rect
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
Add verification to vmsvga_fill_rect, re-enable HW_FILL_ACCEL.
--- hw/display/vmware_vga.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
hw/display/vmware_vga.c +10 -7
@@ -30,9 +30,7 @@#undef VERBOSE#define HW_RECT_ACCEL -#if 0 #define HW_FILL_ACCEL -#endif #define HW_MOUSE_ACCEL #include "vga_int.h"
@@ -444,7 +442,7 @@ static inline int vmsvga_copy_rect(struct vmsvga_state_s *s,#endif #ifdef HW_FILL_ACCEL -static inline void vmsvga_fill_rect (struct vmsvga_state_s *s, +static inline int vmsvga_fill_rect (struct vmsvga_state_s *s,uint32_t c,int x,int y,int w,int h) {DisplaySurface *surface =qemu_console_surface (s->vga.con);
@@ -457,6 +455,10 @@ static inline void vmsvga_fill_rect(struct vmsvga_state_s *s,uint8_t *src;uint8_t col[4 ]; +if (!vmsvga_verify_rect (surface, __func__, x, y, w, h)) { +return -1 ; + } + col[0 ] = c; col[1 ] = c >>8 ; col[2 ] = c >>16 ;
@@ -481,6 +483,7 @@ static inline void vmsvga_fill_rect(struct vmsvga_state_s *s, }vmsvga_update_rect_delayed (s, x, y, w, h); +return 0 ; }#endif
@@ -613,12 +616,12 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) width =vmsvga_fifo_read (s); height =vmsvga_fifo_read (s);#ifdef HW_FILL_ACCEL -vmsvga_fill_rect (s, colour, x, y, width, height); -break ; -#else +if (vmsvga_fill_rect (s, colour, x, y, width, height) ==0 ) { +break ; + } +#endif args =0 ; goto badcmd; -#endif case SVGA_CMD_RECT_COPY : len -=7 ;
Signature · 1 line
1.9.1
PATCH 47/88 qcow2: Do not overflow when writing an L1 sector
In reply to Michael RothFrom: Max Reitz <[email protected]>
While writing an L1 table sector, qcow2_write_l1_entry() copies the respective range from s->l1_table to the local "buf" array. The size of s->l1_table does not have to be a multiple of L1_ENTRIES_PER_SECTOR; thus, limit the index which is used for copying all entries to the L1 size.
--- block/qcow2-cluster.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
block/qcow2-cluster.c +4 -2
@@ -158,12 +158,14 @@ static int l2_load(BlockDriverState *bs, uint64_t l2_offset,int qcow2_write_l1_entry (BlockDriverState *bs,int l1_index) {BDRVQcowState *s = bs->opaque; -uint64_t buf[L1_ENTRIES_PER_SECTOR ]; +uint64_t buf[L1_ENTRIES_PER_SECTOR ] = {0 };int l1_start_index;int i, ret; l1_start_index = l1_index & ~(L1_ENTRIES_PER_SECTOR -1 ); -for (i =0 ; i <L1_ENTRIES_PER_SECTOR ; i++) { +for (i =0 ; i <L1_ENTRIES_PER_SECTOR && l1_start_index + i < s->l1_size; + i++) + { buf[i] =cpu_to_be64 (s->l1_table[l1_start_index + i]); }
Signature · 1 line
1.9.1
PATCH 48/88 libcacard: don't free sign buffer while sign op is pending
In reply to Michael RothFrom: Ray Strode <[email protected]>
commit 57f97834efe0c208ffadc9d2959f3d3d55580e52 cleaned up the cac_applet_pki_process_apdu function to have a single exit point. Unfortunately, that commit introduced a bug where the sign buffer can get free'd and nullified while it's still being used.
This commit corrects the bug by introducing a boolean to track whether or not the sign buffer should be freed in the function exit path.
--- libcacard/cac.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
libcacard/cac.c +7 -3
@@ -115,6 +115,7 @@ cac_applet_pki_process_apdu(VCard *card, VCardAPDU *apdu,VCardAppletPrivate *applet_private;int size, next;unsigned char *sign_buffer; +bool retain_sign_buffer = FALSE;vcard_7816_status_t status;VCardStatus ret =VCARD_FAIL ;
@@ -178,6 +179,7 @@ cac_applet_pki_process_apdu(VCard *card, VCardAPDU *apdu, pki_applet->sign_buffer = sign_buffer; pki_applet->sign_buffer_len = size; *response =vcard_make_response (VCARD7816_STATUS_SUCCESS ); + retain_sign_buffer = TRUE;break ;case 0x00 :/* we now have the whole buffer, do the operation, result will be
@@ -200,9 +202,11 @@ cac_applet_pki_process_apdu(VCard *card, VCardAPDU *apdu, VCARD7816_STATUS_ERROR_P1_P2_INCORRECT);break ; } -g_free (sign_buffer); - pki_applet->sign_buffer =NULL ; - pki_applet->sign_buffer_len =0 ; +if (!retain_sign_buffer) { +g_free (sign_buffer); + pki_applet->sign_buffer =NULL ; + pki_applet->sign_buffer_len =0 ; + } ret =VCARD_DONE ;break ;case CAC_READ_BUFFER :
Signature · 1 line
1.9.1
PATCH 49/88 Make qemu_shutdown_requested signal-safe
In reply to Michael RothFrom: Jan Kiszka <[email protected]>
qemu_shutdown_requested may be interrupted by qemu_system_killed. If the latter sets shutdown_requested after qemu_shutdown_requested has read it but before it was cleared, the shutdown event is lost. Fix this by using atomic_xchg.
This provides a different fix for the problem which commit 15124e142 attempts to deal with. That commit breaks use of ^C to drop into gdb, and so this approach is better (and 15124e142 can be reverted).
--- vl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
vl.c +1 -3
@@ -1745,9 +1745,7 @@ int qemu_reset_requested_get(void)static int qemu_shutdown_requested (void ) { -int r = shutdown_requested; - shutdown_requested =0 ; -return r; +return atomic_xchg (&shutdown_requested,0 ); }static void qemu_kill_report (void )
Signature · 1 line
1.9.1
PATCH 50/88 vnc: sanitize bits_per_pixel from the client
In reply to Michael RothFrom: Petr Matousek <[email protected]>
bits_per_pixel that are less than 8 could result in accessing non-initialized buffers later in the code due to the expectation that bytes_per_pixel value that is used to initialize these buffers is never zero.
To fix this check that bits_per_pixel from the client is one of the values that the rfb protocol specification allows.
This is CVE-2014-7815.
[ kraxel: apply codestyle fix ]
--- ui/vnc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
ui/vnc.c +10 -0
@@ -2026,6 +2026,16 @@ static void set_pixel_format(VncState *vs,return ; } +switch (bits_per_pixel) { +case 8 : +case 16 : +case 32 : +break ; +default : +vnc_client_error (vs); +return ; + } + vs->client_pf.rmax = red_max; vs->client_pf.rbits =hweight_long (red_max); vs->client_pf.rshift = red_shift;
Signature · 1 line
1.9.1
PATCH 51/88 virtio-scsi: sense in virtio_scsi_command_complete
In reply to Michael RothFrom: Ting Wang <[email protected]>
If req->resp.cmd.status is not GOOD, the address of sense for qemu_iovec_from_buf should be modified from &req->resp to sense.
--- hw/scsi/virtio-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/virtio-scsi.c +1 -1
@@ -400,7 +400,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status, sense_len =scsi_req_get_sense (r, sense,sizeof (sense)); sense_len =MIN (sense_len, req->resp_iov.size -sizeof (req->resp.cmd));qemu_iovec_from_buf (&req->resp_iov,sizeof (req->resp.cmd), - &req->resp, sense_len); + sense, sense_len); req->resp.cmd.sense_len =virtio_tswap32 (vdev, sense_len); }virtio_scsi_complete_cmd_req (req);
Signature · 1 line
1.9.1
PATCH 52/88 tcg/mips: fix store softmmu slow path
In reply to Michael RothFrom: Aurelien Jarno <[email protected]>
Commit 9d8bf2d1 moved the softmmu slow path out of line and introduce a regression at the same time by always calling tcg_out_tlb_load with is_load=1. This makes impossible to run any significant code under qemu-system-mips*.
--- tcg/mips/tcg-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/mips/tcg-target.c +1 -1
@@ -1302,7 +1302,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64)so we can reuse that for the base. */ base = (TARGET_LONG_BITS ==32 ?TCG_REG_A1 :TCG_REG_A2 );tcg_out_tlb_load (s, base, addr_regl, addr_regh, mem_index, - s_bits, label_ptr,1 ); + s_bits, label_ptr,0 );tcg_out_qemu_st_direct (s, data_regl, data_regh, base, opc);add_qemu_ldst_label (s,0 , opc, data_regl, data_regh, addr_regl, addr_regh, mem_index, s->code_ptr, label_ptr);
Signature · 1 line
1.9.1
PATCH 53/88 hw/core/loader: implement address translation in uimage loader
In reply to Michael RothFrom: Max Filippov <[email protected]>
Such address translation is needed when load address recorded in uImage is a virtual address. When the actual load address is requested, return untranslated address: user that needs the translated address can always apply translation function to it and those that need it untranslated don't need to do the inverse translation.
Add translation function pointer and its parameter to uimage_load prototype. Update all existing users.
No user-visible functional changes.
--- hw/arm/boot.c | 2 +- hw/core/loader.c | 17 +++++++++++++---- hw/m68k/an5206.c | 3 ++- hw/m68k/dummy_m68k.c | 3 ++- hw/m68k/mcf5208.c | 3 ++- hw/microblaze/boot.c | 3 ++- hw/openrisc/openrisc_sim.c | 2 +- hw/ppc/e500.c | 3 ++- hw/ppc/ppc440_bamboo.c | 3 ++- hw/xtensa/xtfpga.c | 3 ++- include/hw/loader.h | 4 +++- 11 files changed, 32 insertions(+), 14 deletions(-)
hw/arm/boot.c +1 -1
@@ -508,7 +508,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) entry = elf_entry;if (kernel_size <0 ) { kernel_size =load_uimage (info->kernel_filename, &entry,NULL , - &is_linux); + &is_linux,NULL ,NULL ); }if (kernel_size <0 ) { entry = info->loader_start + kernel_load_offset;
hw/core/loader.c +13 -4
@@ -456,7 +456,9 @@ static ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src,/* Load a U-Boot image. */ static int load_uboot_image (const char *filename,hwaddr *ep,hwaddr *loadaddr, -int *is_linux,uint8_t image_type) +int *is_linux,uint8_t image_type, +uint64_t (*translate_fn)(void *,uint64_t ), +void *translate_opaque) {int fd;int size;
@@ -490,6 +492,9 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr,switch (hdr->ih_type) {case IH_TYPE_KERNEL : address = hdr->ih_load; +if (translate_fn) { + address =translate_fn (translate_opaque, address); + }if (loadaddr) { *loadaddr = hdr->ih_load; }
@@ -566,15 +571,19 @@ out: }int load_uimage (const char *filename,hwaddr *ep,hwaddr *loadaddr, -int *is_linux) +int *is_linux, +uint64_t (*translate_fn)(void *,uint64_t ), +void *translate_opaque) { -return load_uboot_image (filename, ep, loadaddr, is_linux,IH_TYPE_KERNEL ); +return load_uboot_image (filename, ep, loadaddr, is_linux,IH_TYPE_KERNEL , + translate_fn, translate_opaque); }/* Load a ramdisk. */ int load_ramdisk (const char *filename,hwaddr addr,uint64_t max_sz) { -return load_uboot_image (filename,NULL , &addr,NULL ,IH_TYPE_RAMDISK ); +return load_uboot_image (filename,NULL , &addr,NULL ,IH_TYPE_RAMDISK , +NULL ,NULL ); }/*
hw/m68k/an5206.c +2 -1
@@ -74,7 +74,8 @@ static void an5206_init(MachineState *machine) NULL, NULL, 1, ELF_MACHINE, 0); entry = elf_entry;if (kernel_size <0 ) { - kernel_size =load_uimage (kernel_filename, &entry,NULL ,NULL ); + kernel_size =load_uimage (kernel_filename, &entry,NULL ,NULL , +NULL ,NULL ); }if (kernel_size <0 ) { kernel_size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR,
hw/m68k/dummy_m68k.c +2 -1
@@ -50,7 +50,8 @@ static void dummy_m68k_init(MachineState *machine) NULL, NULL, 1, ELF_MACHINE, 0); entry = elf_entry;if (kernel_size <0 ) { - kernel_size =load_uimage (kernel_filename, &entry,NULL ,NULL ); + kernel_size =load_uimage (kernel_filename, &entry,NULL ,NULL , +NULL ,NULL ); }if (kernel_size <0 ) { kernel_size = load_image_targphys(kernel_filename,
hw/m68k/mcf5208.c +2 -1
@@ -279,7 +279,8 @@ static void mcf5208evb_init(MachineState *machine) NULL, NULL, 1, ELF_MACHINE, 0); entry = elf_entry;if (kernel_size <0 ) { - kernel_size =load_uimage (kernel_filename, &entry,NULL ,NULL ); + kernel_size =load_uimage (kernel_filename, &entry,NULL ,NULL , +NULL ,NULL ); }if (kernel_size <0 ) { kernel_size = load_image_targphys(kernel_filename, 0x40000000,
hw/microblaze/boot.c +2 -1
@@ -154,7 +154,8 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base,if (kernel_size <0 ) {hwaddr uentry, loadaddr; - kernel_size =load_uimage (kernel_filename, &uentry, &loadaddr,0 ); + kernel_size =load_uimage (kernel_filename, &uentry, &loadaddr,0 , +NULL ,NULL ); boot_info.bootstrap_pc = uentry; high = (loadaddr + kernel_size +3 ) & ~3 ; }
hw/openrisc/openrisc_sim.c +1 -1
@@ -72,7 +72,7 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size, entry = elf_entry;if (kernel_size <0 ) { kernel_size =load_uimage (kernel_filename, - &entry,NULL ,NULL ); + &entry,NULL ,NULL ,NULL ,NULL ); }if (kernel_size <0 ) { kernel_size = load_image_targphys(kernel_filename,
hw/ppc/e500.c +2 -1
@@ -830,7 +830,8 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)* Hrm. No ELF image? Try a uImage, maybe someone is giving us an * ePAPR compliant kernel */ - kernel_size =load_uimage (filename, &bios_entry, &loadaddr,NULL ); + kernel_size =load_uimage (filename, &bios_entry, &loadaddr,NULL , +NULL ,NULL );if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load firmware '%s'\n" , filename);exit (1 );
hw/ppc/ppc440_bamboo.c +2 -1
@@ -253,7 +253,8 @@ static void bamboo_init(MachineState *machine)/* Load kernel. */ if (kernel_filename) { - success =load_uimage (kernel_filename, &entry, &loadaddr,NULL ); + success =load_uimage (kernel_filename, &entry, &loadaddr,NULL , +NULL ,NULL );if (success <0 ) { success =load_elf (kernel_filename,NULL ,NULL , &elf_entry, &elf_lowaddr,NULL ,1 ,ELF_MACHINE ,0 );
hw/xtensa/xtfpga.c +2 -1
@@ -325,7 +325,8 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine) }else {hwaddr ep;int is_linux; - success =load_uimage (kernel_filename, &ep,NULL , &is_linux); + success =load_uimage (kernel_filename, &ep,NULL , &is_linux, +NULL ,NULL );if (success >0 && is_linux) { entry_point = ep; }else {
include/hw/loader.h +3 -1
@@ -28,7 +28,9 @@ int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t),int load_aout (const char *filename,hwaddr addr,int max_sz,int bswap_needed,hwaddr target_page_size);int load_uimage (const char *filename,hwaddr *ep, -hwaddr *loadaddr,int *is_linux); +hwaddr *loadaddr,int *is_linux, +uint64_t (*translate_fn)(void *,uint64_t ), +void *translate_opaque);/** * load_ramdisk:
Signature · 1 line
1.9.1
PATCH 54/88 hw/xtensa/xtfpga: treat uImage load address as virtual
In reply to Michael RothFrom: Max Filippov <[email protected]>
U-boot for xtensa always treats uImage load address as virtual address. This is important when booting uImage on xtensa core with MMUv2, because MMUv2 has fixed non-identity virtual-to-physical mapping after reset.
Always do virtual-to-physical translation of uImage load address and load uImage at the translated address. This fixes booting uImage kernels on dc232b and other MMUv2 cores.
--- hw/xtensa/xtfpga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xtensa/xtfpga.c +1 -1
@@ -326,7 +326,7 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)hwaddr ep;int is_linux; success =load_uimage (kernel_filename, &ep,NULL , &is_linux, -NULL ,NULL ); + translate_phys_addr, cpu);if (success >0 && is_linux) { entry_point = ep; }else {
Signature · 1 line
1.9.1
PATCH 55/88 snapshot: add bdrv_drain_all() to bdrv_snapshot_delete() to avoid concurrency problem
In reply to Michael RothFrom: Zhang Haoyu <[email protected]>
If there are still pending i/o while deleting snapshot,
because deleting snapshot is done in non-coroutine context, and the pending i/o read/write (bdrv_co_do_rw) is done in coroutine context, so it's possible to cause concurrency problem between above two operations. Add bdrv_drain_all() to bdrv_snapshot_delete() to avoid this problem.
Message-id: [email protected]
--- block/snapshot.c | 4 ++++ 1 file changed, 4 insertions(+)
block/snapshot.c +4 -0
@@ -236,6 +236,10 @@ int bdrv_snapshot_delete(BlockDriverState *bs,error_setg (errp,"snapshot_id and name are both NULL" );return -EINVAL ; } + +/* drain all pending i/o before deleting snapshot */ +bdrv_drain_all (); +if (drv->bdrv_snapshot_delete) {return drv->bdrv_snapshot_delete (bs, snapshot_id, name, errp); }
Signature · 1 line
1.9.1
PATCH 56/88 hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)
In reply to Michael RothFrom: Peter Maydell <[email protected]>
The g_hash_table_iter_* functions for iterating through a hash table are not present in glib 2.12, which is our current minimum requirement. Rewrite the code to use g_hash_table_foreach() instead.
--- hw/ppc/spapr_pci.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
hw/ppc/spapr_pci.c +17 -11
@@ -700,28 +700,34 @@ static const VMStateDescription vmstate_spapr_pci_msi = { }, }; +static void spapr_pci_fill_msi_devs (gpointer key,gpointer value, +gpointer opaque) +{ +sPAPRPHBState *sphb = opaque; + + sphb->msi_devs[sphb->msi_devs_num].key = *(uint32_t *)key; + sphb->msi_devs[sphb->msi_devs_num].value = *(spapr_pci_msi *)value; + sphb->msi_devs_num++; +} +static void spapr_pci_pre_save (void *opaque) {sPAPRPHBState *sphb = opaque; -GHashTableIter iter; -gpointer key, value; -int i; +int msi_devs_num;if (sphb->msi_devs) {g_free (sphb->msi_devs); sphb->msi_devs =NULL ; } - sphb->msi_devs_num =g_hash_table_size (sphb->msi); -if (!sphb->msi_devs_num) { + sphb->msi_devs_num =0 ; + msi_devs_num =g_hash_table_size (sphb->msi); +if (!msi_devs_num) {return ; } - sphb->msi_devs =g_malloc (sphb->msi_devs_num *sizeof (spapr_pci_msi_mig)); + sphb->msi_devs =g_malloc (msi_devs_num *sizeof (spapr_pci_msi_mig)); -g_hash_table_iter_init (&iter, sphb->msi); -for (i =0 ;g_hash_table_iter_next (&iter, &key, &value); ++i) { - sphb->msi_devs[i].key = *(uint32_t *) key; - sphb->msi_devs[i].value = *(spapr_pci_msi *) value; - } +g_hash_table_foreach (sphb->msi, spapr_pci_fill_msi_devs, sphb); +assert (sphb->msi_devs_num == msi_devs_num); }static int spapr_pci_post_load (void *opaque,int version_id)
Signature · 1 line
1.9.1
PATCH 57/88 esp-pci: fixup deadlock with linux
In reply to Michael RothFrom: Hannes Reinecke <[email protected]>
A linux guest will be issuing messages:
[ 32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!! [ 32.126348] DC390: DataIn_0: DMA State: 0
and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.
--- hw/scsi/esp-pci.c | 2 ++ 1 file changed, 2 insertions(+)
hw/scsi/esp-pci.c +2 -0
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,/* update status registers */ pci->dma_regs[DMA_WBC ] -= len; pci->dma_regs[DMA_WAC ] += len; +if (pci->dma_regs[DMA_WBC ] ==0 ) + pci->dma_regs[DMA_STAT ] |=DMA_STAT_DONE ; }static void esp_pci_dma_memory_read (void *opaque,uint8_t *buf,int len)
Signature · 1 line
1.9.1
PATCH 58/88 target-xtensa: add missing window check for entry
In reply to Michael RothFrom: Max Filippov <[email protected]>
Entry opcode needs to check if moving to new register frame would cause register window overflow. Entry used in function prologue never overflows because preceding windowed call* opcode writes return address to the target register window frame, causing overflow exceptions at the point of call. But when a sequence of entry opcodes is used for register window spilling there may not be a call or other opcode that would cause window check between entries and they would not raise overflow exception themselves resulting in data corruption.
--- target-xtensa/cpu.h | 6 ++++++ target-xtensa/op_helper.c | 6 ++++++ 2 files changed, 12 insertions(+)
target-xtensa/cpu.h +6 -0
@@ -471,6 +471,12 @@ static inline xtensa_tlb_entry *xtensa_tlb_get_entry(CPUXtensaState *env, env->itlb[wi] + ei; } +static inline uint32_t xtensa_replicate_windowstart (CPUXtensaState *env) +{ +return env->sregs[WINDOW_START ] | + (env->sregs[WINDOW_START ] << env->config->nareg /4 ); +} +/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _ring0#define MMU_MODE1_SUFFIX _ring1
target-xtensa/op_helper.c +6 -0
@@ -235,6 +235,12 @@ void HELPER(entry)(CPUXtensaState *env, uint32_t pc, uint32_t s, uint32_t imm) pc, env->sregs[PS]);HELPER (exception_cause)(env, pc,ILLEGAL_INSTRUCTION_CAUSE ); }else { +uint32_t windowstart =xtensa_replicate_windowstart (env) >> + (env->sregs[WINDOW_BASE ] +1 ); + +if (windowstart & ((1 << callinc) -1 )) { +HELPER (window_check)(env, pc, callinc); + } env->regs[(callinc <<2 ) | (s &3 )] = env->regs[s] - (imm <<3 );rotate_window (env, callinc); env->sregs[WINDOW_START] |=
Signature · 1 line
1.9.1
PATCH 59/88 kvm: Fix memory slot page alignment logic
In reply to Michael RothFrom: Alexander Graf <[email protected]>
Memory slots have to be page aligned to get entered into KVM. There is existing logic that tries to ensure that we pad memory slots that are not page aligned to the biggest region that would still fit in the alignment requirements.
Unfortunately, that logic is broken. It tries to calculate the start offset based on the region size.
Fix up the logic to do the thing it was intended to do and document it properly in the comment above it.
With this patch applied, I can successfully run an e500 guest with more than 3GB RAM (at which point RAM starts overlapping subpage memory regions).
--- kvm-all.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kvm-all.c +4 -2
@@ -617,8 +617,10 @@ static void kvm_set_phys_mem(MemoryRegionSection *section, bool add)unsigned delta;/* kvm works in page size chunks, but the function may be called -with sub-page size and unaligned start address. */ - delta =TARGET_PAGE_ALIGN (size) - size; +with sub-page size and unaligned start address. Pad the start +address to next and truncate size to previous page boundary. */ + delta = (TARGET_PAGE_SIZE - (start_addr & ~TARGET_PAGE_MASK )); + delta &= ~TARGET_PAGE_MASK ;if (delta > size) {return ; }
Signature · 1 line
1.9.1
PATCH 60/88 virtio-scsi: work around bug in old BIOSes
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
Old BIOSes left some padding by mistake after the req_size/resp_size. New QEMU does not like it, thinking it is a bidirectional command.
As a workaround, we can check if the ANY_LAYOUT bit is set; if not, we always consider the first buffer as the virtio-scsi request/response, because, back when QEMU did not support ANY_LAYOUT, it expected the payload to start at the second element of the iovec.
This can show up during migration.
--- hw/scsi/virtio-scsi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
hw/scsi/virtio-scsi.c +17 -0
@@ -135,6 +135,7 @@ static size_t qemu_sgl_concat(VirtIOSCSIReq *req, struct iovec *iov,static int virtio_scsi_parse_req (VirtIOSCSIReq *req,unsigned req_size,unsigned resp_size) { +VirtIODevice *vdev = (VirtIODevice *) req->dev;size_t in_size, out_size; if (iov_to_buf(req->elem.out_sg, req->elem.out_num, 0,
@@ -147,8 +148,24 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req, resp_size) < resp_size) {return -EINVAL ; } + req->resp_size = resp_size; +/* Old BIOSes left some padding by mistake after the req_size/resp_size. +* As a workaround, always consider the first buffer as the virtio-scsi +* request/response, making the payload start at the second element +* of the iovec. +* +* The actual length of the response header, stored in req->resp_size, +* does not change. +* +* TODO: always disable this workaround for virtio 1.0 devices. +*/ +if ((vdev->guest_features &VIRTIO_F_ANY_LAYOUT ) ==0 ) { + req_size = req->elem.out_sg[0 ].iov_len; + resp_size = req->elem.in_sg[0 ].iov_len; + } + out_size =qemu_sgl_concat (req, req->elem.out_sg, &req->elem.out_addr[0 ], req->elem.out_num, req_size);
Signature · 1 line
1.9.1
PATCH 61/88 libcacard: fix resource leak
In reply to Michael RothFrom: zhanghailiang <[email protected]>
In function connect_to_qemu(), getaddrinfo() will allocate memory that is stored into server, it should be freed by using freeaddrinfo() before connect_to_qemu() return.
--- libcacard/vscclient.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
libcacard/vscclient.c +6 -1
@@ -597,7 +597,7 @@ connect_to_qemu(const char *port ) {struct addrinfo hints; -struct addrinfo *server; +struct addrinfo *server =NULL ;int ret, sock; sock =socket (AF_INET ,SOCK_STREAM ,0 );
@@ -629,9 +629,14 @@ connect_to_qemu(if (verbose) {printf ("Connected (sizeof Header=%zd)!\n" ,sizeof (VSCMsgHeader)); } + +freeaddrinfo (server);return sock; cleanup_socket: +if (server) { +freeaddrinfo (server); + }closesocket (sock);return -1 ; }
Signature · 1 line
1.9.1
PATCH 62/88 l2tpv3: fix possible double free
In reply to Michael RothFrom: zhanghailiang <[email protected]>
freeaddrinfo(result) does not assign result = NULL, after frees it. There will be a double free when it goes error case.
It is reported by covertiy.
--- net/l2tpv3.c | 1 - 1 file changed, 1 deletion(-)
net/l2tpv3.c +0 -1
@@ -660,7 +660,6 @@ int net_init_l2tpv3(const NetClientOptions *opts,if (fd ==-1 ) { fd = -errno;error_report ("l2tpv3_open : socket creation failed, errno = %d" , -fd); -freeaddrinfo (result); goto outerr; }if (bind (fd, (struct sockaddr *) result->ai_addr, result->ai_addrlen)) {
Signature · 1 line
1.9.1
PATCH 63/88 exec: Handle multipage ranges in invalidate_and_set_dirty()
In reply to Michael RothFrom: Peter Maydell <[email protected]>
The code in invalidate_and_set_dirty() needs to handle addr/length combinations which cross guest physical page boundaries. This can happen, for example, when disk I/O reads large blocks into guest RAM which previously held code that we have cached translations for. Unfortunately we were only checking the clean/dirty status of the first page in the range, and then were calling a tb_invalidate function which only handles ranges that don't cross page boundaries. Fix the function to deal with multipage ranges.
The symptoms of this bug were that guest code would misbehave (eg segfault), in particular after a guest reboot but potentially any time the guest reused a page of its physical RAM for new code.
Message-id: [email protected]
--- exec.c | 6 ++---- include/exec/ram_addr.h | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-)
exec.c +2 -4
@@ -2009,10 +2009,8 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,static void invalidate_and_set_dirty (hwaddr addr,hwaddr length) { -if (cpu_physical_memory_is_clean (addr)) { -/* invalidate code */ -tb_invalidate_phys_page_range (addr, addr + length,0 ); -/* set dirty bit */ +if (cpu_physical_memory_range_includes_clean (addr, length)) { +tb_invalidate_phys_range (addr, addr + length,0 );cpu_physical_memory_set_dirty_range_nocode (addr, length); }xen_modified_memory (addr, length);
include/exec/ram_addr.h +25 -0
@@ -49,6 +49,21 @@ static inline bool cpu_physical_memory_get_dirty(ram_addr_t start,return next < end; } +static inline bool cpu_physical_memory_get_clean (ram_addr_t start, +ram_addr_t length, +unsigned client) +{ +unsigned long end, page, next; + +assert (client <DIRTY_MEMORY_NUM ); + + end =TARGET_PAGE_ALIGN (start + length) >>TARGET_PAGE_BITS ; + page = start >>TARGET_PAGE_BITS ; + next =find_next_zero_bit (ram_list.dirty_memory[client], end, page); + +return next < end; +} +static inline bool cpu_physical_memory_get_dirty_flag (ram_addr_t addr,unsigned client) {
@@ -64,6 +79,16 @@ static inline bool cpu_physical_memory_is_clean(ram_addr_t addr)return !(vga && code && migration); } +static inline bool cpu_physical_memory_range_includes_clean (ram_addr_t start, +ram_addr_t length) +{ +bool vga =cpu_physical_memory_get_clean (start, length,DIRTY_MEMORY_VGA ); +bool code =cpu_physical_memory_get_clean (start, length,DIRTY_MEMORY_CODE ); +bool migration = +cpu_physical_memory_get_clean (start, length,DIRTY_MEMORY_MIGRATION ); +return vga || code || migration; +} +static inline void cpu_physical_memory_set_dirty_flag (ram_addr_t addr,unsigned client) {
Signature · 1 line
1.9.1
PATCH 64/88 hw/ide/core.c: Prevent SIGSEGV during migration
In reply to Michael RothFrom: Don Slutz <[email protected]>
The other callers to blk_set_enable_write_cache() in this file already check for s->blk == NULL.
Message-id: [email protected]
Conflicts:
hw/ide/core.c
*removed dependency on 4be746345
--- hw/ide/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ide/core.c +1 -1
@@ -2299,7 +2299,7 @@ static int ide_drive_post_load(void *opaque, int version_id) {IDEState *s = opaque; -if (s->identify_set) { +if (s->bs && s->identify_set) {bdrv_set_enable_write_cache (s->bs, !!(s->identify_data[85 ] & (1 <<5 ))); }return 0 ;
Signature · 1 line
1.9.1
PATCH 65/88 virtio-net: fix unmap leak
In reply to Michael RothFrom: Jason Wang <[email protected]>
virtio_net_handle_ctrl() and other functions that process control vq request call iov_discard_front() which will shorten the iov. This will lead unmapping in virtqueue_push() leaks mapping.
Fixes this by keeping the original iov untouched and using a temp variable in those functions.
Message-id: [email protected]
--- hw/net/virtio-net.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/net/virtio-net.c +3 -2
@@ -798,7 +798,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)virtio_net_ctrl_ack status =VIRTIO_NET_ERR ;VirtQueueElement elem;size_t s; -struct iovec *iov; +struct iovec *iov, *iov2;unsigned int iov_cnt;while (virtqueue_pop (vq, &elem)) {
@@ -808,8 +808,8 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)exit (1 ); } - iov = elem.out_sg; iov_cnt = elem.out_num; + iov2 = iov =g_memdup (elem.out_sg,sizeof (struct iovec ) * elem.out_num); s =iov_to_buf (iov, iov_cnt,0 , &ctrl,sizeof (ctrl));iov_discard_front (&iov, &iov_cnt,sizeof (ctrl));if (s !=sizeof (ctrl)) {
@@ -833,6 +833,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)virtqueue_push (vq, &elem,sizeof (status));virtio_notify (vdev, vq); +g_free (iov2); } }
Signature · 1 line
1.9.1
PATCH 66/88 block: Make essential BlockDriver objects public
In reply to Michael RothFrom: Max Reitz <[email protected]>
There are some block drivers which are essential to QEMU and may not be
removed: These are raw, file and qcow2 (as the default non-raw format). Make their BlockDriver objects public so they can be directly referenced throughout the block layer without needing to call bdrv_find_format() and having to deal with an error at runtime, while the real problem occurred during linking (where raw, file or qcow2 were not linked into qemu).
--- block/qcow2.c | 2 +- block/raw-posix.c | 2 +- block/raw-win32.c | 2 +- block/raw_bsd.c | 2 +- include/block/block_int.h | 8 ++++++++ 5 files changed, 12 insertions(+), 4 deletions(-)
block/qcow2.c +1 -1
@@ -2404,7 +2404,7 @@ static QemuOptsList qcow2_create_opts = { } }; -static BlockDriver bdrv_qcow2 = { +BlockDriver bdrv_qcow2 = { .format_name ="qcow2" , .instance_size =sizeof (BDRVQcowState), .bdrv_probe = qcow2_probe,
block/raw-posix.c +1 -1
@@ -1585,7 +1585,7 @@ static QemuOptsList raw_create_opts = { } }; -static BlockDriver bdrv_file = { +BlockDriver bdrv_file = { .format_name ="file" , .protocol_name ="file" , .instance_size =sizeof (BDRVRawState),
block/raw-win32.c +1 -1
@@ -540,7 +540,7 @@ static QemuOptsList raw_create_opts = { } }; -static BlockDriver bdrv_file = { +BlockDriver bdrv_file = { .format_name ="file" , .protocol_name ="file" , .instance_size =sizeof (BDRVRawState),
block/raw_bsd.c +1 -1
@@ -173,7 +173,7 @@ static int raw_probe(const uint8_t *buf, int buf_size, const char *filename)return 1 ; } -static BlockDriver bdrv_raw = { +BlockDriver bdrv_raw = { .format_name ="raw" , .bdrv_probe = &raw_probe, .bdrv_reopen_prepare = &raw_reopen_prepare,
include/block/block_int.h +8 -0
@@ -395,6 +395,14 @@ struct BlockDriverState {Error *backing_blocker; }; + +/* Essential block drivers which must always be statically linked into qemu, and +* which therefore can be accessed without using bdrv_find_format() */ +extern BlockDriver bdrv_file; +extern BlockDriver bdrv_raw; +extern BlockDriver bdrv_qcow2; + +int get_tmp_filename (char *filename,int size); void bdrv_set_io_limits(BlockDriverState *bs,
Signature · 1 line
1.9.1
PATCH 67/88 block: Omit bdrv_find_format for essential drivers
In reply to Michael RothFrom: Max Reitz <[email protected]>
We can always assume raw, file and qcow2 being available; so do not use bdrv_find_format() to locate their BlockDriver objects but statically reference the respective objects.
--- block.c | 17 +++++------------ block/qcow2.c | 7 +++---- 2 files changed, 8 insertions(+), 16 deletions(-)
block.c +5 -12
@@ -633,7 +633,7 @@ BlockDriver *bdrv_find_protocol(const char *filename, }if (!path_has_protocol (filename) || !allow_protocol_prefix) { -return bdrv_find_format ("file" ); +return &bdrv_file; } p =strchr (filename,':' );
@@ -662,12 +662,7 @@ static int find_image_format(BlockDriverState *bs, const char *filename,/* Return the raw BlockDriver * to scsi-generic devices or empty drives */ if (bs->sg || !bdrv_is_inserted (bs) ||bdrv_getlength (bs) ==0 ) { - drv =bdrv_find_format ("raw" ); -if (!drv) { -error_setg (errp,"Could not find raw image format" ); - ret = -ENOENT ; - } - *pdrv = drv; + *pdrv = &bdrv_raw;return ret; }
@@ -1296,7 +1291,6 @@ int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp)/* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ char *tmp_filename =g_malloc0 (PATH_MAX +1 );int64_t total_size; -BlockDriver *bdrv_qcow2;QemuOpts *opts =NULL ;QDict *snapshot_options;BlockDriverState *bs_snapshot;
@@ -1322,11 +1316,10 @@ int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp) goto out; } - bdrv_qcow2 =bdrv_find_format ("qcow2" ); - opts =qemu_opts_create (bdrv_qcow2->create_opts,NULL ,0 , + opts =qemu_opts_create (bdrv_qcow2.create_opts,NULL ,0 , &error_abort);qemu_opt_set_number (opts,BLOCK_OPT_SIZE , total_size); - ret =bdrv_create (bdrv_qcow2, tmp_filename, opts, &local_err); + ret =bdrv_create (&bdrv_qcow2, tmp_filename, opts, &local_err);qemu_opts_del (opts);if (ret <0 ) { error_setg_errno(errp, -ret, "Could not create temporary overlay "
@@ -1346,7 +1339,7 @@ int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp) bs_snapshot =bdrv_new ("" , &error_abort); ret =bdrv_open (&bs_snapshot,NULL ,NULL , snapshot_options, - flags, bdrv_qcow2, &local_err); + flags, &bdrv_qcow2, &local_err);if (ret <0 ) {error_propagate (errp, local_err); goto out;
block/qcow2.c +3 -4
@@ -1712,10 +1712,9 @@ static int qcow2_create2(const char *filename, int64_t total_size,* refcount of the cluster that is occupied by the header and the refcount * table) */ -BlockDriver * drv =bdrv_find_format ("qcow2" ); -assert (drv !=NULL ); ret =bdrv_open (&bs, filename,NULL ,NULL , -BDRV_O_RDWR |BDRV_O_CACHE_WB |BDRV_O_NO_FLUSH , drv, &local_err); +BDRV_O_RDWR |BDRV_O_CACHE_WB |BDRV_O_NO_FLUSH , + &bdrv_qcow2, &local_err);if (ret <0 ) {error_propagate (errp, local_err); goto out;
@@ -1767,7 +1766,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,/* Reopen the image without BDRV_O_NO_FLUSH to flush it before returning */ ret =bdrv_open (&bs, filename,NULL ,NULL ,BDRV_O_RDWR |BDRV_O_CACHE_WB |BDRV_O_NO_BACKING , - drv, &local_err); + &bdrv_qcow2, &local_err);if (local_err) {error_propagate (errp, local_err); goto out;
Signature · 1 line
1.9.1
PATCH 68/88 block/vvfat: qcow driver may not be found
In reply to Michael RothFrom: Max Reitz <[email protected]>
Although virtually impossible right now, bdrv_find_format("qcow") may fail. The vvfat block driver should heed that case.
--- block/vvfat.c | 6 ++++++ 1 file changed, 6 insertions(+)
block/vvfat.c +6 -0
@@ -2926,6 +2926,12 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp) } bdrv_qcow =bdrv_find_format ("qcow" ); +if (!bdrv_qcow) { +error_setg (errp,"Failed to locate qcow driver" ); + ret = -ENOENT ; + goto err; + } + opts =qemu_opts_create (bdrv_qcow->create_opts,NULL ,0 , &error_abort);qemu_opt_set_number (opts,BLOCK_OPT_SIZE , s->sector_count *512 );qemu_opt_set (opts,BLOCK_OPT_BACKING_FILE ,"fat:" );
Signature · 1 line
1.9.1
PATCH 69/88 block/nfs: Add create_opts
In reply to Michael RothFrom: Max Reitz <[email protected]>
The nfs protocol driver is capable of creating images, but did not specify any creation options. Fix it.
A way to test this issue is the following:
$ qemu-img create -f nfs nfs://127.0.0.1/foo.qcow2 64M
Without this patch, it segfaults. With this patch, it does not. However, this is not something that should really work; qemu-img should check whether the parameter for the -f option (and -O for convert) is indeed a format, and error out if it is not. Therefore, I am not making it an iotest.
--- block/nfs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
block/nfs.c +15 -0
@@ -401,6 +401,19 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,return 0 ; } +static QemuOptsList nfs_create_opts = { + .name ="nfs-create-opts" , + .head =QTAILQ_HEAD_INITIALIZER (nfs_create_opts.head), + .desc = { + { + .name =BLOCK_OPT_SIZE , + .type =QEMU_OPT_SIZE , + .help ="Virtual disk size" + }, + {/* end of list */ } + } +}; +static int nfs_file_create (const char *url,QemuOpts *opts,Error **errp) {int ret =0 ;
@@ -461,6 +474,8 @@ static BlockDriver bdrv_nfs = { .instance_size = sizeof(NFSClient), .bdrv_needs_filename = true, + .create_opts = &nfs_create_opts, + .bdrv_has_zero_init = nfs_has_zero_init, .bdrv_get_allocated_file_size = nfs_get_allocated_file_size, .bdrv_truncate = nfs_file_truncate,
Signature · 1 line
1.9.1
PATCH 70/88 block: Check create_opts before image creation
In reply to Michael RothFrom: Max Reitz <[email protected]>
If a driver supports image creation, it needs to set the .create_opts field. We can use that to make sure .create_opts for both drivers involved is not NULL in bdrv_img_create(), which is important so that the create_opts pointer in that function is not NULL after the qemu_opts_append() calls and when going into qemu_opts_create().
--- block.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
block.c +12 -0
@@ -5528,6 +5528,18 @@ void bdrv_img_create(const char *filename, const char *fmt,return ; } +if (!drv->create_opts) { +error_setg (errp,"Format driver '%s' does not support image creation" , + drv->format_name); +return ; + } + +if (!proto_drv->create_opts) { +error_setg (errp,"Protocol driver '%s' does not support image creation" , + proto_drv->format_name); +return ; + } + create_opts =qemu_opts_append (create_opts, drv->create_opts); create_opts =qemu_opts_append (create_opts, proto_drv->create_opts);
Signature · 1 line
1.9.1
PATCH 71/88 qemu-img: Check create_opts before image creation
In reply to Michael RothFrom: Max Reitz <[email protected]>
If a driver supports image creation, it needs to set the .create_opts field. We can use that to make sure .create_opts for both drivers involved is not NULL for the target image in qemu-img convert, which is important so that the create_opts pointer in img_convert() is not NULL after the qemu_opts_append() calls and when going into qemu_opts_create().
--- qemu-img.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
qemu-img.c +14 -0
@@ -1378,6 +1378,20 @@ static int img_convert(int argc, char **argv) goto out; } +if (!drv->create_opts) { +error_report ("Format driver '%s' does not support image creation" , + drv->format_name); + ret =-1 ; + goto out; + } + +if (!proto_drv->create_opts) { +error_report ("Protocol driver '%s' does not support image creation" , + proto_drv->format_name); + ret =-1 ; + goto out; + } + create_opts =qemu_opts_append (create_opts, drv->create_opts); create_opts =qemu_opts_append (create_opts, proto_drv->create_opts);
Signature · 1 line
1.9.1
PATCH 72/88 qemu-img: Check create_opts before image amendment
In reply to Michael RothFrom: Max Reitz <[email protected]>
The image options which can be amended are described by the .create_opts field for every driver. This field must therefore be non-NULL so that anything can be amended in the first place. Check that this holds true before going into qemu_opts_create() (because if .create_opts is NULL, the create_opts pointer in img_amend() will be NULL after qemu_opts_append()).
--- qemu-img.c | 7 +++++++ 1 file changed, 7 insertions(+)
qemu-img.c +7 -0
@@ -2775,6 +2775,13 @@ static int img_amend(int argc, char **argv) goto out; } +if (!bs->drv->create_opts) { +error_report ("Format driver '%s' does not support any options to amend" , + fmt); + ret =-1 ; + goto out; + } + create_opts =qemu_opts_append (create_opts, bs->drv->create_opts); opts =qemu_opts_create (create_opts,NULL ,0 , &error_abort);if (options &&qemu_opts_do_parse (opts, options,NULL )) {
Signature · 1 line
1.9.1
PATCH 73/88 iotests: Only kill NBD server if it runs
In reply to Michael RothFrom: Max Reitz <[email protected]>
There may be NBD tests which do not create a sample image and simply test whether wrong usage of the protocol is rejected as expected. In this case, there will be no NBD server and trying to kill it during clean-up will fail.
--- tests/qemu-iotests/common.rc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/qemu-iotests/common.rc +3 -1
@@ -189,7 +189,9 @@ _cleanup_test_img() case "$IMGPROTO" in nbd) - kill $QEMU_NBD_PID + if [ -n "$QEMU_NBD_PID" ]; then + kill $QEMU_NBD_PID + fi rm -f "$TEST_IMG_FILE" ;; file)
Signature · 1 line
1.9.1
PATCH 74/88 iotests: Add test for unsupported image creation
In reply to Michael RothFrom: Max Reitz <[email protected]>
Add a test for creating and amending images (amendment uses the creation options) with formats not supporting creation over protocols not supporting creation.
Conflicts:
tests/qemu-iotests/group
*removed context dependencies from upstream iotest groups
--- tests/qemu-iotests/113 | 76 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/113.out | 15 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 92 insertions(+) create mode 100755 tests/qemu-iotests/113 create mode 100644 tests/qemu-iotests/113.out
tests/qemu-iotests/113 new file +76 -0
@@ -0,0 +1,76 @@ +#!/bin/bash +# +# Test case for accessing creation options on image formats and +# protocols not supporting image creation +# +# Copyright (C) 2014 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# creator [email protected] + +seq="$(basename $0)" +echo "QA output created by $seq" + +here="$PWD" +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# We can only test one format here because we need its sample file +_supported_fmt bochs +_supported_proto nbd +_supported_os Linux + +echo +echo '=== Unsupported image creation in qemu-img create ===' +echo + +$QEMU_IMG create -f $IMGFMT nbd://example.com 2>&1 64M | _filter_imgfmt + +echo +echo '=== Unsupported image creation in qemu-img convert ===' +echo + +# We could use any input image format here, but this is a bochs test, so just +# use the bochs image +_use_sample_img empty.bochs.bz2 +$QEMU_IMG convert -f $IMGFMT -O $IMGFMT "$TEST_IMG" nbd://example.com 2>&1 \ + | _filter_imgfmt + +echo +echo '=== Unsupported format in qemu-img amend ===' +echo + +# The protocol does not matter here +_use_sample_img empty.bochs.bz2 +$QEMU_IMG amend -f $IMGFMT -o foo=bar "$TEST_IMG" 2>&1 | _filter_imgfmt + + +# success, all done +echo +echo '*** done' +rm -f $seq.full +status=0
tests/qemu-iotests/113.out new file +15 -0
@@ -0,0 +1,15 @@ +QA output created by 113 + +=== Unsupported image creation in qemu-img create === + +qemu-img: nbd://example.com: Format driver 'IMGFMT' does not support image creation + +=== Unsupported image creation in qemu-img convert === + +qemu-img: Format driver 'IMGFMT' does not support image creation + +=== Unsupported format in qemu-img amend === + +qemu-img: Format driver 'IMGFMT' does not support any options to amend + +*** done
tests/qemu-iotests/group +1 -0
@@ -101,3 +101,4 @@ 092 rw auto quick 095 rw auto quick 101 rw auto quick +113 rw auto quick
Signature · 1 line
1.9.1
PATCH 75/88 qcow2: Prevent numerical overflow
In reply to Michael RothFrom: Max Reitz <[email protected]>
In qcow2_alloc_cluster_offset(), *num is limited toINT_MAX >> BDRV_SECTOR_BITS by all callers. However, since remaining is of type uint64_t, we might as well cast *num to that type before performing the shift.
--- block/qcow2-cluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/qcow2-cluster.c +1 -1
@@ -1202,7 +1202,7 @@ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, again: start = offset; - remaining = *num <<BDRV_SECTOR_BITS ; + remaining = (uint64_t )*num <<BDRV_SECTOR_BITS ; cluster_offset =0 ; *host_offset =0 ; cur_bytes =0 ;
Signature · 1 line
1.9.1
PATCH 76/88 qcow2: Flushing the caches in qcow2_close may fail
In reply to Michael RothFrom: Max Reitz <[email protected]>
qcow2_cache_flush() may fail; if one of the caches failed to be flushed successfully to disk in qcow2_close() the image should not be marked clean, and we should emit a warning.
This breaks the (qcow2-specific) iotests 026, 071 and 089; change their output accordingly.
--- block/qcow2.c | 19 +++++-- tests/qemu-iotests/026.out | 120 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/071.out | 8 +++ tests/qemu-iotests/089.out | 2 + 4 files changed, 146 insertions(+), 3 deletions(-)
block/qcow2.c +16 -3
@@ -1275,10 +1275,23 @@ static void qcow2_close(BlockDriverState *bs) s->l1_table =NULL ;if (!(bs->open_flags &BDRV_O_INCOMING )) { -qcow2_cache_flush (bs, s->l2_table_cache); -qcow2_cache_flush (bs, s->refcount_block_cache); +int ret1, ret2; -qcow2_mark_clean (bs); + ret1 =qcow2_cache_flush (bs, s->l2_table_cache); + ret2 =qcow2_cache_flush (bs, s->refcount_block_cache); + +if (ret1) { +error_report ("Failed to flush the L2 table cache: %s" , +strerror (-ret1)); + } +if (ret2) { +error_report ("Failed to flush the refcount block cache: %s" , +strerror (-ret2)); + } + +if (!ret1 && !ret2) { +qcow2_mark_clean (bs); + } }qcow2_cache_destroy (bs, s->l2_table_cache);
tests/qemu-iotests/026.out +120 -0
464 lines not on this page · raw message
tests/qemu-iotests/071.out +8 -0
@@ -30,10 +30,14 @@ blkverify: read sector_num=0 nb_sectors=4 contents mismatch in sector 0 === Testing blkdebug through filename === +Failed to flush the L2 table cache: Input/output error +Failed to flush the refcount block cache: Input/output error read failed: Input/output error === Testing blkdebug through file blockref === +Failed to flush the L2 table cache: Input/output error +Failed to flush the refcount block cache: Input/output error read failed: Input/output error === Testing blkdebug on existing block device ===
@@ -48,6 +52,8 @@ read failed: Input/output error {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": true}} +qemu-system-x86_64: Failed to flush the L2 table cache: Input/output error +qemu-system-x86_64: Failed to flush the refcount block cache: Input/output error === Testing blkverify on existing block device ===
@@ -86,5 +92,7 @@ read failed: Input/output error {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": true}} +qemu-system-x86_64: Failed to flush the L2 table cache: Input/output error +qemu-system-x86_64: Failed to flush the refcount block cache: Input/output error *** done
tests/qemu-iotests/089.out +2 -0
@@ -24,6 +24,8 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 wrote 512/512 bytes at offset 229376 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Failed to flush the L2 table cache: Input/output error +Failed to flush the refcount block cache: Input/output error read failed: Input/output error === Testing qemu-img info output ===
Signature · 1 line
1.9.1
PATCH 77/88 qcow2: Respect bdrv_truncate() error
In reply to Michael RothFrom: Max Reitz <[email protected]>
bdrv_truncate() may fail and qcow2_write_compressed() should return the error code in that case.
Conflicts:
block/qcow2.c
*removed context dependency on 75d3d21
--- block/qcow2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/qcow2.c +1 -2
@@ -1960,8 +1960,7 @@ static int qcow2_write_compressed(BlockDriverState *bs, int64_t sector_num,sector based I/Os */ cluster_offset =bdrv_getlength (bs->file); cluster_offset = (cluster_offset +511 ) & ~511 ; -bdrv_truncate (bs->file, cluster_offset); -return 0 ; +return bdrv_truncate (bs->file, cluster_offset); }if (nb_sectors != s->cluster_sectors) {
Signature · 1 line
1.9.1
PATCH 78/88 block/raw-posix: Fix ret in raw_open_common()
In reply to Michael RothFrom: Max Reitz <[email protected]>
The return value must be negative on error; there is one place in raw_open_common() where errp is set, but ret remains 0. Fix it.
--- block/raw-posix.c | 1 + 1 file changed, 1 insertion(+)
block/raw-posix.c +1 -0
@@ -447,6 +447,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, s->has_write_zeroes = true;if (fstat (s->fd, &st) <0 ) { + ret = -errno;error_setg_errno (errp, errno,"Could not stat file" ); goto fail; }
Signature · 1 line
1.9.1
PATCH 79/88 block migration: fix return value
In reply to Michael RothFrom: Gary R Hook <[email protected]>
Modify block_save_iterate() to return positive/zero/negative (success/not done/failure) return status. The computation of the blocks transferred (an int64_t) exceeds the size of an int return value.
Message-id: [email protected]
--- block-migration.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
block-migration.c +9 -1
@@ -652,6 +652,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) {int ret;int64_t last_ftell =qemu_ftell (f); +int64_t delta_ftell;DPRINTF ("Enter save live iterate submitted %d transferred %d\n" , block_mig_state.submitted, block_mig_state.transferred);
@@ -701,7 +702,14 @@ static int block_save_iterate(QEMUFile *f, void *opaque) }qemu_put_be64 (f,BLK_MIG_FLAG_EOS ); -return qemu_ftell (f) - last_ftell; + delta_ftell =qemu_ftell (f) - last_ftell; +if (delta_ftell >0 ) { +return 1 ; + }else if (delta_ftell <0 ) { +return -1 ; + }else { +return 0 ; + } }/* Called with iothread lock taken. */
Signature · 1 line
1.9.1
PATCH 80/88 qcow2: Fix header extension size check
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
After reading the extension header, offset is incremented, but not checked against end_offset any more. This way an integer overflow could happen when checking whether the extension end is within the allowed range, effectively disabling the check.
This patch adds the missing check and a test case for it.
Message-id: [email protected]
--- block/qcow2.c | 2 +- tests/qemu-iotests/080 | 2 ++ tests/qemu-iotests/080.out | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-)
block/qcow2.c +1 -1
@@ -114,7 +114,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,#ifdef DEBUG_EXT printf ("ext.magic = 0x%x\n" , ext.magic);#endif -if (ext.len > end_offset - offset) { +if (offset > end_offset || ext.len > end_offset - offset) {error_setg (errp,"Header extension too large" );return -EINVAL ; }
tests/qemu-iotests/080 +2 -0
@@ -78,6 +78,8 @@ poke_file "$TEST_IMG" "$offset_backing_file_offset" "\xff\xff\xff\xff\xff\xff\xf poke_file "$TEST_IMG" "$offset_ext_magic" "\x12\x34\x56\x78" poke_file "$TEST_IMG" "$offset_ext_size" "\x7f\xff\xff\xff" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +poke_file "$TEST_IMG" "$offset_backing_file_offset" "\x00\x00\x00\x00\x00\x00\x00\x$(printf %x $offset_ext_size)" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir poke_file "$TEST_IMG" "$offset_backing_file_offset" "\x00\x00\x00\x00\x00\x00\x00\x00" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
tests/qemu-iotests/080.out +2 -0
@@ -13,6 +13,8 @@ qemu-io: can't open device TEST_DIR/t.qcow2: Invalid backing file offset no file open, try 'help open' qemu-io: can't open device TEST_DIR/t.qcow2: Header extension too large no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow2: Header extension too large +no file open, try 'help open' == Huge refcount table size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
Signature · 1 line
1.9.1
PATCH 81/88 qcow2.py: Add required padding for header extensions
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
The qcow2 specification requires that the header extension data be padded to round up the extension size to the next multiple of 8 bytes.
Message-id: [email protected]
--- tests/qemu-iotests/qcow2.py | 4 ++++ 1 file changed, 4 insertions(+)
tests/qemu-iotests/qcow2.py +4 -0
@@ -7,6 +7,10 @@ import string class QcowHeaderExtension: def __init__(self, magic, length, data): + if length % 8 != 0: + padding = 8 - (length % 8) + data += "\0" * padding + self.magic = magic self.length = length self.data = data
Signature · 1 line
1.9.1
PATCH 82/88 block: Don't probe for unknown backing file format
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
If a qcow2 image specifies a backing file format that doesn't correspond to any format driver that qemu knows, we shouldn't fall back to probing, but simply error out.
Not looking up the backing file driver in bdrv_open_backing_file(), but just filling in the "driver" option if it isn't there moves us closer to the goal of having everything in QDict options and gets us the error handling of bdrv_open(), which correctly refuses unknown drivers.
Message-id: [email protected]
Conflicts:
tests/qemu-iotests/group
*removed context from upstream iotest groups
--- block.c | 7 +++--- tests/qemu-iotests/114 | 61 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/114.out | 13 ++++++++++ tests/qemu-iotests/group | 1 + 4 files changed, 78 insertions(+), 4 deletions(-) create mode 100755 tests/qemu-iotests/114 create mode 100644 tests/qemu-iotests/114.out
block.c +3 -4
@@ -1177,7 +1177,6 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp) {char *backing_filename =g_malloc0 (PATH_MAX );int ret =0 ; -BlockDriver *back_drv =NULL ;BlockDriverState *backing_hd;Error *local_err =NULL ;
@@ -1210,14 +1209,14 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp) backing_hd =bdrv_new ("" , errp); -if (bs->backing_format[0 ] !='\0' ) { - back_drv =bdrv_find_format (bs->backing_format); +if (bs->backing_format[0 ] !='\0' && !qdict_haskey (options,"driver" )) { +qdict_put (options,"driver" ,qstring_from_str (bs->backing_format)); }assert (bs->backing_hd ==NULL ); ret =bdrv_open (&backing_hd, *backing_filename ? backing_filename :NULL ,NULL , options, -bdrv_backing_flags (bs->open_flags), back_drv, &local_err); +bdrv_backing_flags (bs->open_flags),NULL , &local_err);if (ret <0 ) {bdrv_unref (backing_hd); backing_hd =NULL ;
tests/qemu-iotests/114 new file +61 -0
61 lines not on this page · raw message
tests/qemu-iotests/114.out new file +13 -0
@@ -0,0 +1,13 @@ +QA output created by 114 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file='TEST_DIR/t.IMGFMT.base' +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 64M (67108864 bytes) +cluster_size: 65536 +backing file: TEST_DIR/t.IMGFMT.base +backing file format: foo +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open backing file: Unknown driver 'foo' +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done
tests/qemu-iotests/group +1 -0
@@ -102,3 +102,4 @@ 095 rw auto quick 101 rw auto quick 113 rw auto quick +114 rw auto quick
Signature · 1 line
1.9.1
PATCH 83/88 linuxboot: compute initrd loading address
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
Even though hw/i386/pc.c tries to compute a valid loading address for the initrd, close to the top of RAM, this does not take into account other data that is malloced into that memory by SeaBIOS.
Luckily we can easily look at the memory map to find out how much memory is used up there. This patch places the initrd in the first four gigabytes, below the first hole (as returned by INT 15h, AX=e801h).
Without this patch:
[ 0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff] [ 0.000000] RAMDISK: [mem 0x0710a000-0x07fd7fff]
With this patch:
[ 0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff] [ 0.000000] RAMDISK: [mem 0x07112000-0x07fdffff]
So linuxboot is able to use the 64k that were added as padding for QEMU <= 2.1.
--- pc-bios/linuxboot.bin | Bin 1024 -> 1024 bytes pc-bios/optionrom/linuxboot.S | 47 ++++++++++++++++++++++++++++++++++++++---- pc-bios/optionrom/optionrom.h | 21 ++++++++++++++++--- 3 files changed, 61 insertions(+), 7 deletions(-)
pc-bios/linuxboot.bin binary +0 -0
pc-bios/optionrom/linuxboot.S +43 -4
67 lines not on this page · raw message
pc-bios/optionrom/optionrom.h +18 -3
@@ -51,8 +51,6 @@ .endm#define read_fw_blob_pre (var) \ - read_fw var ## _ADDR; \ - mov %eax, %edi; \ read_fw var ## _SIZE; \ mov %eax, %ecx; \ mov $var ## _DATA, %ax; \
@@ -68,6 +66,8 @@* Clobbers: %eax, %edx, %es, %ecx, %edi */ #define read_fw_blob (var) \ + read_fw var ## _ADDR; \ + mov %eax, %edi; \ read_fw_blob_pre(var); \/* old as(1) doesn't like this insn so emit the bytes instead: \ rep insb (%dx), %es:(%edi); \
@@ -80,7 +80,22 @@* * Clobbers: %eax, %edx, %es, %ecx, %edi */ -#define read_fw_blob_addr32 (var) \ +#define read_fw_blob_addr32(var) \ + read_fw var ## _ADDR; \ + mov %eax, %edi; \ + read_fw_blob_pre(var); \ + /* old as(1) doesn't like this insn so emit the bytes instead: \ + addr32 rep insb (%dx), %es:(%edi); \ + */ \ + .dc.b 0x67,0xf3,0x6c + +/* +* Read a blob from the fw_cfg device in forced addr32 mode, address is in %edi. +* Requires _SIZE and _DATA values for the parameter. +* +* Clobbers: %eax, %edx, %edi, %es, %ecx +*/ +#define read_fw_blob_addr32_edi (var) \ read_fw_blob_pre(var); \/* old as(1) doesn't like this insn so emit the bytes instead: \ addr32 rep insb (%dx), %es:(%edi); \
Signature · 1 line
1.9.1
PATCH 84/88 linuxboot: fix loading old kernels
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
Old kernels that used high memory only allowed the initrd to be in the first 896MB of memory. If you load the initrd above, they complain that "initrd extends beyond end of memory".
In order to fix this, while not breaking machines with small amounts of memory fixed by cdebec5 (linuxboot: compute initrd loading address, 2014-10-06), we need to distinguish two cases. If pc.c placed the initrd at end of memory, use the new algorithm based on the e801 memory map. If instead pc.c placed the initrd at the maximum address specified by the bzImage, leave it there.
The only interesting part is that the low-memory info block is now loaded very early, in real mode, and thus the 32-bit address has to be converted into a real mode segment. The initrd address is also patched in the info block before entering real mode, it is simpler that way.
This fixes booting the RHEL4.8 32-bit installation image with 1GB of RAM.
--- pc-bios/linuxboot.bin | Bin 1024 -> 1024 bytes pc-bios/optionrom/linuxboot.S | 37 +++++++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-)
pc-bios/linuxboot.bin binary +0 -0
pc-bios/optionrom/linuxboot.S +27 -10
@@ -76,7 +76,31 @@ boot_kernel: copy_kernel: - /* Compute initrd address */ + /* Read info block in low memory (0x10000 or 0x90000) */ + read_fw FW_CFG_SETUP_ADDR + shr $4, %eax + mov %eax, %es + xor %edi, %edi + read_fw_blob_addr32_edi(FW_CFG_SETUP) + + cmpw $0x203, %es:0x206 // if protocol >= 0x203 + jae 1f // have initrd_max + movl $0x37ffffff, %es:0x22c // else assume 0x37ffffff +1: + + /* Check if using kernel-specified initrd address */ + read_fw FW_CFG_INITRD_ADDR + mov %eax, %edi // (load_kernel wants it in %edi) + read_fw FW_CFG_INITRD_SIZE // find end of initrd + add %edi, %eax + xor %es:0x22c, %eax // if it matches es:0x22c + and $-4096, %eax // (apart from padding for page) + jz load_kernel // then initrd is not at top + // of memory + + /* pc.c placed the initrd at end of memory. Compute a better + * initrd address based on e801 data. + */ mov $0xe801, %ax xor %cx, %cx xor %dx, %dx
@@ -107,7 +131,9 @@ copy_kernel: read_fw FW_CFG_INITRD_SIZE subl %eax, %edi andl $-4096, %edi /* EDI = start of initrd */ + movl %edi, %es:0x218 /* put it in the header */ +load_kernel: /* We need to load the kernel into memory we can't access in 16 bit mode, so let's get into 32 bit mode, write the kernel and jump back again. */
@@ -139,19 +165,10 @@ copy_kernel: /* We're now running in 16-bit CS, but 32-bit ES! */ /* Load kernel and initrd */ - pushl %edi read_fw_blob_addr32_edi(FW_CFG_INITRD) read_fw_blob_addr32(FW_CFG_KERNEL) read_fw_blob_addr32(FW_CFG_CMDLINE) - read_fw FW_CFG_SETUP_ADDR - mov %eax, %edi - mov %eax, %ebx - read_fw_blob_addr32_edi(FW_CFG_SETUP) - - /* Update the header with the initrd address we chose above */ - popl %es:0x218(%ebx) - /* And now jump into Linux! */ mov $0, %eax mov %eax, %cr0
Signature · 1 line
1.9.1
PATCH 85/88 audio: Don't free hw resources until after hw backend is stopped
In reply to Michael RothFrom: Peter Maydell <[email protected]>
When stopping an audio voice, call the audio backend's fini method before calling audio_pcm_hw_free_resources_ rather than afterwards. This allows backends which use helper threads (like pulseaudio) to terminate those threads before the conv_buf or mix_buf are freed and avoids race conditions where the helper may access a NULL pointer or freed memory.
Message-id: [email protected]
--- audio/audio_template.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
audio/audio_template.h +1 -1
@@ -191,9 +191,9 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)audio_detach_capture (hw);#endif QLIST_REMOVE (hw, entries); +glue (hw->pcm_ops->fini_,TYPE ) (hw);glue (s->nb_hw_voices_,TYPE ) +=1 ;glue (audio_pcm_hw_free_resources_ ,TYPE ) (hw); -glue (hw->pcm_ops->fini_,TYPE ) (hw);g_free (hw); *hwp =NULL ; }
Signature · 1 line
1.9.1
PATCH 86/88 target-xtensa: fix translation for opcodes crossing page boundary
In reply to Michael RothFrom: Max Filippov <[email protected]>
If TB ends with an opcode that crosses page boundary and the following page is not executable then EPC1 for the code fetch exception wrongly points at the beginning of the TB. Always treat instruction that crosses page boundary as a separate TB.
--- target-xtensa/translate.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
target-xtensa/translate.c +23 -4
@@ -884,6 +884,11 @@ static TCGv_i32 gen_mac16_m(TCGv_i32 v, bool hi, bool is_unsigned)return m; } +static inline unsigned xtensa_op0_insn_len (unsigned op0) +{ +return op0 >=8 ?2 :3 ; +} +static void disas_xtensa_insn (CPUXtensaState *env,DisasContext *dc) {#define HAS_OPTION_BITS (opt) do { \
@@ -986,6 +991,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc)uint8_t b0 =cpu_ldub_code (env, dc->pc);uint8_t b1 =cpu_ldub_code (env, dc->pc +1 );uint8_t b2 =0 ; +unsigned len =xtensa_op0_insn_len (OP0 );static const uint32_t B4CONST [] = {0xffffffff ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,10 ,12 ,16 ,32 ,64 ,128 ,256
@@ -995,13 +1001,19 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc)32768 ,65536 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,10 ,12 ,16 ,32 ,64 ,128 ,256 }; -if (OP0 >=8 ) { - dc->next_pc = dc->pc +2 ; +switch (len) { +case 2 :HAS_OPTION (XTENSA_OPTION_CODE_DENSITY ); - }else { - dc->next_pc = dc->pc +3 ; +break ; + +case 3 : b2 =cpu_ldub_code (env, dc->pc +2 ); +break ; + +default : +RESERVED (); } + dc->next_pc = dc->pc + len;switch (OP0 ) {case 0 :/*QRST*/
@@ -2946,6 +2958,12 @@ invalid_opcode:#undef HAS_OPTION } +static inline unsigned xtensa_insn_len (CPUXtensaState *env,DisasContext *dc) +{ +uint8_t b0 =cpu_ldub_code (env, dc->pc); +return xtensa_op0_insn_len (OP0 ); +} +static void check_breakpoint (CPUXtensaState *env,DisasContext *dc) {CPUState *cs =CPU (xtensa_env_get_cpu (env));
@@ -3078,6 +3096,7 @@ void gen_intermediate_code_internal(XtensaCPU *cpu, }while (dc.is_jmp ==DISAS_NEXT && insn_count < max_insns && dc.pc < next_page_start && + dc.pc +xtensa_insn_len (env, &dc) <= next_page_start && tcg_ctx.gen_opc_ptr < gen_opc_end);reset_litbase (&dc);
Signature · 1 line
1.9.1
PATCH 87/88 target-xtensa: test cross-page opcode
In reply to Michael RothFrom: Max Filippov <[email protected]>
Alter cross-page TB test to also test cross-page opcode.
--- tests/tcg/xtensa/test_mmu.S | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
tests/tcg/xtensa/test_mmu.S +13 -13
@@ -641,7 +641,7 @@ test cross_page_tb witlb a2, a3 wdtlb a2, a3 - movi a2, 0x00007ffd + movi a2, 0x00007ffc movi a3, 20f movi a4, 21f sub a4, a4, a3
@@ -651,7 +651,7 @@ test cross_page_tb addi a2, a2, 1 addi a3, a3, 1 1: - movi a2, 0x00007ffd + movi a2, 0x00007ffc movi a3, 0x00008000 /* DTLB: OK, ITLB: OK */ jx a2
@@ -668,10 +668,10 @@ test cross_page_tb movi a3, 1 assert eq, a2, a3 rsr a2, epc1 - movi a3, 0x8000 + movi a3, 0x7fff assert eq, a2, a3 rsr a2, excsave1 - movi a3, 0x00007ffd + movi a3, 0x00007ffc assert ne, a2, a3 reset_ps
@@ -680,7 +680,7 @@ test cross_page_tb movi a2, 0x0400000c /* PPN */ movi a3, 0x00008000 /* VPN */ wdtlb a2, a3 - movi a2, 0x00007ffd + movi a2, 0x00007ffc movi a3, 0x00008000 /* DTLB: FAIL, ITLB: OK */ jx a2
@@ -689,10 +689,10 @@ test cross_page_tb movi a3, 28 assert eq, a2, a3 rsr a2, epc1 - movi a3, 0x7ffd + movi a3, 0x7ffc assert eq, a2, a3 rsr a2, excsave1 - movi a3, 0x00007ffd + movi a3, 0x00007ffc assert eq, a2, a3 reset_ps
@@ -703,7 +703,7 @@ test cross_page_tb witlb a2, a3 movi a2, 0x04000003 /* PPN */ wdtlb a2, a3 - movi a2, 0x00007ffd + movi a2, 0x00007ffc movi a3, 0x00008000 /* DTLB: OK, ITLB: FAIL */ jx a2
@@ -712,10 +712,10 @@ test cross_page_tb movi a3, 20 assert eq, a2, a3 rsr a2, epc1 - movi a3, 0x8000 + movi a3, 0x7fff assert eq, a2, a3 rsr a2, excsave1 - movi a3, 0x00007ffd + movi a3, 0x00007ffc assert ne, a2, a3 reset_ps
@@ -724,7 +724,7 @@ test cross_page_tb movi a2, 0x0400000c /* PPN */ movi a3, 0x00008000 /* VPN */ wdtlb a2, a3 - movi a2, 0x00007ffd + movi a2, 0x00007ffc movi a3, 0x00008000 /* DTLB: FAIL, ITLB: FAIL */ jx a2
@@ -733,10 +733,10 @@ test cross_page_tb movi a3, 28 assert eq, a2, a3 rsr a2, epc1 - movi a3, 0x7ffd + movi a3, 0x7ffc assert eq, a2, a3 rsr a2, excsave1 - movi a3, 0x00007ffd + movi a3, 0x00007ffc assert eq, a2, a3 test_end
Signature · 1 line
1.9.1
PATCH 88/88 pc: acpi: mark all possible CPUs as enabled in SRAT
In reply to Michael RothFrom: Igor Mammedov <[email protected]>
If QEMU is started with -numa ... Windows only notices that CPU has been hot-added but it will not online such CPUs.
It's caused by the fact that possible CPUs are flagged as not enabled in SRAT and Windows honoring that information doesn't use corresponding CPU.
ACPI 5.0 Spec regarding to flag says:
"
Table 5-47 Local APIC Flags
...
Enabled: if zero, this processor is unusable, and the operating system support will not attempt to use it.
"
Fix QEMU to adhere to spec and mark possible CPUs as enabled in SRAT.
With that Windows onlines hot-added CPUs as expected.
--- hw/i386/acpi-build.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
hw/i386/acpi-build.c +3 -8
@@ -1228,8 +1228,7 @@ acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base, }static void -build_srat (GArray *table_data,GArray *linker, -AcpiCpuInfo *cpu,PcGuestInfo *guest_info) +build_srat (GArray *table_data,GArray *linker,PcGuestInfo *guest_info) {AcpiSystemResourceAffinityTable *srat;AcpiSratProcessorAffinity *core;
@@ -1259,11 +1258,7 @@ build_srat(GArray *table_data, GArray *linker, core->proximity_lo = curnode;memset (core->proximity_hi,0 ,3 ); core->local_sapic_eid =0 ; -if (test_bit (i, cpu->found_cpus)) { - core->flags =cpu_to_le32 (1 ); - }else { - core->flags =cpu_to_le32 (0 ); - } + core->flags =cpu_to_le32 (1 ); }
@@ -1539,7 +1534,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) }if (guest_info->numa_nodes) {acpi_add_table (table_offsets, tables->table_data); -build_srat (tables->table_data, tables->linker, &cpu, guest_info); +build_srat (tables->table_data, tables->linker, guest_info); }if (acpi_get_mcfg (&mcfg)) {acpi_add_table (table_offsets, tables->table_data);
Signature · 1 line
1.9.1
Quoted 4 lines · Michael Roth
Hi everyone,
The following new patches are queued for QEMU stable v2.1.3:
Quoted 8 lines
https://github.com/mdroth/qemu/commits/stable-2.1-staging
The release is planned for 2015-01-21:
http://wiki.qemu.org/Planning/2.1Please respond here or CC [email protected] on any patches you think should be included in the release.
I think that also this patch should be added:
[Qemu-devel] [PATCH v3] vl.c: fix regression when reading machine type from config file
Link:
https://www.mail-archive.com/[email protected]/msg272730.html
Thanks,
Marcel
Quoted 267 lines
This is the last planned release for the QEMU 2.1 series, and it's quite a bit busier than usual for a final stable update so your scrutiny/testing is very appreciated.
Thanks!
----------------------------------------------------------------
Alexander Graf (2):
kvmclock: Ensure time in migration never goes backward
kvm: Fix memory slot page alignment logicAndreas Färber (1):
ivshmem: Fix fd leak on errorAurelien Jarno (1):
tcg/mips: fix store softmmu slow pathDamjan Marion (1):
vhost-user: fixVIRTIO_NET_F_MRG_RXBUFnegotiationDon Slutz (1):
hw/ide/core.c: Prevent SIGSEGV during migrationDr. David Alan Gilbert (1):
xhci PCIe endpoint migration compatibility fixEduardo Habkost (2):
kvmclock: Add comment explaining why we needcpu_clean_all_dirty()
smbios: Fix assertion on socket count calculationFam Zheng (1):
qemu-iotests: Test missing "driver" key for blockdev-addGary R Hook (1):
block migration: fix return valueGerd Hoffmann (5):
vmware-vga: CVE-2014-3689: turn off hw accel
vmware-vga: addvmsvga_verify_rect
vmware-vga: usevmsvga_verify_rectinvmsvga_update_rect
vmware-vga: usevmsvga_verify_rectinvmsvga_copy_rect
vmware-vga: usevmsvga_verify_rectinvmsvga_fill_rectGonglei (13):
qdev: Use NULL instead oflocal_errforqbus_childunrealize
qdev: Add cleanup logic indevice_set_realized()to avoid resource leak
virtio-net: use aliases instead of duplicate qdev properties
virtio-net: fix virtio-net child refcount in transports virtio/vhost-scsi: use aliases instead of duplicate qdev properties virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in transports
virtio-serial: use aliases instead of duplicate qdev properties
virtio-serial: fix virtio-serial child refcount in transports
virtio-rng: use aliases instead of duplicate qdev properties
virtio-rng: fix virtio-rng child refcount in transports
virtio-balloon: fix virtio-balloon child refcount in transports
virtio-9p: use aliases instead of duplicate qdev properties
virtio-9p: fix virtio-9p child refcount in transportsGreg Kurz (1):
spapr_pci: map the MSI window in each PHBHannes Reinecke (1):
esp-pci: fixup deadlock with linuxIgor Mammedov (1):
pc: acpi: mark all possible CPUs as enabled in SRATJan Kiszka (3):
pci: Use bus master address space for delivering MSI/MSI-X messages
pc: Fix disabling of vapic for compat PC models
Makeqemu_shutdown_requestedsignal-safeJason Wang (1):
virtio-net: fix unmap leakKevin Wolf (3):
qcow2: Fix header extension size checkqcow2.py: Add required padding for header extensions
block: Don't probe for unknown backing file formatLuiz Capitulino (2):
exec:file_ram_alloc(): print error when prealloc fails
virtio-balloon: fix integer overflow in memory stats featureMarcelo Tosatti (2):
Introduce cpu_clean_all_dirty kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculationMax Filippov (5):
hw/core/loader: implement address translation in uimage loader hw/xtensa/xtfpga: treat uImage load address as virtual
target-xtensa: add missing window check for entry
target-xtensa: fix translation for opcodes crossing page boundary
target-xtensa: test cross-page opcodeMax Reitz (14):
qcow2: Do not overflow when writing an L1 sector
block: Make essential BlockDriver objects public
block: Omitbdrv_find_formatfor essential drivers block/vvfat: qcow driver may not be found block/nfs: Addcreate_opts
block: Checkcreate_optsbefore image creation
qemu-img: Checkcreate_optsbefore image creation
qemu-img: Checkcreate_optsbefore image amendment
iotests: Only kill NBD server if it runs
iotests: Add test for unsupported image creation
qcow2: Prevent numerical overflow
qcow2: Flushing the caches inqcow2_closemay fail
qcow2: Respectbdrv_truncate()errorblock/raw-posix: Fix ret inraw_open_common()Michael Roth (4):
qapi: addvisit_start_unionandvisit_end_union
qapi: dealloc visitor, implementvisit_start_union
tests: add QMP input visitor test for unions with no discriminator
tests: avoid running duplicate qom-testsMichael S. Tsirkin (1):
virtio-pci: enable bus master for old guestsPaolo Bonzini (4):
vhost-scsi: usevirtio_ldl_p
virtio-scsi: work around bug in old BIOSes
linuxboot: compute initrd loading address
linuxboot: fix loading old kernelsPavel Dovgalyuk (1):
gdbstub: initmon_chrthroughqemu_chr_allocPeter Maydell (4):
hw/arm/virt: fix pl011 and pl031 irq flagshw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)
exec: Handle multipage ranges ininvalidate_and_set_dirty()
audio: Don't free hw resources until after hw backend is stoppedPetr Matousek (1):
vnc: sanitizebits_per_pixelfrom the clientRay Strode (1):
libcacard: don't free sign buffer while sign op is pendingSebastian Krahmer (1):
ivshmem: Fix potential OOB r/w accessStefan Hajnoczi (2):
ivshmem: Checkivshmem_read()size argument
ivshmem: validateincoming_posnvalue from serverStratos Psomadakis (1):
monitor: Reset HMP mon->rs in CHR_EVENT_OPENTing Wang (1):
virtio-scsi: sense invirtio_scsi_command_completeZhang Haoyu (2):
snapshot: fix referencing wrong variable in while loop indo_delvm
snapshot: addbdrv_drain_all()tobdrv_snapshot_delete()to avoid concurrency problemzhanghailiang (3):
pc-dimm: Don't checkdimm->nodewhen there is non-NUMA config
libcacard: fix resource leak
l2tpv3: fix possible double freeaudio/audio_template.h | 2 +- block-migration.c | 10 +++- block.c | 36 ++++++------ block/nfs.c | 15 +++++ block/qcow2-cluster.c | 8 ++- block/qcow2.c | 33 +++++++---- block/raw-posix.c | 3 +- block/raw-win32.c | 2 +- block/raw_bsd.c | 2 +- block/snapshot.c | 4 ++ block/vvfat.c | 6 ++ cpus.c | 9 +++ exec.c | 7 +-- gdbstub.c | 2 +- hw/arm/boot.c | 2 +- hw/arm/virt.c | 4 +- hw/core/loader.c | 17 ++++-- hw/core/qdev.c | 66 +++++++++++++++------- hw/display/vmware_vga.c | 116 +++++++++++++++++++++++++------------- hw/i386/acpi-build.c | 11 +--- hw/i386/kvm/clock.c | 67 ++++++++++++++++++++++ hw/i386/pc_piix.c | 2 +- hw/i386/smbios.c | 2 +- hw/ide/core.c | 2 +- hw/m68k/an5206.c | 3 +- hw/m68k/dummy_m68k.c | 3 +- hw/m68k/mcf5208.c | 3 +- hw/mem/pc-dimm.c | 2 +- hw/microblaze/boot.c | 3 +- hw/misc/ivshmem.c | 66 ++++++++++++++++++++-- hw/net/vhost_net.c | 8 +-- hw/net/virtio-net.c | 5 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci/msi.c | 2 +- hw/pci/msix.c | 2 +- hw/ppc/e500.c | 3 +- hw/ppc/ppc440_bamboo.c | 3 +- hw/ppc/spapr.c | 1 - hw/ppc/spapr_pci.c | 81 +++++++++++++-------------- hw/s390x/s390-virtio-bus.c | 16 ++++-- hw/s390x/virtio-ccw.c | 18 +++--- hw/scsi/esp-pci.c | 2 + hw/scsi/vhost-scsi.c | 5 +- hw/scsi/virtio-scsi.c | 19 ++++++- hw/usb/hcd-xhci.c | 6 +- hw/virtio/virtio-balloon.c | 7 ++- hw/virtio/virtio-pci.c | 31 ++++++++--- hw/xtensa/xtfpga.c | 3 +- include/block/block_int.h | 8 +++ include/exec/ram_addr.h | 25 +++++++++ include/hw/i386/pc.h | 5 ++ include/hw/loader.h | 4 +- include/hw/pci-host/spapr.h | 2 +- include/hw/ppc/spapr.h | 2 - include/qapi/visitor-impl.h | 2 + include/qapi/visitor.h | 2 + include/sysemu/cpus.h | 1 + include/sysemu/kvm.h | 8 +++ kvm-all.c | 11 +++- libcacard/cac.c | 10 +++- libcacard/vscclient.c | 7 ++- monitor.c | 1 + net/l2tpv3.c | 1 - pc-bios/linuxboot.bin | Bin 1024 -> 1024 bytes pc-bios/optionrom/linuxboot.S | 66 ++++++++++++++++++++-- pc-bios/optionrom/optionrom.h | 21 ++++++- qapi/qapi-dealloc-visitor.c | 26 +++++++++ qapi/qapi-visit-core.c | 15 +++++ qemu-img.c | 21 +++++++ savevm.c | 11 ++-- scripts/qapi-visit.py | 6 ++ target-xtensa/cpu.h | 6 ++ target-xtensa/op_helper.c | 6 ++ target-xtensa/translate.c | 27 +++++++-- tcg/mips/tcg-target.c | 2 +- tests/Makefile | 3 +- tests/qapi-schema/qapi-schema-test.json | 10 ++++ tests/qapi-schema/qapi-schema-test.out | 3 + tests/qemu-iotests/026.out | 120 ++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/071.out | 8 +++ tests/qemu-iotests/080 | 2 + tests/qemu-iotests/080.out | 2 + tests/qemu-iotests/087 | 17 ++++++ tests/qemu-iotests/087.out | 13 +++++ tests/qemu-iotests/089.out | 2 + tests/qemu-iotests/113 | 76 +++++++++++++++++++++++++ tests/qemu-iotests/113.out | 15 +++++ tests/qemu-iotests/114 | 61 ++++++++++++++++++++ tests/qemu-iotests/114.out | 13 +++++ tests/qemu-iotests/common.rc | 4 +- tests/qemu-iotests/group | 2 + tests/qemu-iotests/qcow2.py | 4 ++ tests/tcg/xtensa/test_mmu.S | 26 ++++----- tests/test-qmp-input-strict.c | 17 ++++++ ui/vnc.c | 10 ++++ vl.c | 4 +- 96 files changed, 1175 insertions(+), 255 deletions(-)create mode 100755 tests/qemu-iotests/113
create mode 100644 tests/qemu-iotests/113.out
create mode 100755 tests/qemu-iotests/114
create mode 100644 tests/qemu-iotests/114.out
Quoted 9 lines · Marcel Apfelbaum
Quoted 4 lines
Please respond here or CC [email protected] on any patches you think should be included in the release.
I think that also this patch should be added:
[Qemu-devel] [PATCH v3]vl.c: fix regression when reading machine
type from config file
Link:https://www.mail-archive.com/[email protected]/msg272730.html
That's commit 364c3e6b8dd7912e01d19122d791b8c8f6df4f6c on branch uq/master of git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git.
Paolo
Hello,
Quoted 2 lines · Paolo Bonzini
That's commit
364c3e6b8dd7912e01d19122d791b8c8f6df4f6con branch uq/master ofgit://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git.
maybe the one for:
fix regression when reading memory size from config file
is also a patch to think about.
Thanks,
Signature · 1 line
William
Quoted 10 lines · William Dauchy
Hello,
Quoted 2 lines · Paolo Bonzini
That's commit
364c3e6b8dd7912e01d19122d791b8c8f6df4f6con branch uq/master ofgit://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git.maybe the one for:
fix regression when reading memory size from config fileis also a patch to think about.
Definitely, the patch was:
[PATCH] vl.c: fix regression when reading memory size from config file + Paolo's fix
The thread is:
http://lists.gnu.org/archive/html/qemu-devel/2015-01/msg01000.html
Be aware that we need both the patch and Paolo's fix. Thanks,
Marcel
Quoted 3 lines
Thanks,
Quoting Marcel Apfelbaum (2015-01-13 12:48:50)
Quoted 10 lines · William Dauchy
Quoted 9 lines
Hello,
Quoted 2 lines · Paolo Bonzini
That's commit
364c3e6b8dd7912e01d19122d791b8c8f6df4f6con branch uq/master ofgit://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git.maybe the one for:
fix regression when reading memory size from config file
Quoted 8 lines
Quoted 1 line
is also a patch to think about.
Definitely, the patch was:
[PATCH]vl.c: fix regression when reading memory size from config file + Paolo's fixThe thread is:
http://lists.gnu.org/archive/html/qemu-devel/2015-01/msg01000.htmlBe aware that we need both the patch and Paolo's fix.
By Paolo's fix you mean:
364c3e6, "vl.c: fix regression when reading machine type from config file"?
I've gone ahead and applied from uq/uq/master, but still waiting on
"vl.c: fix regression when reading memory size from config file" to be picked up by a maintainer.
Quoted 7 lines
Thanks,
MarcelQuoted 3 lines
Thanks,
Quoted 6 lines · Michael Roth
364c3e6, "
vl.c: fix regression when reading machine type from config file"?I've gone ahead and applied from uq/uq/master, but still waiting on
"
vl.c: fix regression when reading memory size from config file" to be picked up by a maintainer.
This is now fa31bf14294cbdf63de5dde8961c2ebaf7167c69 in uq/master.
This is not a regression as far as I know, it just never worked. I don't feel too comfortable including that patch.
Paolo
Quoting Paolo Bonzini (2015-01-13 14:40:07)
Quoted 5 lines · Michael Roth
Quoted 4 lines
364c3e6, "
vl.c: fix regression when reading machine type from config file"?I've gone ahead and applied from uq/uq/master, but still waiting on
Quoted 7 lines
Quoted 2 lines
"
vl.c: fix regression when reading memory size from config file" to be picked up by a maintainer.This is now
fa31bf14294cbdf63de5dde8961c2ebaf7167c69in uq/master.This is not a regression as far as I know, it just never worked. I don't feel too comfortable including that patch.
That doesn't seem rather hairy for a non-regression. Maybe I'll off now, we can maybe reconsider for 2.2.1
Quoted 2 lines
Paolo
Quoting Michael Roth (2015-01-13 15:03:17)
Quoted 9 lines
Quoting Paolo Bonzini (2015-01-13 14:40:07)
Quoted 8 lines · Michael Roth
Quoted 6 lines
364c3e6, "
vl.c: fix regression when reading machine type from config file"?I've gone ahead and applied from uq/uq/master, but still waiting on
"
vl.c: fix regression when reading memory size from config file" to be picked up by a maintainer.
Quoted 7 lines
Quoted 4 lines
This is now
fa31bf14294cbdf63de5dde8961c2ebaf7167c69in uq/master.This is not a regression as far as I know, it just never worked. I don't feel too comfortable including that patch.
That doesn't seem rather hairy for a non-regression. Maybe I'll off now, we can maybe reconsider for 2.2.1
And by doesn't I of course mean the opposite
Quoted 3 lines
Quoted 3 lines
Paolo
Quoted 12 lines
Subject: Re: [Qemu-stable] Patch Round-up for stable 2.1.3, freeze on 2015-01-14
Quoting Paolo Bonzini (2015-01-13 14:40:07)
Quoted 8 lines · Michael Roth
Quoted 6 lines
364c3e6, "
vl.c: fix regression when reading machine type from config file"?I've gone ahead and applied from uq/uq/master, but still waiting on
"
vl.c: fix regression when reading memory size from config file" to be picked up by a maintainer.
Quoted 8 lines
Quoted 4 lines
This is now
fa31bf14294cbdf63de5dde8961c2ebaf7167c69in uq/master.This is not a regression as far as I know, it just never worked. I don't feel too comfortable including that patch.
That doesn't seem rather hairy for a non-regression. Maybe I'll off now, we can maybe reconsider for 2.2.1
Hi, Michael
When are you going to release stable 2.2.1? Thanks :)
Regards,
-Gonglei
Quoting Michael Roth (2015-01-08 11:33:04)
Quoted 8 lines
Hi everyone,
The following new patches are queued for QEMU stable v2.1.3:
https://github.com/mdroth/qemu/commits/stable-2.1-staging
The release is planned for 2015-01-21:
Quoted 8 lines
http://wiki.qemu.org/Planning/2.1
Please respond here or CC [email protected] on any patches you think should be included in the release.
This is the last planned release for the QEMU 2.1 series, and it's quite a bit busier than usual for a final stable update so your scrutiny/testing is very appreciated.
The following patches have since been added:
5acac17 vl.c: fix regression when reading machine type from config file 2da3577 PPC: Fix crash on spapr_tce_table_finalize()
307e017 atomic: fix position of volatile qualifier
a043ba3 migration/block: fix pending() return value
https://github.com/mdroth/qemu/commits/stable-2.1-staging
Freeze is EOD tomorrow.
Quoted 261 lines
Thanks!
----------------------------------------------------------------
Alexander Graf (2):
kvmclock: Ensure time in migration never goes backward
kvm: Fix memory slot page alignment logicAndreas Färber (1):
ivshmem: Fix fd leak on errorAurelien Jarno (1):
tcg/mips: fix store softmmu slow pathDamjan Marion (1):
vhost-user: fixVIRTIO_NET_F_MRG_RXBUFnegotiationDon Slutz (1):
hw/ide/core.c: Prevent SIGSEGV during migrationDr. David Alan Gilbert (1):
xhci PCIe endpoint migration compatibility fixEduardo Habkost (2):
kvmclock: Add comment explaining why we needcpu_clean_all_dirty()
smbios: Fix assertion on socket count calculationFam Zheng (1):
qemu-iotests: Test missing "driver" key for blockdev-addGary R Hook (1):
block migration: fix return valueGerd Hoffmann (5):
vmware-vga: CVE-2014-3689: turn off hw accel
vmware-vga: addvmsvga_verify_rect
vmware-vga: usevmsvga_verify_rectinvmsvga_update_rect
vmware-vga: usevmsvga_verify_rectinvmsvga_copy_rect
vmware-vga: usevmsvga_verify_rectinvmsvga_fill_rectGonglei (13):
qdev: Use NULL instead oflocal_errforqbus_childunrealize
qdev: Add cleanup logic indevice_set_realized()to avoid resource leak
virtio-net: use aliases instead of duplicate qdev properties
virtio-net: fix virtio-net child refcount in transports virtio/vhost-scsi: use aliases instead of duplicate qdev properties virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in transports
virtio-serial: use aliases instead of duplicate qdev properties
virtio-serial: fix virtio-serial child refcount in transports
virtio-rng: use aliases instead of duplicate qdev properties
virtio-rng: fix virtio-rng child refcount in transports
virtio-balloon: fix virtio-balloon child refcount in transports
virtio-9p: use aliases instead of duplicate qdev properties
virtio-9p: fix virtio-9p child refcount in transportsGreg Kurz (1):
spapr_pci: map the MSI window in each PHBHannes Reinecke (1):
esp-pci: fixup deadlock with linuxIgor Mammedov (1):
pc: acpi: mark all possible CPUs as enabled in SRATJan Kiszka (3):
pci: Use bus master address space for delivering MSI/MSI-X messages
pc: Fix disabling of vapic for compat PC models
Makeqemu_shutdown_requestedsignal-safeJason Wang (1):
virtio-net: fix unmap leakKevin Wolf (3):
qcow2: Fix header extension size checkqcow2.py: Add required padding for header extensions
block: Don't probe for unknown backing file formatLuiz Capitulino (2):
exec:file_ram_alloc(): print error when prealloc fails
virtio-balloon: fix integer overflow in memory stats featureMarcelo Tosatti (2):
Introduce cpu_clean_all_dirty kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculationMax Filippov (5):
hw/core/loader: implement address translation in uimage loader hw/xtensa/xtfpga: treat uImage load address as virtual
target-xtensa: add missing window check for entry
target-xtensa: fix translation for opcodes crossing page boundary
target-xtensa: test cross-page opcodeMax Reitz (14):
qcow2: Do not overflow when writing an L1 sector
block: Make essential BlockDriver objects public
block: Omitbdrv_find_formatfor essential drivers block/vvfat: qcow driver may not be found block/nfs: Addcreate_opts
block: Checkcreate_optsbefore image creation
qemu-img: Checkcreate_optsbefore image creation
qemu-img: Checkcreate_optsbefore image amendment
iotests: Only kill NBD server if it runs
iotests: Add test for unsupported image creation
qcow2: Prevent numerical overflow
qcow2: Flushing the caches inqcow2_closemay fail
qcow2: Respectbdrv_truncate()errorblock/raw-posix: Fix ret inraw_open_common()Michael Roth (4):
qapi: addvisit_start_unionandvisit_end_union
qapi: dealloc visitor, implementvisit_start_union
tests: add QMP input visitor test for unions with no discriminator
tests: avoid running duplicate qom-testsMichael S. Tsirkin (1):
virtio-pci: enable bus master for old guestsPaolo Bonzini (4):
vhost-scsi: usevirtio_ldl_p
virtio-scsi: work around bug in old BIOSes
linuxboot: compute initrd loading address
linuxboot: fix loading old kernelsPavel Dovgalyuk (1):
gdbstub: initmon_chrthroughqemu_chr_allocPeter Maydell (4):
hw/arm/virt: fix pl011 and pl031 irq flagshw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)
exec: Handle multipage ranges ininvalidate_and_set_dirty()
audio: Don't free hw resources until after hw backend is stoppedPetr Matousek (1):
vnc: sanitizebits_per_pixelfrom the clientRay Strode (1):
libcacard: don't free sign buffer while sign op is pendingSebastian Krahmer (1):
ivshmem: Fix potential OOB r/w accessStefan Hajnoczi (2):
ivshmem: Checkivshmem_read()size argument
ivshmem: validateincoming_posnvalue from serverStratos Psomadakis (1):
monitor: Reset HMP mon->rs in CHR_EVENT_OPENTing Wang (1):
virtio-scsi: sense invirtio_scsi_command_completeZhang Haoyu (2):
snapshot: fix referencing wrong variable in while loop indo_delvm
snapshot: addbdrv_drain_all()tobdrv_snapshot_delete()to avoid concurrency problemzhanghailiang (3):
pc-dimm: Don't checkdimm->nodewhen there is non-NUMA config
libcacard: fix resource leak
l2tpv3: fix possible double freeaudio/audio_template.h | 2 +- block-migration.c | 10 +++- block.c | 36 ++++++------ block/nfs.c | 15 +++++ block/qcow2-cluster.c | 8 ++- block/qcow2.c | 33 +++++++---- block/raw-posix.c | 3 +- block/raw-win32.c | 2 +- block/raw_bsd.c | 2 +- block/snapshot.c | 4 ++ block/vvfat.c | 6 ++ cpus.c | 9 +++ exec.c | 7 +-- gdbstub.c | 2 +- hw/arm/boot.c | 2 +- hw/arm/virt.c | 4 +- hw/core/loader.c | 17 ++++-- hw/core/qdev.c | 66 +++++++++++++++------- hw/display/vmware_vga.c | 116 +++++++++++++++++++++++++------------- hw/i386/acpi-build.c | 11 +--- hw/i386/kvm/clock.c | 67 ++++++++++++++++++++++ hw/i386/pc_piix.c | 2 +- hw/i386/smbios.c | 2 +- hw/ide/core.c | 2 +- hw/m68k/an5206.c | 3 +- hw/m68k/dummy_m68k.c | 3 +- hw/m68k/mcf5208.c | 3 +- hw/mem/pc-dimm.c | 2 +- hw/microblaze/boot.c | 3 +- hw/misc/ivshmem.c | 66 ++++++++++++++++++++-- hw/net/vhost_net.c | 8 +-- hw/net/virtio-net.c | 5 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci/msi.c | 2 +- hw/pci/msix.c | 2 +- hw/ppc/e500.c | 3 +- hw/ppc/ppc440_bamboo.c | 3 +- hw/ppc/spapr.c | 1 - hw/ppc/spapr_pci.c | 81 +++++++++++++-------------- hw/s390x/s390-virtio-bus.c | 16 ++++-- hw/s390x/virtio-ccw.c | 18 +++--- hw/scsi/esp-pci.c | 2 + hw/scsi/vhost-scsi.c | 5 +- hw/scsi/virtio-scsi.c | 19 ++++++- hw/usb/hcd-xhci.c | 6 +- hw/virtio/virtio-balloon.c | 7 ++- hw/virtio/virtio-pci.c | 31 ++++++++--- hw/xtensa/xtfpga.c | 3 +- include/block/block_int.h | 8 +++ include/exec/ram_addr.h | 25 +++++++++ include/hw/i386/pc.h | 5 ++ include/hw/loader.h | 4 +- include/hw/pci-host/spapr.h | 2 +- include/hw/ppc/spapr.h | 2 - include/qapi/visitor-impl.h | 2 + include/qapi/visitor.h | 2 + include/sysemu/cpus.h | 1 + include/sysemu/kvm.h | 8 +++ kvm-all.c | 11 +++- libcacard/cac.c | 10 +++- libcacard/vscclient.c | 7 ++- monitor.c | 1 + net/l2tpv3.c | 1 - pc-bios/linuxboot.bin | Bin 1024 -> 1024 bytes pc-bios/optionrom/linuxboot.S | 66 ++++++++++++++++++++-- pc-bios/optionrom/optionrom.h | 21 ++++++- qapi/qapi-dealloc-visitor.c | 26 +++++++++ qapi/qapi-visit-core.c | 15 +++++ qemu-img.c | 21 +++++++ savevm.c | 11 ++-- scripts/qapi-visit.py | 6 ++ target-xtensa/cpu.h | 6 ++ target-xtensa/op_helper.c | 6 ++ target-xtensa/translate.c | 27 +++++++-- tcg/mips/tcg-target.c | 2 +- tests/Makefile | 3 +- tests/qapi-schema/qapi-schema-test.json | 10 ++++ tests/qapi-schema/qapi-schema-test.out | 3 + tests/qemu-iotests/026.out | 120 ++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/071.out | 8 +++ tests/qemu-iotests/080 | 2 + tests/qemu-iotests/080.out | 2 + tests/qemu-iotests/087 | 17 ++++++ tests/qemu-iotests/087.out | 13 +++++ tests/qemu-iotests/089.out | 2 + tests/qemu-iotests/113 | 76 +++++++++++++++++++++++++ tests/qemu-iotests/113.out | 15 +++++ tests/qemu-iotests/114 | 61 ++++++++++++++++++++ tests/qemu-iotests/114.out | 13 +++++ tests/qemu-iotests/common.rc | 4 +- tests/qemu-iotests/group | 2 + tests/qemu-iotests/qcow2.py | 4 ++ tests/tcg/xtensa/test_mmu.S | 26 ++++----- tests/test-qmp-input-strict.c | 17 ++++++ ui/vnc.c | 10 ++++ vl.c | 4 +- 96 files changed, 1175 insertions(+), 255 deletions(-) create mode 100755 tests/qemu-iotests/113 create mode 100644 tests/qemu-iotests/113.out create mode 100755 tests/qemu-iotests/114 create mode 100644 tests/qemu-iotests/114.out