qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 10/15] hw/pci-host/i440fx: Make MemoryRegion pointers accessi


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 10/15] hw/pci-host/i440fx: Make MemoryRegion pointers accessible as properties
Date: Mon, 12 Jun 2023 12:19:20 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.2

On 11/6/23 12:34, Bernhard Beschow wrote:
The goal is to eliminate i440fx_init() which is a legacy init function. This
neccessitates the memory regions to be properties, like in Q35, which will be
assigned in board code.

Since i440fx needs different PCI devices in Xen mode, and since i440fx shall
be self-contained, the PCI device will be created during realization of the
host. Thus the pointers need to be moved to the host structure to be usable as
properties.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
  include/hw/pci-host/i440fx.h |  3 ---
  hw/pci-host/i440fx.c         | 44 ++++++++++++++++++++++++++----------
  2 files changed, 32 insertions(+), 15 deletions(-)


@@ -214,12 +220,25 @@ static void i440fx_pcihost_get_pci_hole64_end(Object 
*obj, Visitor *v,
static void i440fx_pcihost_initfn(Object *obj)
  {
+    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
      PCIHostState *phb = PCI_HOST_BRIDGE(obj);
memory_region_init_io(&phb->conf_mem, obj, &pci_host_conf_le_ops, phb,
                            "pci-conf-idx", 4);
      memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, phb,
                            "pci-conf-data", 4);
+
+    object_property_add_link(obj, PCI_HOST_PROP_RAM_MEM, TYPE_MEMORY_REGION,
+                             (Object **) &s->ram_memory,
+                             qdev_prop_allow_set_link_before_realize, 0);
+
+    object_property_add_link(obj, PCI_HOST_PROP_PCI_MEM, TYPE_MEMORY_REGION,
+                             (Object **) &s->pci_address_space,
+                             qdev_prop_allow_set_link_before_realize, 0);
+
+    object_property_add_link(obj, PCI_HOST_PROP_SYSTEM_MEM, TYPE_MEMORY_REGION,
+                             (Object **) &s->system_memory,
+                             qdev_prop_allow_set_link_before_realize, 0);

I wonder why we can't simply use device_class_set_props() in i440fx_pcihost_class_init().

Anyhow,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]