qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: thuth@redhat.com, ehabkost@redhat.com, armbru@redhat.com,
	qemu-stable@nongnu.org, stefanha@redhat.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH v3 7/7] Revert "qdev: Use qdev_get_device_class() for -device <type>, help"
Date: Thu, 24 Sep 2015 20:57:22 +0200	[thread overview]
Message-ID: <1443121042-3409-8-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1443121042-3409-1-git-send-email-armbru@redhat.com>

This reverts commit 31bed5509dfcbdfc293154ce81086a4dbd7a80b6.

The reverted commit changed qdev_device_help() to reject abstract
devices and devices that have cannot_instantiate_with_device_add_yet
set, to fix crash bugs like -device x86_64-cpu,help.

Rejecting abstract devices makes sense: they're purely internal, and
the implementation of the help feature can't cope with them.

Rejecting non-pluggable devices makes less sense: even though you
can't use them with -device, the help may still be useful elsewhere,
for instance with -global.  This is a regression: -device FOO,help
used to help even for FOO that aren't pluggable.

The previous two commits fixed the crash bug at a lower layer, so
reverting this one is now safe.  Fixes the -device FOO,help
regression, except for the broken devices marked
cannot_even_create_with_object_new_yet.  For those, the error message
is improved.

Example of a device where the regression is fixed:

    $ qemu-system-x86_64 -device PIIX4_PM,help
    PIIX4_PM.command_serr_enable=bool (on/off)
    PIIX4_PM.multifunction=bool (on/off)
    PIIX4_PM.rombar=uint32
    PIIX4_PM.romfile=str
    PIIX4_PM.addr=int32 (Slot and optional function number, example: 06.0 or 06)
    PIIX4_PM.memory-hotplug-support=bool
    PIIX4_PM.acpi-pci-hotplug-with-bridge-support=bool
    PIIX4_PM.s4_val=uint8
    PIIX4_PM.disable_s4=uint8
    PIIX4_PM.disable_s3=uint8
    PIIX4_PM.smb_io_base=uint32

Example of a device where it isn't fixed:

    $ qemu-system-x86_64 -device host-x86_64-cpu,help
    Can't list properties of device 'host-x86_64-cpu'

Both failed with "Parameter 'driver' expects pluggable device type"
before.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qdev-monitor.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/qdev-monitor.c b/qdev-monitor.c
index eb7aef2..1cadefb 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -237,9 +237,12 @@ int qdev_device_help(QemuOpts *opts)
         return 0;
     }
 
-    qdev_get_device_class(&driver, &local_err);
-    if (local_err) {
-        goto error;
+    if (!object_class_by_name(driver)) {
+        const char *typename = find_typename_by_alias(driver);
+
+        if (typename) {
+            driver = typename;
+        }
     }
 
     prop_list = qmp_device_list_properties(driver, &local_err);
-- 
2.4.3

      parent reply	other threads:[~2015-09-24 18:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 18:57 [Qemu-devel] [PATCH v3 0/7] Fix device introspection regressions Markus Armbruster
2015-09-24 18:57 ` [Qemu-devel] [PATCH v3 1/7] tests: Fix how qom-test is run Markus Armbruster
2015-09-24 18:57 ` [Qemu-devel] [PATCH v3 2/7] libqtest: Clean up unused QTestState member sigact_old Markus Armbruster
2015-09-24 18:57 ` [Qemu-devel] [PATCH v3 3/7] libqtest: New hmp() & friends Markus Armbruster
2015-09-24 18:57 ` [Qemu-devel] [PATCH v3 4/7] device-introspect-test: New, covering device introspection Markus Armbruster
2015-09-25 10:17   ` Thomas Huth
2015-09-25 10:18     ` Andreas Färber
2015-09-25 14:13       ` Markus Armbruster
2015-09-24 18:57 ` [Qemu-devel] [PATCH v3 5/7] qmp: Fix device-list-properties not to crash for abstract device Markus Armbruster
2015-09-24 18:57 ` [Qemu-devel] [PATCH v3 6/7] qdev: Protect device-list-properties against broken devices Markus Armbruster
2015-09-24 19:25   ` Eduardo Habkost
2015-09-25  6:07     ` Markus Armbruster
2015-09-25 13:38   ` Thomas Huth
2015-09-25 14:17     ` Markus Armbruster
2015-09-25 18:21       ` Thomas Huth
2015-09-28  8:11         ` Markus Armbruster
2015-09-28  8:15           ` Andreas Färber
2015-09-28  8:38             ` Paolo Bonzini
2015-09-28  8:37           ` Paolo Bonzini
2015-09-28 14:17             ` Markus Armbruster
2015-09-28 14:25               ` Paolo Bonzini
2015-09-28  9:17           ` Thomas Huth
2015-09-28  9:30             ` Peter Maydell
2015-09-28 14:35             ` Markus Armbruster
2015-09-28 14:44               ` Peter Maydell
2015-09-28 19:36               ` Markus Armbruster
2015-09-28 19:40                 ` Peter Maydell
2015-09-29  8:05                   ` Markus Armbruster
2015-09-29 12:38                     ` Paolo Bonzini
2015-09-24 18:57 ` Markus Armbruster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443121042-3409-8-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=afaerber@suse.de \
    --cc=ehabkost@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).