qemu/target-i386
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
..
arch_dump.c cpu: Move cpu_write_elfXX_note() functions to CPUState 2013-05-01 13:04:19 +02:00
arch_memory_mapping.c cpu: Turn cpu_get_memory_mapping() into a CPUState hook 2013-06-11 18:03:35 +02:00
cc_helper_template.h
cc_helper.c target-i386/helper: remove DF macro 2013-06-15 17:50:21 +00:00
cpu-qom.h cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks 2013-06-28 13:25:12 +02:00
cpu.c cpu: Change qemu_init_vcpu() argument to CPUState 2013-06-28 13:25:13 +02:00
cpu.h target-i386/helper: remove DF macro 2013-06-15 17:50:21 +00:00
excp_helper.c target-i386/helper: remove EIP macro 2013-06-15 17:50:13 +00:00
fpu_helper.c target-i386: add AES-NI instructions 2013-04-13 13:51:57 +02:00
helper.c cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks 2013-06-28 13:25:12 +02:00
helper.h target-i386: Use mulu2 and muls2 2013-02-27 19:06:28 +00:00
hyperv.c
hyperv.h
int_helper.c target-i386/helper: remove EDX macro 2013-06-15 17:49:10 +00:00
ioport-user.c
kvm_i386.h
kvm-stub.c
kvm.c Fix -machine options accel, kernel_irqchip, kvm_shadow_mem 2013-07-09 13:38:58 -05:00
machine.c target-i386: kvm: save/restore steal time MSR 2013-04-17 23:27:24 -03:00
Makefile.objs
mem_helper.c target-i386/helper: remove EDX macro 2013-06-15 17:49:10 +00:00
misc_helper.c target-i386: fix over 80 chars warnings 2013-06-15 17:50:38 +00:00
ops_sse_header.h target-i386: add AES-NI instructions 2013-04-13 13:51:57 +02:00
ops_sse.h target-i386: add AES-NI instructions 2013-04-13 13:51:57 +02:00
seg_helper.c target-i386: fix over 80 chars warnings 2013-06-15 17:50:38 +00:00
shift_helper_template.h
smm_helper.c target-i386/helper: remove EDI macro 2013-06-15 17:50:05 +00:00
svm_helper.c target-i386: fix over 80 chars warnings 2013-06-15 17:50:38 +00:00
svm.h
TODO
topology.h
translate.c target-i386: Fix aflag logic for CODE64 and the 0x67 prefix 2013-05-31 12:51:07 -05:00