[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/15] qdev: fix the order compat and global properti
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 03/15] qdev: fix the order compat and global properties are applied |
Date: |
Mon, 17 Jul 2017 15:50:39 -0300 |
From: Greg Kurz <address@hidden>
The current code recursively applies global properties from child up to
parent types. This can cause properties passed with the -global option to
be silently overridden by internal compat properties.
This is exactly what happened with virtio-*-pci drivers since commit:
"9a4c0e220d8a hw/virtio-pci: fix virtio behaviour"
Passing -device virtio-blk-pci.disable-modern=off had no effect on 2.6
machine types because the internal virtio-pci.disable-modern=on compat
property always prevailed.
A workaround for this was included with commit 0bcba41f ("machine:
Convert abstract typename on compat_props to subclass names").
This patch fixes the issue properly by reversing the logic: we now go
through the global property list and, for each property, we check if it
is applicable to the device.
This results in compat properties being applied first, in the order they
appear in the HW_COMPAT_* macros, followed by global properties, in the
order they appear on the command line.
Signed-off-by: Greg Kurz <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Reviewed-by: Halil Pasic <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/core/qdev-properties.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index dcecdf0..58a8f92 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1149,8 +1149,7 @@ int qdev_prop_check_globals(void)
return ret;
}
-static void qdev_prop_set_globals_for_type(DeviceState *dev,
- const char *typename)
+void qdev_prop_set_globals(DeviceState *dev)
{
GList *l;
@@ -1158,7 +1157,7 @@ static void qdev_prop_set_globals_for_type(DeviceState
*dev,
GlobalProperty *prop = l->data;
Error *err = NULL;
- if (strcmp(typename, prop->driver) != 0) {
+ if (object_dynamic_cast(OBJECT(dev), prop->driver) == NULL) {
continue;
}
prop->used = true;
@@ -1176,16 +1175,6 @@ static void qdev_prop_set_globals_for_type(DeviceState
*dev,
}
}
-void qdev_prop_set_globals(DeviceState *dev)
-{
- ObjectClass *class = object_get_class(OBJECT(dev));
-
- do {
- qdev_prop_set_globals_for_type(dev, object_class_get_name(class));
- class = object_class_get_parent(class);
- } while (class);
-}
-
/* --- 64bit unsigned int 'size' type --- */
static void get_size(Object *obj, Visitor *v, const char *name, void *opaque,
--
2.9.4
- [Qemu-devel] [PULL 00/15] x86 and machine queue for 2.10 soft freeze, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 01/15] device-crash-test: Fix regexp on whitelist, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 02/15] tests: Test case for object_resolve_path*(), Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 03/15] qdev: fix the order compat and global properties are applied,
Eduardo Habkost <=
- [Qemu-devel] [PULL 04/15] test-qdev-global-props: Test global property ordering, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 07/15] fw_cfg: switch fw_cfg_find() to locate the fw_cfg device by type rather than path, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 05/15] Revert "machine: Convert abstract typename on compat_props to subclass names", Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 08/15] fw_cfg: move qdev_init_nofail() from fw_cfg_init1() to callers, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 06/15] qom: Fix ambiguous path detection when ambiguous=NULL, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 09/15] fw_cfg: move QOM type defines and fw_cfg types into fw_cfg.h, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 10/15] i386: expose "TCGTCGTCGTCG" in the 0x40000000 CPUID leaf, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 12/15] i386: add Skylake-Server cpu model, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 13/15] tests: Simplify abstract-interfaces check with a helper, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 11/15] i386: Update comment about XSAVES on Skylake-Client, Eduardo Habkost, 2017/07/17