summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* qerror: Eliminate QERR_DEVICE_NOT_FOUNDMarkus Armbruster2015-06-2210-29/+52
| | | | | | | | | | | | | | | | | | Error classes other than ERROR_CLASS_GENERIC_ERROR should not be used in new code. Hiding them in QERR_ macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch: @@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E) Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* vl: Use error_report() for --display errorsMarkus Armbruster2015-06-221-8/+8
| | | | | | | | | | | | | | | | Results in nicer error messages. Before this patch: Invalid GTK option string: gtk,lirum-larum After: qemu-system-x86_64: -display gtk,lirum-larum: Invalid GTK option string Of course, the thing ought to use QemuOpts instead of parsing by hand. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* vl: Avoid qerror_report() outside QMP command handlersMarkus Armbruster2015-06-221-14/+9
| | | | | | | | | | | qerror_report() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace by error_report() in initial startup helpers parse_sandbox() and parse_add_fd(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* QemuOpts: Wean off qerror_report_err()Markus Armbruster2015-06-2218-62/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qerror_report_err() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. The only remaining user in qemu-option.c is qemu_opts_parse(). Is it used in QMP context? If not, we can simply replace qerror_report_err() by error_report_err(). The uses in qemu-img.c, qemu-io.c, qemu-nbd.c and under tests/ are clearly not in QMP context. The uses in vl.c aren't either, because the only QMP command handlers there are qmp_query_status() and qmp_query_machines(), and they don't call it. Remaining uses: * drive_def(): Command line -drive and such, HMP drive_add and pci_add * hmp_chardev_add(): HMP chardev-add * monitor_parse_command(): HMP core * tmp_config_parse(): Command line -tpmdev * net_host_device_add(): HMP host_net_add * net_client_parse(): Command line -net and -netdev * qemu_global_option(): Command line -global * vnc_parse_func(): Command line -display, -vnc, default display, HMP change, QMP change. Bummer. * qemu_pci_hot_add_nic(): HMP pci_add * usb_net_init(): Command line -usbdevice, HMP usb_add Propagate errors through qemu_opts_parse(). Create a convenience function qemu_opts_parse_noisily() that passes errors to error_report_err(). Switch all non-QMP users outside tests to it. That leaves vnc_parse_func(). Propagate errors through it. Since I'm touching it anyway, rename it to vnc_parse(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* qdev-monitor: Propagate errors through qdev_device_add()Markus Armbruster2015-06-223-24/+21
| | | | | | | | Also polish an error message while I'm touching the line anyway, Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de>
* qdev-monitor: Propagate errors through set_property()Markus Armbruster2015-06-221-3/+3
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de>
* qdev-monitor: Convert qbus_find() to ErrorMarkus Armbruster2015-06-222-15/+20
| | | | | | | | | | | | | | As usual, the conversion breaks printing explanatory messages after the error: actual printing of the error gets delayed, so the explanations precede rather than follow it. Pity. Disable them for now. See also commit 7216ae3. While there, eliminate QERR_BUS_NOT_FOUND, and clean up unusual spelling in the error message. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qdev-monitor: Fix check for full busMarkus Armbruster2015-06-221-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Property bus has always been too screwed up to be really usable for values other than plain bus IDs. This just fixes a bug that crept in in commit 1395af6 "qdev: add a maximum device allowed field for the bus." It doesn't always fail when it should: $ qemu-system-x86_64 -nodefaults -device virtio-serial-pci -device virtio-rng-device,bus=pci.0/virtio-serial-pci/virtio-bus Happily plugs the virtio-rng-device into the virtio-bus provided by virtio-serial-pci, even though its only slot is already occupied by a virtio-serial-device. And sometimes fails when it shouldn't: $ qemu-system-x86_64 -nodefaults -device virtio-serial-pci -device virtserialport,bus=virtio-bus/virtio-serial-device Yes, the virtio-bus is full, but the virtio-serial-bus provided by virtio-serial-device isn't, and that's the one we're trying to use. Root cause: we check "bus full" when we resolve the first element of the path. That's the correct one only when it's also the last one. Fix by moving the "bus full" check to right before we return a bus. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qdev-monitor: Stop error avalanche in qbus_find_recursive()Markus Armbruster2015-06-221-24/+40
| | | | | | | | | | | | | | | | | | | | | Reproducer: $ qemu-system-x86_64 -nodefaults -device virtio-rng-pci -device virtio-rng-pci -device virtio-rng-device,bus=virtio-bus qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 'virtio-bus' is full qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 'virtio-bus' is full qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 'virtio-bus' not found qbus_find_recursive() reports the "is full" error itself, and leaves reporting "not found" to its caller. The result is confusion. Write it a function contract that permits leaving all error reporting to the caller, and implement it. Update callers to detect and report "is full". Screwed up when commit 1395af6 added the max_dev limit and the "is full" error condition to enforce it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* disas: Remove uses of CPU envPeter Crosthwaite2015-06-2221-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | disas does not need to access the CPU env for any reason. Change the APIs to accept CPU pointers instead. Small change pattern needs to be applied to all target translate.c. This brings us closer to making disas.o a common-obj and less architecture specific in general. Cc: Richard Henderson <rth@twiddle.net> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Michael Walle <michael@walle.cc> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Leon Alrae <leon.alrae@imgtec.com> Cc: Jia Liu <proljc@gmail.com> Cc: Alexander Graf <agraf@suse.de> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Cc: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* monitor: Split mon_get_cpu fn to remove ENV_GET_CPUPeter Crosthwaite2015-06-221-36/+29
| | | | | | | | | | | | | | | The monitor currently has one helper, mon_get_cpu() which will return an env pointer. The target specific users of this API want an env, but all the target agnostic users really just want the cpu pointer. These users then need to use the target-specifically defined ENV_GET_CPU to navigate back up to the CPU from the ENV. Split the API for the two uses cases to remove all need for ENV_GET_CPU. Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* monitor: Fix failure path for "S" argumentBandan Das2015-06-221-1/+1
| | | | | | | | | Since the "S" argument type is only used with the "?" flag, the bug can't bite. Signed-off-by: Bandan Das <bsd@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* monitor: Point to "help" command on syntax errorBandan Das2015-06-221-0/+2
| | | | | | | | | | When a command fails due to incorrect syntax or input, suggest using the "help" command to get more information about the command. This is only applicable for HMP. Signed-off-by: Bandan Das <bsd@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* monitor: cleanup parsing of cmd name and cmd argumentsBandan Das2015-06-221-40/+56
| | | | | | | | | | | | | | | There's too much going on in monitor_parse_command(). Split up the arguments parsing bits into a separate function monitor_parse_arguments(). Let the original function check for command validity and sub-commands if any and return data (*cmd) that the newly introduced function can process and return a QDict. Also, pass a pointer to the cmdline to track current parser location. Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Bandan Das <bsd@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* monitor: remove debug printsBandan Das2015-06-221-19/+1
| | | | | | | | | | | The preferred solution is to use tracepoints and there is good chance of bitrot with the debug prints not being enabled at compile time. Remove them. Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Bandan Das <bsd@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* qobject: Use 'bool' inside qdictEric Blake2015-06-226-28/+28
| | | | | | | | | | | | | Now that qbool is fixed, let's fix getting and setting a bool value to a qdict member to also use C99 bool rather than int. I audited all callers to ensure that the changed return type will not cause any changed semantics. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* qobject: Use 'bool' for qboolEric Blake2015-06-2216-38/+39
| | | | | | | | | | | | We require a C99 compiler, so let's use 'bool' instead of 'int' when dealing with boolean values. There are few enough clients to fix them all in one pass. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Alberto Garcia <berto@igalia.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' ↵Peter Maydell2015-06-2228-125/+837
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging QOM infrastructure fixes and device conversions * Changes to name string ownership for alias properties * Improvements around enum properties * Cleanups around -object handling * New helper functions * Cleanups of qdev init helper functions * Add path argument to qom-tree script * QTest cleanup to use new qtest_add_data_func() consistently # gpg: Signature made Fri Jun 19 18:14:38 2015 BST using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: qdev: Un-deprecate qdev_init_nofail() qdev: Deprecated qdev_init() is finally unused, drop qom: Don't pass string table to object_get_enum() function qom: Add an object_property_add_enum() helper function qom: Make enum string tables const-correct qom: Add object_new_with_props() / object_new_withpropv() helpers qom: Add helper function for getting user objects root vl: Create (most) objects before creating chardev backends doc: Document user creatable object types in help text backends: Fix typename of 'policy' enum property in hostmem obj scripts: Add support for path as argument of qom-tree tests: Use qtest_add_data_func() consistently qdev: Free property names after registering gpio aliases qom: strdup() target property name on object_property_add_alias() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * qdev: Un-deprecate qdev_init_nofail()Markus Armbruster2015-06-191-2/+2
| | | | | | | | | | | | | | | | It's a perfectly sensible helper function. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Deprecated qdev_init() is finally unused, dropMarkus Armbruster2015-06-192-33/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qdev_init() is a wrapper around setting property "realized" to true, plus error handling that passes errors to qerror_report_err(). qerror_report_err() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. All code has been modernized to avoid qdev_init() and its inappropriate error handling. We can finally drop it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qom: Don't pass string table to object_get_enum() functionDaniel P. Berrange2015-06-195-19/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that properties can be explicitly registered as an enum type, there is no need to pass the string table to the object_get_enum() function. The object property registration already has a pointer to the string table. In changing this method signature, the hostmem backend object has to be converted to use the new enum property registration code, which simplifies it somewhat. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qom: Add an object_property_add_enum() helper functionDaniel P. Berrange2015-06-193-0/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A QOM property can be parsed as enum using the visit_type_enum() helper function, but this forces callers to use the more complex generic object_property_add() method when registering it. It also requires that users of that object have access to the string map when they want to read the property value. This patch introduces a specialized object_property_add_enum() method which simplifies the use of enum properties, so the setters/getters directly get passed the int value. typedef enum { MYDEV_TYPE_FROG, MYDEV_TYPE_ALLIGATOR, MYDEV_TYPE_PLATYPUS, MYDEV_TYPE_LAST } MyDevType; Then provide a table of enum <-> string mappings static const char *const mydevtypemap[MYDEV_TYPE_LAST + 1] = { [MYDEV_TYPE_FROG] = "frog", [MYDEV_TYPE_ALLIGATOR] = "alligator", [MYDEV_TYPE_PLATYPUS] = "platypus", [MYDEV_TYPE_LAST] = NULL, }; Assuming an object struct of typedef struct { Object parent_obj; MyDevType devtype; ...other fields... } MyDev; The property can then be registered as follows: static int mydev_prop_get_devtype(Object *obj, Error **errp G_GNUC_UNUSED) { MyDev *dev = MYDEV(obj); return dev->devtype; } static void mydev_prop_set_devtype(Object *obj, int value, Error **errp G_GNUC_UNUSED) { MyDev *dev = MYDEV(obj); dev->devtype = value; } object_property_add_enum(obj, "devtype", mydevtypemap, "MyDevType", mydev_prop_get_devtype, mydev_prop_set_devtype, NULL); Note there is no need to check the range of 'value' in the setter, because the string->enum conversion code will have already done that and reported an error as required. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qom: Make enum string tables const-correctDaniel P. Berrange2015-06-1910-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The enum string table parameters in various QOM/QAPI methods are declared 'const char *strings[]'. This results in const warnings if passed a variable that was declared as static const char * const strings[] = { .... }; Add the extra const annotation to the parameters, since neither the string elements, nor the array itself should ever be modified. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qom: Add object_new_with_props() / object_new_withpropv() helpersDaniel P. Berrange2015-06-196-1/+434
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is reasonably common to want to create an object, set a number of properties, register it in the hierarchy and then mark it as complete (if a user creatable type). This requires quite a lot of error prone, verbose, boilerplate code to achieve. First a pair of functions object_set_props() / object_set_propv() are added which allow for a list of objects to be set in one single API call. Then object_new_with_props() / object_new_with_propv() constructors are added which simplify the sequence of calls to create an object, populate properties, register in the object composition tree and mark the object complete, into a single method call. Usage would be: Error *err = NULL; Object *obj; obj = object_new_with_propv(TYPE_MEMORY_BACKEND_FILE, object_get_objects_root(), "hostmem0", &err, "share", "yes", "mem-path", "/dev/shm/somefile", "prealloc", "yes", "size", "1048576", NULL); Note all property values are passed in string form and will be parsed into their required data types, using normal QOM semantics for parsing from string format. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qom: Add helper function for getting user objects rootDaniel P. Berrange2015-06-195-7/+22
| | | | | | | | | | | | | | | | | | | | | | Add object_get_objects_root() function which is a convenience for obtaining the Object * located at /objects in the object composition tree. Convert existing code over to use the new API where appropriate. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * vl: Create (most) objects before creating chardev backendsDaniel P. Berrange2015-06-191-1/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some types of object must be created before chardevs, other types of object must be created after chardevs. As such there is no option but to create objects in two phases. This takes the decision to create as many object types as possible right away before anyother backends are created, and only delay creation of those few which have an explicit dependency on the chardevs. Hopefully the set which need delaying will remain small over time. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * doc: Document user creatable object types in help textDaniel P. Berrange2015-06-191-16/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | The QEMU help for -object is essentially useless, just giving users the generic syntax. Move it down into its own section and introduce a nested table where each user creatable object can be documented. The existing memory-backend-file, rng-random and rng-egd object types are documented. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * backends: Fix typename of 'policy' enum property in hostmem objDaniel P. Berrange2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | The 'policy' property was being registered with a typename of 'str', but it is in fact an enum of the 'HostMemPolicy' type. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * scripts: Add support for path as argument of qom-treeMartin Cerveny2015-06-191-2/+7
| | | | | | | | | | | | | | Add processing of optional argument path as "tree base". Signed-off-by: Martin Cerveny <M.Cerveny@computer.org> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * tests: Use qtest_add_data_func() consistentlyAndreas Färber2015-06-196-30/+23
| | | | | | | | | | | | | | | | | | | | | | Replace uses of g_test_add_data_func() for QTest test cases. It is still valid to use it for any non-QTest test cases, which are not run for multiple target binaries. Suggested-by: John Snow <jsnow@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Free property names after registering gpio aliasesEduardo Habkost2015-06-191-0/+2
| | | | | | | | | | | | | | | | | | | | Now that object_property_add_alias() strdup()s target_name, we can free the property names in qdev_pass_gpios(). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qom: strdup() target property name on object_property_add_alias()Eduardo Habkost2015-06-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | With this, object_property_add_alias() callers can safely free the target property name, like what already happens with the 'name' argument to all object_property_add*() functions. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* | Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell2015-06-2216-23/+485
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * i8254 security fix * Avoid long 100% CPU wait after restarting guests that use the periodic timer * Fixes for access clamping (WinXP, MIPS) * wixl/.msi support for qemu-ga on Windows # gpg: Signature made Fri Jun 19 11:30:53 2015 BST using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: exec: clamp accesses against the MemoryRegionSection exec: do not clamp accesses to MMIO regions mc146818rtc: Reset the periodic timer on load qemu-timer: Call clock reset notifiers on forward jumps tests: virtio-scsi: Add test for unaligned WRITE SAME tests: virtio-scsi: Move start/stop to individual test functions libqos: Complete virtio device ID definition list libqos: Allow calling guest_free on NULL pointer tests: Link libqos virtio object to virtio-scsi-test i8254: fix out-of-bounds memory access in pit_ioport_read() qemu-ga: Building Windows MSI installation with configure/Makefile qemu-ga: Introduce Windows MSI script qemu-ga: debug printouts to help troubleshoot installation qemu-ga: adding vss-[un]install options qemu-log: Open file for logging when specified Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | exec: clamp accesses against the MemoryRegionSectionPaolo Bonzini2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the clamping was done against the MemoryRegion, address_space_rw was effectively broken if a write spanned multiple sections that are not linear in underlying memory (with the memory not being under an IOMMU). This is visible with the MIPS rc4030 IOMMU, which is implemented as a series of alias memory regions that point to the actual RAM. Tested-by: Hervé Poussineau <hpoussin@reactos.org> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | exec: do not clamp accesses to MMIO regionsPaolo Bonzini2015-06-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is common for MMIO registers to overlap, for example a 4 byte register at 0xcf8 (totally random choice... :)) and a 1 byte register at 0xcf9. If these registers are implemented via separate MemoryRegions, it is wrong to clamp the accesses as the value written would be truncated. Hence for these regions the effects of commit 23820db (exec: Respect as_translate_internal length clamp, 2015-03-16, previously applied as commit c3c1bb99) must be skipped. Tested-by: Hervé Poussineau <hpoussin@reactos.org> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | mc146818rtc: Reset the periodic timer on loadPaul Donohue2015-06-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When loading a VM from a snapshot or migration, clock changes can cause the periodic timer to stall or loop rapidly. qemu-timer has a reset notifier mechanism that is used to avoid timer stalls or loops if the host clock changes while the VM is running when using QEMU_CLOCK_HOST. However, when loading a snapshot or migration, qemu-timer is initialized and fires the reset notifier before mc146818rtc is initialized and has registered its reset handler. In addition, this mechanism isn't used when using QEMU_CLOCK_REALTIME, which might also change when loading a snapshot or migration. To correct that problem, this commit resets the periodic timer after loading from a snapshot or migration if the clock has either jumped backward or has jumped forward by more than the clock jump limit that is used by the reset notifier code in qemu-timer. Signed-off-by: Paul Donohue <qemu-git@PaulSD.com> Message-Id: <20150612141013.GE2749@TopQuark.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | qemu-timer: Call clock reset notifiers on forward jumpsPaul Donohue2015-06-192-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 691a0c9c introduced a mechanism by which QEMU_CLOCK_HOST can notify other parts of the emulator when the host clock has jumped backward. This is used to avoid stalling timers that were scheduled based on the host clock. However, if the host clock jumps forward, then timers that were scheduled based on the host clock may fire rapidly and cause other problems. For example, the mc146818rtc periodic timer will block execution of the VM and consume host CPU while firing every interrupt for the time period that was skipped by the host clock. To correct that problem, this commit fires the reset notification if the host clock jumps forward by more than a hard-coded limit. The limit is currently set to a value of 60 seconds, which should be small enough to prevent excessive timer loops, but large enough to avoid frequent resets in idle VMs. Signed-off-by: Paul Donohue <qemu-git@PaulSD.com> Message-Id: <20150612140845.GD2749@TopQuark.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | tests: virtio-scsi: Add test for unaligned WRITE SAMEFam Zheng2015-06-191-0/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an exercise for virtio-scsi tests using the libqos virtio library. A few common routines are added to facilitate future extensions of the test set. The added test case is a regression test for the bug in d7f4b1999e. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | tests: virtio-scsi: Move start/stop to individual test functionsFam Zheng2015-06-171-6/+22
| | | | | | | | | | | | | | | Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | libqos: Complete virtio device ID definition listFam Zheng2015-06-171-2/+8
| | | | | | | | | | | | | | | Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | libqos: Allow calling guest_free on NULL pointerFam Zheng2015-06-171-0/+3
| | | | | | | | | | | | | | | | | | Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | tests: Link libqos virtio object to virtio-scsi-testFam Zheng2015-06-171-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | i8254: fix out-of-bounds memory access in pit_ioport_read()Petr Matousek2015-06-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due converting PIO to the new memory read/write api we no longer provide separate I/O region lenghts for read and write operations. As a result, reading from PIT Mode/Command register will end with accessing pit->channels with invalid index. Fix this by ignoring read from the Mode/Command register. This is CVE-2015-3214. Reported-by: Matt Tait <matttait@google.com> Fixes: 0505bcdec8228d8de39ab1a02644e71999e7c052 Cc: qemu-stable@nongnu.org Signed-off-by: Petr Matousek <pmatouse@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | qemu-ga: Building Windows MSI installation with configure/MakefileYossi Hindin2015-06-172-1/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New options were added to enable Windows MSI installation package creation: Option --enable-guest-agent-msi, like the name suggests, enables building Windows MSI package for QEMU guest agent; option --disable-guest-agent-msi disables MSI package creation; by default, no MSI package is created Signed-off-by: Yossi Hindin <yhindin@redhat.com> Message-Id: <1430913460-13174-5-git-send-email-yhindin@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | qemu-ga: Introduce Windows MSI scriptYossi Hindin2015-06-171-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | The script enables building Windows MSI installation package on Linux with wixl tool. Signed-off-by: Yossi Hindin <yhindin@redhat.com> Message-Id: <1430913460-13174-4-git-send-email-yhindin@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | qemu-ga: debug printouts to help troubleshoot installationYossi Hindin2015-06-172-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Debug printouts extended, helps installation troubleshooting Signed-off-by: Yossi Hindin <yhindin@redhat.com> Message-Id: <1430913460-13174-3-git-send-email-yhindin@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | qemu-ga: adding vss-[un]install optionsYossi Hindin2015-06-171-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Existing command line options include '-s install' and '-s uninstall'. These options install/uninstall both Windows QEMU GA service and optional VSS COM server. The QEMU GA Windows service allows always-on serving guest agent's QMP commands and VSS COM server enables guest agent integration with Volume Shadow Service. This commit introdices new options '-s vss-install' and '-s vss-uninstall', affecting only GA VSS COM server registration. The new options are useful for registering and unregistering the COM server during MSI installation, upgrade and uninstallation. Signed-off-by: Yossi Hindin <yhindin@redhat.com> Message-Id: <1430913460-13174-2-git-send-email-yhindin@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | qemu-log: Open file for logging when specifiedPranith Kumar2015-06-171-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qemu-log defaults to stderr when there is no '-D' option mentioned on command line. When '-D' option is specified, we also need to specify '-d' option for it to use the specified logfile. When using monitor to enable logging this is troublesome since there will be no '-d' option because of which monitor dumps the logs to stderr. Fix this by opening the log file when '-D' is specified on the command line. Also fix an ancient comment which does not hold true since changing location and log level has now been streamlined. Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> CC: Paolo Bonzini <pbonzini@redhat.com> CC: Luiz Capitulino <lcapitulino@redhat.com> CC: Markus Armbruster <armbru@redhat.com> CC: Peter Maydell <peter.maydell@linaro.org> Message-Id: <1433946024-18439-1-git-send-email-bobby.prani@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | | target-microblaze: Remove dead codeAlistair Francis2015-06-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code is already being run in the mb_cpu_realizefn() function. As PVR registers are preserved on reset this code is not required. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
* | | s3adsp1800: Remove the hardcoded values from the resetAlistair Francis2015-06-211-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the hardcoded values from the machine specific reset function, as the same values are already set in the standard MicroBlaze reset. This also allows the entire reset function to be deleted, as PVR registers are now preserved on reset. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
OpenPOWER on IntegriCloud