[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/11] s390x/pci: PCI multibus bridge handling
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PATCH 08/11] s390x/pci: PCI multibus bridge handling |
Date: |
Wed, 11 Jan 2017 10:37:39 +0100 |
From: Pierre Morel <address@hidden>
When the hotplug handler detects a PCI bridge, the secondary bus has
been initialized by the core PCI code. We give the secondary bus the
bridge name and associate to it the IOMMU handling and
hotplug/hotunplug callbacks.
Signed-off-by: Pierre Morel <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
hw/s390x/s390-pci-bus.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index e1b7649b0c..9ca67b2755 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -19,6 +19,7 @@
#include "s390-pci-bus.h"
#include "s390-pci-inst.h"
#include "hw/pci/pci_bus.h"
+#include "hw/pci/pci_bridge.h"
#include "hw/pci/msi.h"
#include "qemu/error-report.h"
@@ -677,7 +678,16 @@ static void s390_pcihost_hot_plug(HotplugHandler
*hotplug_dev,
S390PCIBusDevice *pbdev = NULL;
S390pciState *s = s390_get_phb();
- if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
+ if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) {
+ BusState *bus;
+ PCIBridge *pb = PCI_BRIDGE(dev);
+
+ pci_bridge_map_irq(pb, dev->id, s390_pci_map_irq);
+ pci_setup_iommu(&pb->sec_bus, s390_pci_dma_iommu, s);
+
+ bus = BUS(&pb->sec_bus);
+ qbus_set_hotplug_handler(bus, DEVICE(s), errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
pdev = PCI_DEVICE(dev);
if (!dev->id) {
@@ -754,7 +764,10 @@ static void s390_pcihost_hot_unplug(HotplugHandler
*hotplug_dev,
S390PCIBusDevice *pbdev = NULL;
S390pciState *s = s390_get_phb();
- if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
+ if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) {
+ error_setg(errp, "PCI bridge hot unplug currently not supported");
+ return;
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
pci_dev = PCI_DEVICE(dev);
QTAILQ_FOREACH(pbdev, &s->zpci_devs, link) {
--
2.11.0
- [Qemu-devel] [PATCH 01/11] s390x: remove double compat statement, (continued)
- [Qemu-devel] [PATCH 01/11] s390x: remove double compat statement, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 02/11] s390x: add compat machine for 2.9, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 03/11] s390x/kvm: use kvm_gsi_routing_enabled in flic, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 05/11] s390x/pci: dynamically allocate iommu, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 06/11] s390x/pci: change the device array to a list, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 04/11] s390x/pci: make S390PCIIOMMU inherit Object, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 09/11] s390x/pci: use hashtable to look up zpci via fh, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 10/11] s390x/pci: handle PCIBridge bus number, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 07/11] s390x/pci: optimize calling s390_get_phb(), Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 11/11] s390x/pci: merge msix init functions, Cornelia Huck, 2017/01/11
- [Qemu-devel] [PATCH 08/11] s390x/pci: PCI multibus bridge handling,
Cornelia Huck <=