[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 14/49] spapr_pci: Fix DRC owner in spapr_dt_pci_bus()
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 14/49] spapr_pci: Fix DRC owner in spapr_dt_pci_bus() |
Date: |
Tue, 2 Jul 2019 16:08:22 +1000 |
From: Greg Kurz <address@hidden>
spapr_dt_drc() scans the aliases of all DRConnector objects and filters
the ones that it will use to generate OF properties according to their
owner and type.
Passing bus->parent_dev _works_ if bus belongs to a PCI bridge, but it is
NULL if it is the PHB's root bus. This causes all allocated PCI DRCs to
be associated to all PHBs (visible in their "ibm,drc-types" properties).
As a consequence, hot unplugging a PHB results in PCI devices from the
other PHBs to be unplugged as well, and likely confuses the guest.
Use the same logic as in add_drcs() to ensure the correct owner is passed
to spapr_dt_drc().
Fixes: 14e714900f6b "spapr: Allow hot plug/unplug of PCI bridges and devices
under PCI bridges"
Signed-off-by: Greg Kurz <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_pci.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index fbeb1c90ee..2dca1e57f3 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1343,6 +1343,7 @@ static void spapr_dt_pci_device_cb(PCIBus *bus, PCIDevice
*pdev,
static int spapr_dt_pci_bus(SpaprPhbState *sphb, PCIBus *bus,
void *fdt, int offset)
{
+ Object *owner;
PciWalkFdt cbinfo = {
.fdt = fdt,
.offset = offset,
@@ -1363,7 +1364,13 @@ static int spapr_dt_pci_bus(SpaprPhbState *sphb, PCIBus
*bus,
return cbinfo.err;
}
- ret = spapr_dt_drc(fdt, offset, OBJECT(bus->parent_dev),
+ if (pci_bus_is_root(bus)) {
+ owner = OBJECT(sphb);
+ } else {
+ owner = OBJECT(pci_bridge_get_device(bus));
+ }
+
+ ret = spapr_dt_drc(fdt, offset, owner,
SPAPR_DR_CONNECTOR_TYPE_PCI);
if (ret) {
return ret;
--
2.21.0
- [Qemu-ppc] [PULL 00/49] ppc-for-4.1 queue 20190702, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 10/49] target/ppc: fix compile error in kvmppc_define_rtas_kernel_token(), David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 03/49] ppc/pnv: fix StoreEOI activation, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 01/49] spapr/rtas: Force big endian compile for rtas, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 05/49] ppc/pnv: remove xscom_base field from PnvChip, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 04/49] ppc/pnv: fix XSCOM MMIO base address for P9 machines with multiple chips, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 06/49] spapr_pci: Fix potential NULL pointer dereference in spapr_dt_pci_bus(), David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 09/49] xics/spapr: Detect old KVM XICS on POWER9 hosts, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 02/49] docs: updates on the POWER9 XIVE interrupt controller documentation, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 16/49] spapr_pci: Drop useless CONFIG_KVM ifdefery, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 14/49] spapr_pci: Fix DRC owner in spapr_dt_pci_bus(),
David Gibson <=
- [Qemu-ppc] [PULL 28/49] target/ppc/machine: Add kvmppc_pvr_workaround_required() stub, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 08/49] xics/spapr: Register RTAS/hypercalls once at machine init, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 17/49] hw/ppc/mac_oldworld: Drop useless CONFIG_KVM ifdefery, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 07/49] xics/spapr: Prevent RTAS/hypercalls emulation to be used by in-kernel XICS, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 18/49] hw/ppc/mac_newworld: Drop useless CONFIG_KVM ifdefery, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 15/49] xics/spapr: Only emulated XICS should use RTAS/hypercalls emulation, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 29/49] target/ppc: remove getVSR()/putVSR() from int_helper.c, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 12/49] target/ppc: remove getVSR()/putVSR() from fpu_helper.c, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 43/49] spapr/xive: rework the mapping the KVM memory regions, David Gibson, 2019/07/02
- [Qemu-ppc] [PULL 13/49] target/ppc: remove getVSR()/putVSR() from mem_helper.c, David Gibson, 2019/07/02