qemu/hw/core
Markus Armbruster 25f8dd9659 qdev: Don't exit when running into bad -global
-global lets you set a nice booby-trap for yourself:

    $ qemu-system-x86_64 -nodefaults -S -display none -usb -monitor stdio -global usb-mouse.usb_version=l
    QEMU 2.1.94 monitor - type 'help' for more information
    (qemu) device_add usb-mouse
    Parameter 'usb_version' expects an int64 value or range
    $ echo $?
    1

Not nice.  Until commit 3196270 we even abort()ed.

The same error triggers if you manage to screw up a machine type's
compat_props.  To demonstrate, change HW_COMPAT_2_1's entry to

            .driver   = "usb-mouse",\
            .property = "usb_version",\
            .value    = "1", \

Then run

    $ qemu-system-x86_64 -usb -M pc-i440fx-2.1 -device usb-mouse
    upstream-qemu: -device usb-mouse: Parameter 'usb_version' expects an int64 value or range
    $ echo $?
    1

One of our creatively cruel error messages.

Since this is actually a coding error, we *should* abort() here.
Replace the error by an assertion failure in this case.

But turn the fatal error into a mere warning when the faulty
GlobalProperty comes from the user.  Looks like this:

    $ qemu-system-x86_64 -nodefaults -S -display none -usb -monitor stdio -global usb-mouse.usb_version=l
    QEMU 2.1.94 monitor - type 'help' for more information
    (qemu) device_add usb-mouse
    Warning: global usb-mouse.usb_version=l ignored (Parameter 'usb_version' expects an int64 value or range)
    (qemu)

This is consistent with how we handle similarly unusable -global in
qdev_prop_check_globals().

You could argue that the error should make device_add fail.  Would be
harder, because we're running within TypeInfo's instance_post_init()
method device_post_init(), which can't fail.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
2015-02-26 12:42:18 +01:00
..
empty_slot.c
fw-path-provider.c fw_cfg: fix typos in comments: patch -> path 2015-02-10 09:27:19 +03:00
hotplug.c
irq.c
loader.c hmp: Name HMP info handler functions hmp_info_SUBCOMMAND() 2015-02-18 11:58:50 +01:00
machine.c hw/machine: added machine_usb wrapper 2015-01-08 17:32:27 +00:00
Makefile.objs sysbus: Add new platform bus helper device 2014-11-04 23:26:14 +01:00
nmi.c
null-machine.c
platform-bus.c sysbus: Add new platform bus helper device 2014-11-04 23:26:14 +01:00
ptimer.c vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
qdev-properties-system.c net: don't use set/get_pointer() in set/get_netdev() 2014-12-19 13:17:02 +00:00
qdev-properties.c qdev: Don't exit when running into bad -global 2015-02-26 12:42:18 +01:00
qdev.c qdev: Don't exit when running into bad -global 2015-02-26 12:42:18 +01:00
stream.c
sysbus.c
uboot_image.h