qemu/hw
Markus Armbruster 36ad0e948e Fix -machine options accel, kernel_irqchip, kvm_shadow_mem
Multiple -machine options with the same ID are merged.  All but the
one without an ID are to be silently ignored.

In most places, we query these options with a null ID.  This is
correct.

In some places, we instead query whatever options come first in the
list.  This is wrong.  When the -machine processed first happens to
have an ID, options are taken from that ID, and the ones specified
without ID are silently ignored.

Example:

    $ upstream-qemu -nodefaults -S -display none -monitor stdio -machine id=foo -machine accel=kvm,usb=on
    $ upstream-qemu -nodefaults -S -display none -monitor stdio -machine id=foo,accel=kvm,usb=on -machine accel=xen
    $ upstream-qemu -nodefaults -S -display none -monitor stdio -machine accel=xen -machine id=foo,accel=kvm,usb=on

    $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -machine accel=kvm,usb=on
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) info kvm
    kvm support: enabled
    (qemu) info usb
    (qemu) q
    $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -machine id=foo -machine accel=kvm,usb=on
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) info kvm
    kvm support: disabled
    (qemu) info usb
    (qemu) q
    $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -machine id=foo,accel=kvm,usb=on -machine accel=xen
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) info kvm
    kvm support: enabled
    (qemu) info usb
    USB support not enabled
    (qemu) q
    $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -machine accel=xen -machine id=foo,accel=kvm,usb=on
    xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error
    xen be core: can't open xen interface
    failed to initialize Xen: Operation not permitted

Option usb is queried correctly, and the one without an ID wins,
regardless of option order.

Option accel is queried incorrectly, and which one wins depends on
option order and ID.

Affected options are accel (and its sugared forms -enable-kvm and
-no-kvm), kernel_irqchip, kvm_shadow_mem.

Additionally, option kernel_irqchip is normally on by default, except
it's off when no -machine options are given.  Bug can't bite, because
kernel_irqchip is used only when KVM is enabled, KVM is off by
default, and enabling always creates -machine options.  Downstreams
that enable KVM by default do get bitten, though.

Use qemu_get_machine_opts() to fix these bugs.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372943363-24081-5-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-09 13:38:58 -05:00
..
9pfs hw/9pfs: Fix memory leak in error path 2013-07-09 13:38:56 -05:00
acpi hw/a*: pass owner to memory_region_init* functions 2013-07-04 17:42:47 +02:00
alpha pci,misc enhancements 2013-07-08 08:00:23 -05:00
arm pci,misc enhancements 2013-07-08 08:00:23 -05:00
audio hw/a*: pass owner to memory_region_init* functions 2013-07-04 17:42:47 +02:00
block hw/block: pass owner to memory_region_init* functions 2013-07-04 17:42:47 +02:00
bt sysemu: avoid proliferation of include/ subdirectories 2013-04-15 18:19:25 +02:00
char hw/c*: pass owner to memory_region_init* functions 2013-07-04 17:42:47 +02:00
core hw/c*: pass owner to memory_region_init* functions 2013-07-04 17:42:47 +02:00
cpu hw/c*: pass owner to memory_region_init* functions 2013-07-04 17:42:47 +02:00
cris memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
display add a header file for atomic operations 2013-07-04 17:42:49 +02:00
dma hw/d*: pass owner to memory_region_init* functions 2013-07-04 17:42:47 +02:00
gpio hw/gpio: pass owner to memory_region_init* functions 2013-07-04 17:42:47 +02:00
i2c Extend support of SMBUS(module pm_smbus.c) HST_STS register. 2013-07-09 13:38:55 -05:00
i386 pci,misc enhancements 2013-07-08 08:00:23 -05:00
ide hw/i*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
input hw/i*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
intc hw/i*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
isa hw/i*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
lm32 memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
m68k memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
microblaze memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
mips pci,misc enhancements 2013-07-08 08:00:23 -05:00
misc pci,misc enhancements 2013-07-08 08:00:23 -05:00
moxie memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
net pci,misc enhancements 2013-07-08 08:00:23 -05:00
nvram hw/n*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
openrisc memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
pci pci,misc enhancements 2013-07-08 08:00:23 -05:00
pci-bridge hw/p*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
pci-host pci,misc enhancements 2013-07-08 08:00:23 -05:00
ppc Fix -machine options accel, kernel_irqchip, kvm_shadow_mem 2013-07-09 13:38:58 -05:00
s390x memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
scsi hw/s*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
sd hw/s*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
sh4 pci,misc enhancements 2013-07-08 08:00:23 -05:00
sparc hw/s*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
sparc64 pci,misc enhancements 2013-07-08 08:00:23 -05:00
ssi hw/s*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
timer hw/t*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
tpm hw/t*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
unicore32 memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
usb hw/[u-x]*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
virtio add a header file for atomic operations 2013-07-04 17:42:49 +02:00
watchdog hw/[u-x]*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
xen hw/[u-x]*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
xtensa hw/[u-x]*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
Makefile.objs virtio: simplify Makefile conditionals 2013-04-19 16:18:11 +02:00