diff mbox series

[PATCH-for-10.0,v2,07/13] hw/pci: Propagate bar_at_addr_0_refused to pci_root_bus_new()

Message ID 20241126112212.64524-8-philmd@linaro.org (mailing list archive)
State New
Headers show
Series hw/boards: Remove legacy MachineClass::pci_allow_0_address flag | expand

Commit Message

Philippe Mathieu-Daudé Nov. 26, 2024, 11:22 a.m. UTC
Have pci_root_bus_new() callers set the
'bar_at_addr_0_refused' argument. No logical change.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/pci/pci.h                | 3 ++-
 hw/pci-bridge/pci_expander_bridge.c | 9 ++++++---
 hw/pci-host/gt64120.c               | 2 +-
 hw/pci-host/i440fx.c                | 2 +-
 hw/pci-host/q35.c                   | 2 +-
 hw/pci-host/remote.c                | 2 +-
 hw/pci/pci.c                        | 7 ++++---
 7 files changed, 16 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index b499846083f..f5454db0eb5 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -288,7 +288,8 @@  void pci_root_bus_init(PCIBus *bus, size_t bus_size, DeviceState *parent,
                        bool bar_at_addr_0_refused);
 PCIBus *pci_root_bus_new(DeviceState *parent, const char *name,
                          MemoryRegion *mem, MemoryRegion *io,
-                         uint8_t devfn_min, const char *typename);
+                         uint8_t devfn_min, const char *typename,
+                         bool bar_at_addr_0_refused);
 void pci_root_bus_cleanup(PCIBus *bus);
 void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq,
                   void *irq_opaque, int nirq);
diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index bbf615f544b..d4b472a8305 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -358,15 +358,18 @@  static bool pxb_dev_realize_common(PCIDevice *dev, enum BusType type,
 
     ds = qdev_new(type == CXL ? TYPE_PXB_CXL_HOST : TYPE_PXB_HOST);
     if (type == PCIE) {
-        bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCIE_BUS);
+        bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCIE_BUS,
+                               true);
         bus->flags = parent_bus->flags & ~PCI_BUS_IS_ROOT;
     } else if (type == CXL) {
-        bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_CXL_BUS);
+        bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_CXL_BUS,
+                               true);
         bus->flags = parent_bus->flags & ~PCI_BUS_IS_ROOT;
         bus->flags |= PCI_BUS_CXL;
         PXB_CXL_DEV(dev)->cxl_host_bridge = PXB_CXL_HOST(ds);
     } else {
-        bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS);
+        bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS,
+                               true);
         bus->flags = parent_bus->flags & ~PCI_BUS_IS_ROOT;
         bds = qdev_new("pci-bridge");
         bds->id = g_strdup(dev_name);
diff --git a/hw/pci-host/gt64120.c b/hw/pci-host/gt64120.c
index 14fc803d279..3cc92e7200f 100644
--- a/hw/pci-host/gt64120.c
+++ b/hw/pci-host/gt64120.c
@@ -1193,7 +1193,7 @@  static void gt64120_realize(DeviceState *dev, Error **errp)
     phb->bus = pci_root_bus_new(dev, "pci",
                                 &s->pci0_mem,
                                 get_system_io(),
-                                PCI_DEVFN(18, 0), TYPE_PCI_BUS);
+                                PCI_DEVFN(18, 0), TYPE_PCI_BUS, true);
 
     pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "gt64120_pci");
     memory_region_init_io(&phb->conf_mem, OBJECT(phb),
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 4f0a0438d77..35a54b953a7 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -268,7 +268,7 @@  static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
     memory_region_add_coalescing(&phb->conf_mem, 0, 4);
 
     b = pci_root_bus_new(dev, NULL, s->pci_address_space,
-                         s->io_memory, 0, TYPE_PCI_BUS);
+                         s->io_memory, 0, TYPE_PCI_BUS, true);
     phb->bus = b;
 
     d = pci_create_simple(b, 0, s->pci_type);
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index f3e713318ed..e47ba7aa0c2 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -65,7 +65,7 @@  static void q35_host_realize(DeviceState *dev, Error **errp)
     pci->bus = pci_root_bus_new(DEVICE(s), "pcie.0",
                                 s->mch.pci_address_space,
                                 s->mch.address_space_io,
-                                0, TYPE_PCIE_BUS);
+                                0, TYPE_PCIE_BUS, true);
 
     qdev_realize(DEVICE(&s->mch), BUS(pci->bus), &error_fatal);
 }
diff --git a/hw/pci-host/remote.c b/hw/pci-host/remote.c
index bfb25ef6af8..646e14de4e9 100644
--- a/hw/pci-host/remote.c
+++ b/hw/pci-host/remote.c
@@ -43,7 +43,7 @@  static void remote_pcihost_realize(DeviceState *dev, Error **errp)
 
     pci->bus = pci_root_bus_new(DEVICE(s), "remote-pci",
                                 s->mr_pci_mem, s->mr_sys_io,
-                                0, TYPE_PCIE_BUS);
+                                0, TYPE_PCIE_BUS, true);
 }
 
 static void remote_pcihost_class_init(ObjectClass *klass, void *data)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index f7158fb9573..5fea39e4dfa 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -571,13 +571,14 @@  void pci_root_bus_init(PCIBus *bus, size_t bus_size, DeviceState *parent,
 
 PCIBus *pci_root_bus_new(DeviceState *parent, const char *name,
                          MemoryRegion *mem, MemoryRegion *io,
-                         uint8_t devfn_min, const char *typename)
+                         uint8_t devfn_min, const char *typename,
+                         bool bar_at_addr_0_refused)
 {
     PCIBus *bus;
 
     bus = PCI_BUS(qbus_new(typename, parent, name));
     pci_root_bus_internal_init(bus, parent, mem, io, devfn_min,
-                               true);
+                               bar_at_addr_0_refused);
     return bus;
 }
 
@@ -622,7 +623,7 @@  PCIBus *pci_register_root_bus(DeviceState *parent, const char *name,
 {
     PCIBus *bus;
 
-    bus = pci_root_bus_new(parent, name, mem, io, devfn_min, typename);
+    bus = pci_root_bus_new(parent, name, mem, io, devfn_min, typename, true);
     pci_bus_irqs(bus, set_irq, irq_opaque, nirq);
     pci_bus_map_irqs(bus, map_irq);
     return bus;