From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: peter.maydell@linaro.org
Cc: borntraeger@de.ibm.com, agraf@suse.de, jfrei@linux.vnet.ibm.com,
qemu-devel@nongnu.org, Pierre Morel <pmorel@linux.vnet.ibm.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [Qemu-devel] [PULL 08/12] s390x/pci: PCI multibus bridge handling
Date: Tue, 17 Jan 2017 09:56:41 +0100 [thread overview]
Message-ID: <20170117085645.4267-9-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20170117085645.4267-1-cornelia.huck@de.ibm.com>
From: Pierre Morel <pmorel@linux.vnet.ibm.com>
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 <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
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
next prev parent reply other threads:[~2017-01-17 8:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-17 8:56 [Qemu-devel] [PULL 00/12] s390x update Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 01/12] s390x: remove double compat statement Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 02/12] s390x: add compat machine for 2.9 Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 03/12] s390x/kvm: use kvm_gsi_routing_enabled in flic Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 04/12] s390x/pci: make S390PCIIOMMU inherit Object Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 05/12] s390x/pci: dynamically allocate iommu Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 06/12] s390x/pci: change the device array to a list Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 07/12] s390x/pci: optimize calling s390_get_phb() Cornelia Huck
2017-01-17 8:56 ` Cornelia Huck [this message]
2017-01-17 8:56 ` [Qemu-devel] [PULL 09/12] s390x/pci: use hashtable to look up zpci via fh Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 10/12] s390x/pci: handle PCIBridge bus number Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 11/12] s390x/pci: merge msix init functions Cornelia Huck
2017-01-17 8:56 ` [Qemu-devel] [PULL 12/12] virtio-ccw: fix ring sizing Cornelia Huck
2017-01-19 18:32 ` [Qemu-devel] [PULL 00/12] s390x update Peter Maydell
2017-01-20 9:21 ` Cornelia Huck
2017-01-20 9:52 ` Thomas Huth
2017-01-20 9:58 ` Thomas Huth
2017-01-20 10:00 ` Cornelia Huck
2017-01-20 10:04 ` Thomas Huth
2017-01-20 10:11 ` Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170117085645.4267-9-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=pmorel@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).