From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF1jL-00013G-C1 for qemu-devel@nongnu.org; Tue, 03 Apr 2012 07:17:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SF1jE-0003FE-Mz for qemu-devel@nongnu.org; Tue, 03 Apr 2012 07:16:54 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:59641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF1jE-00038a-EK for qemu-devel@nongnu.org; Tue, 03 Apr 2012 07:16:48 -0400 Received: by mail-pz0-f46.google.com with SMTP id z9so4190452dad.33 for ; Tue, 03 Apr 2012 04:16:45 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 3 Apr 2012 13:15:39 +0200 Message-Id: <1333451753-3550-12-git-send-email-pbonzini@redhat.com> In-Reply-To: <1333451753-3550-1-git-send-email-pbonzini@redhat.com> References: <1333451753-3550-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 11/25] qdev: pick global properties from superclasses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, afaerber@suse.de In qdev, each bus in practice identified an abstract superclass, but this was mostly hidden. In QOM, instead, these abstract classes are explicit so we can move bus properties there. This patch moves global bus properties, an obscure feature when used with the command-line which is actually useful and used when used by backwards-compatible machine types. Signed-off-by: Paolo Bonzini --- hw/pc_piix.c | 12 ++++++------ hw/qdev-properties.c | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/hw/pc_piix.c b/hw/pc_piix.c index fadca4c..8bd6482 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -460,7 +460,7 @@ static QEMUMachine pc_machine_v0_13 = { .property = "rombar", .value = stringify(0), },{ - .driver = "PCI", + .driver = TYPE_PCI_DEVICE, .property = "command_serr_enable", .value = "off", },{ @@ -520,7 +520,7 @@ static QEMUMachine pc_machine_v0_12 = { .property = "rombar", .value = stringify(0), },{ - .driver = "PCI", + .driver = TYPE_PCI_DEVICE, .property = "command_serr_enable", .value = "off", },{ @@ -584,11 +584,11 @@ static QEMUMachine pc_machine_v0_11 = { .property = "ver", .value = "0.11", },{ - .driver = "PCI", + .driver = TYPE_PCI_DEVICE, .property = "rombar", .value = stringify(0), },{ - .driver = "PCI", + .driver = TYPE_PCI_DEVICE, .property = "command_serr_enable", .value = "off", },{ @@ -664,11 +664,11 @@ static QEMUMachine pc_machine_v0_10 = { .property = "ver", .value = "0.10", },{ - .driver = "PCI", + .driver = TYPE_PCI_DEVICE, .property = "rombar", .value = stringify(0), },{ - .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 85897c7..a9276f9 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -1101,17 +1101,20 @@ void qdev_prop_register_global_list(GlobalProperty *props) 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 && - strcmp(qdev_get_bus_info(dev)->name, prop->driver) != 0) { - continue; - } - if (qdev_prop_parse(dev, prop->property, prop->value) != 0) { - exit(1); + ObjectClass *class = object_get_class(OBJECT(dev)); + + do { + GlobalProperty *prop; + QTAILQ_FOREACH(prop, &global_props, next) { + if (strcmp(object_class_get_name(class), prop->driver) != 0) { + continue; + } + if (qdev_prop_parse(dev, prop->property, prop->value) != 0) { + exit(1); + } } - } + class = object_class_get_parent(class); + } while (class); } static int qdev_add_one_global(QemuOpts *opts, void *opaque) -- 1.7.9.3