spapr_pci: Fix DRC owner in spapr_dt_pci_bus()
commit7e10b57dd9e0d2570ecccca0e2f418618f303d8c
authorGreg Kurz <groug@kaod.org>
Tue, 18 Jun 2019 08:42:53 +0000 (18 10:42 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 1 Jul 2019 23:43:58 +0000 (2 09:43 +1000)
tree88db577888820b54b50068a134746e697444fee7
parent2a17583082f5350edb17207d76252603ec960afa
spapr_pci: Fix DRC owner in spapr_dt_pci_bus()

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 <groug@kaod.org>
Message-Id: <156084737348.512412.3552825999605902691.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_pci.c