From: Anthony Liguori <aliguori@us.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Wanpeng Li <liwp@linux.vnet.ibm.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, Andreas Faerber <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 04/14] qdev: don't allow globals to be set by bus name
Date: Tue, 01 May 2012 15:46:10 -0500 [thread overview]
Message-ID: <4FA04B92.3080200@us.ibm.com> (raw)
In-Reply-To: <4FA04974.30503@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 900 bytes --]
On 05/01/2012 03:37 PM, Paolo Bonzini wrote:
> Il 01/05/2012 20:18, Anthony Liguori ha scritto:
>> This is technically a compatibility breaker. However:
>>
>> 1) libvirt does not rely on this (it always uses the driver name)
>>
>> 2) This behavior isn't actually documented anywhere (the docs just say driver).
>>
>> 3) I suspect there are less than three people on earth that even know this is
>> possible (minus the people reading this message).
>>
>> So I think we can safely break it :-)
>
> Does this work with compat properties set on a bus?
No :-(
This is pretty easy to fix though. The attached should do the trick, I'll
update and send out.
Even if it does,
> perhaps it's better to avoid the cleverness and wait for my series that
> moves bus properties to the appropriate abstract superclass.
This series does that FWIW (patch 6/14).
Regards,
Anthony Liguori
>
> Paolo
>
[-- Attachment #2: foo --]
[-- Type: text/plain, Size: 1409 bytes --]
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 6a75718..be809db 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -378,7 +378,7 @@ static QEMUMachine pc_machine_v1_1 = {
.property = "vapic",\
.value = "off",\
},{\
- .driver = "USB",\
+ .driver = TYPE_USB_DEVICE,\
.property = "full-path",\
.value = "no",\
}
@@ -451,7 +451,7 @@ static QEMUMachine pc_machine_v0_14 = {
#define PC_COMPAT_0_13 \
PC_COMPAT_0_14,\
{\
- .driver = "PCI",\
+ .driver = TYPE_PCI_DEVICE,\
.property = "command_serr_enable",\
.value = "off",\
},{\
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 0c6dade..ddd7b25 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -1158,10 +1158,14 @@ void qdev_prop_set_globals(DeviceState *dev)
GlobalProperty *prop;
QTAILQ_FOREACH(prop, &global_props, next) {
- if (strcmp(object_get_typename(OBJECT(dev)), prop->driver) != 0) {
+ Object *obj;
+
+ obj = object_dynamic_cast(OBJECT(dev), prop->driver);
+ if (obj == NULL) {
continue;
}
- if (qdev_prop_parse(dev, prop->property, prop->value) != 0) {
+
+ if (qdev_prop_parse(DEVICE(obj), prop->property, prop->value) != 0) {
exit(1);
}
}
next prev parent reply other threads:[~2012-05-01 20:47 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-01 18:18 [Qemu-devel] [PATCH 0/14] qom: convert busses to QOM (v2) Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 01/14] qdev: fix adding of ptr properties Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 02/14] object: add object_property_foreach Anthony Liguori
2012-05-01 19:02 ` Andreas Färber
2012-05-01 18:18 ` [Qemu-devel] [PATCH 03/14] qdev: add qdev_add_properties Anthony Liguori
2012-05-01 19:05 ` Andreas Färber
2012-05-01 20:37 ` Anthony Liguori
2012-05-01 20:43 ` Andreas Färber
2012-05-01 20:48 ` Anthony Liguori
2012-05-01 20:57 ` Peter Maydell
2012-05-01 22:01 ` Anthony Liguori
2012-05-01 22:12 ` Paolo Bonzini
2012-05-01 22:23 ` Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 04/14] qdev: don't allow globals to be set by bus name Anthony Liguori
2012-05-01 20:37 ` Paolo Bonzini
2012-05-01 20:46 ` Anthony Liguori [this message]
2012-05-01 21:47 ` Paolo Bonzini
2012-05-01 22:18 ` Andreas Färber
2012-05-01 22:23 ` Anthony Liguori
2012-05-01 22:18 ` Anthony Liguori
2012-05-02 6:32 ` Paolo Bonzini
2012-05-01 18:18 ` [Qemu-devel] [PATCH 05/14] qdev: use wrapper for qdev_get_path Anthony Liguori
2012-05-01 18:36 ` Anthony Liguori
2012-05-02 12:35 ` Gerd Hoffmann
2012-05-01 18:18 ` [Qemu-devel] [PATCH 06/14] qdev: move properties from businfo to base class instance init Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 07/14] qdev: fix info qtree/qdm Anthony Liguori
2012-05-02 7:14 ` Paolo Bonzini
2012-05-01 18:18 ` [Qemu-devel] [PATCH 08/14] qdev: convert busses to QEMU Object Model Anthony Liguori
2012-05-01 19:31 ` Andreas Färber
2012-05-01 20:40 ` Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object (v2) Anthony Liguori
2012-05-01 19:47 ` Andreas Färber
2012-05-01 18:18 ` [Qemu-devel] [PATCH 10/14] qbus: move get_dev_path to DeviceState Anthony Liguori
2012-05-02 7:15 ` Paolo Bonzini
2012-05-01 18:18 ` [Qemu-devel] [PATCH 11/14] qbus: move get_fw_dev_path to DeviceClass Anthony Liguori
2012-05-01 19:34 ` Andreas Färber
2012-05-01 22:24 ` Anthony Liguori
2012-05-01 22:36 ` Andreas Färber
2012-05-02 7:22 ` Paolo Bonzini
2012-05-01 18:18 ` [Qemu-devel] [PATCH 12/14] qbus: move print_dev " Anthony Liguori
2012-05-01 19:37 ` Andreas Färber
2012-05-01 18:18 ` [Qemu-devel] [PATCH 13/14] qbus: make child devices links Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 14/14] qbus: initialize in standard way Anthony Liguori
2012-05-02 8:34 ` Paolo Bonzini
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=4FA04B92.3080200@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=afaerber@suse.de \
--cc=liwp@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).