Patchwork [v5,3/3] convert pci-host to QOM

login
register
mail settings
Submitter Wanpeng Li
Date Nov. 8, 2012, 5:36 a.m.
Message ID <1352352972-2510-4-git-send-email-liwanp@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/197766/
State New
Headers show

Comments

Wanpeng Li - Nov. 8, 2012, 5:36 a.m.
Take advantage of Andreas's pci-host patchset, add instance_init function
to fully implement convert pci-host to QOM.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 hw/pci_host.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Andreas Färber - Nov. 15, 2012, 12:55 a.m.
Am 08.11.2012 06:36, schrieb Wanpeng Li:
> Take advantage of Andreas's pci-host patchset, add instance_init function
> to fully implement convert pci-host to QOM.
> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> ---
>  hw/pci_host.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci_host.c b/hw/pci_host.c
> index 68e328c..ce6b28f 100644
> --- a/hw/pci_host.c
> +++ b/hw/pci_host.c
> @@ -165,11 +165,20 @@ const MemoryRegionOps pci_host_data_be_ops = {
>      .endianness = DEVICE_BIG_ENDIAN,
>  };
>  
> +static void pci_host_initfn(Object *obj)
> +{
> +    PCIHostState *s = PCI_HOST_BRIDGE(obj);
> +
> +    object_property_add_link(obj, "mmio", "memory-region",
> +                            (Object **)&s->address_space, NULL);

This strikes me as wrong, unless I've overlooked something in the
previous patches. Also the commit message seems outdated.

Please cc me on the next version, I received no response to my question
about i440fx status and just noticed this now.

Regards,
Andreas

> +}
> +
>  static const TypeInfo pci_host_type_info = {
>      .name = TYPE_PCI_HOST_BRIDGE,
>      .parent = TYPE_SYS_BUS_DEVICE,
>      .abstract = true,
>      .instance_size = sizeof(PCIHostState),
> +    .instance_init = pci_host_initfn,
>  };
>  
>  static void pci_host_register_types(void)

Patch

diff --git a/hw/pci_host.c b/hw/pci_host.c
index 68e328c..ce6b28f 100644
--- a/hw/pci_host.c
+++ b/hw/pci_host.c
@@ -165,11 +165,20 @@  const MemoryRegionOps pci_host_data_be_ops = {
     .endianness = DEVICE_BIG_ENDIAN,
 };
 
+static void pci_host_initfn(Object *obj)
+{
+    PCIHostState *s = PCI_HOST_BRIDGE(obj);
+
+    object_property_add_link(obj, "mmio", "memory-region",
+                            (Object **)&s->address_space, NULL);
+}
+
 static const TypeInfo pci_host_type_info = {
     .name = TYPE_PCI_HOST_BRIDGE,
     .parent = TYPE_SYS_BUS_DEVICE,
     .abstract = true,
     .instance_size = sizeof(PCIHostState),
+    .instance_init = pci_host_initfn,
 };
 
 static void pci_host_register_types(void)