From: David Gibson Date: Fri, 15 Feb 2019 05:50:40 +0000 (+1100) Subject: spapr: Direct all PCI hotplug to host bridge, rather than P2P bridge X-Git-Tag: qemu-xen-4.13.0-rc1~132^2~4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cb600087060897ca73d231f3edbe7f70ae3ce67f;p=qemu-xen.git spapr: Direct all PCI hotplug to host bridge, rather than P2P bridge A P2P bridge will attempt to handle the hotplug with SHPC, which doesn't work in the PAPR environment. Instead we want to direct all PCI hotplug actions to the PAPR specific host bridge which will use the PAPR hotplug mechanism. Signed-off-by: David Gibson Acked-by: Michael S. Tsirkin --- diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 507fd50dd5..6dd8aaac33 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4094,6 +4094,17 @@ static HotplugHandler *spapr_get_hotplug_handler(MachineState *machine, object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_PCI_HOST_BRIDGE)) { return HOTPLUG_HANDLER(machine); } + if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + PCIDevice *pcidev = PCI_DEVICE(dev); + PCIBus *root = pci_device_root_bus(pcidev); + SpaprPhbState *phb = + (SpaprPhbState *)object_dynamic_cast(OBJECT(BUS(root)->parent), + TYPE_SPAPR_PCI_HOST_BRIDGE); + + if (phb) { + return HOTPLUG_HANDLER(phb); + } + } return NULL; }