[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH qemu] spapr_pci: Create assigned properties for bridges
From: |
Alexey Kardashevskiy |
Subject: |
[PATCH qemu] spapr_pci: Create assigned properties for bridges |
Date: |
Wed, 29 Jan 2020 13:31:11 +1100 |
QEMU assigns bus numbers so tell the guest about assigned values.
This also adds an empty "ranges" to let the existing linux kernels proceed
far enough to trigger resource reassignment (which is rather a hack).
Signed-off-by: Alexey Kardashevskiy <address@hidden>
---
This is a part of the "kill CAS reboot" effort, the SLOF's side of it was
posted as "[PATCH slof] fdt: Fix creating new nodes at H_CAS"
---
hw/ppc/spapr_pci.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 723373de732c..877ff1d0d5fa 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1336,7 +1336,23 @@ static int spapr_dt_pci_bus(SpaprPhbState *sphb, PCIBus
*bus,
if (pci_bus_is_root(bus)) {
owner = OBJECT(sphb);
} else {
- owner = OBJECT(pci_bridge_get_device(bus));
+ PCIDevice *pdev = pci_bridge_get_device(bus);
+ uint8_t pri = pci_default_read_config(pdev, PCI_PRIMARY_BUS, 1);
+ uint8_t sec = pci_default_read_config(pdev, PCI_SECONDARY_BUS, 1);
+ uint8_t sub = pci_default_read_config(pdev, PCI_SUBORDINATE_BUS, 1);
+ uint32_t range[] = { cpu_to_be32(sec), cpu_to_be32(sub) };
+
+ /*
+ * Create these to get existing Linux kernels proceed far enough to
+ * trigger resource reassignment. We creates these for vPHB already.
+ */
+ _FDT(fdt_setprop_cell(fdt, offset, "primary-bus", pri));
+ _FDT(fdt_setprop_cell(fdt, offset, "secondary-bus", sec));
+ _FDT(fdt_setprop_cell(fdt, offset, "subordinate-bus", sub));
+ _FDT(fdt_setprop(fdt, offset, "bus-range", range, sizeof(range)));
+ _FDT(fdt_setprop_string(fdt, offset, "device_type", "pci"));
+ _FDT(fdt_setprop(fdt, offset, "ranges", NULL, 0));
+ owner = OBJECT(pdev);
}
ret = spapr_dt_drc(fdt, offset, owner,
--
2.17.1
- [PATCH qemu] spapr_pci: Create assigned properties for bridges,
Alexey Kardashevskiy <=