|
|
ae23c9 |
From ed71d0c46408c9fdf4df93ddc4d0610f0b039696 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Cornelia Huck <cohuck@redhat.com>
|
|
|
ae23c9 |
Date: Wed, 17 Apr 2019 13:57:39 +0100
|
|
|
ae23c9 |
Subject: [PATCH 22/24] s390x/pci: Unplug remaining requested devices on
|
|
|
ae23c9 |
pcihost reset
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Cornelia Huck <cohuck@redhat.com>
|
|
|
ae23c9 |
Message-id: <20190417135741.25297-23-cohuck@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 85805
|
|
|
ae23c9 |
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 22/24] s390x/pci: Unplug remaining requested devices on pcihost reset
|
|
|
ae23c9 |
Bugzilla: 1699070
|
|
|
ae23c9 |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
From: David Hildenbrand <david@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
When resetting the guest we should unplug and remove all devices that
|
|
|
ae23c9 |
are still pending.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
With this patch, the requested device will be unplugged on reboot
|
|
|
ae23c9 |
(S390_RESET_EXTERNAL and S390_RESET_REIPL, which reset the pcihost bridge
|
|
|
ae23c9 |
via qemu_devices_reset()).
|
|
|
ae23c9 |
|
|
|
ae23c9 |
This approach is similar to what's done for acpi PCI hotplug in
|
|
|
ae23c9 |
acpi_pcihp_reset() -> acpi_pcihp_update() ->
|
|
|
ae23c9 |
acpi_pcihp_update_hotplug_bus() -> acpi_pcihp_eject_slot().
|
|
|
ae23c9 |
|
|
|
ae23c9 |
s390_pci_generate_plug_event()'s will still be generated, I guess this
|
|
|
ae23c9 |
is not an issue. The same thing would happen right now when unplugging
|
|
|
ae23c9 |
a device just before starting the guest.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: David Hildenbrand <david@redhat.com>
|
|
|
ae23c9 |
Message-Id: <20190130155733.32742-7-david@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Collin Walling <walling@linux.ibm.com>
|
|
|
ae23c9 |
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 2313a88fe68cb970532ba1641ffc35c848daae86)
|
|
|
ae23c9 |
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
hw/s390x/s390-pci-bus.c | 15 +++++++++++++++
|
|
|
ae23c9 |
1 file changed, 15 insertions(+)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
|
|
|
ae23c9 |
index 1ba7873..383b3e7 100644
|
|
|
ae23c9 |
--- a/hw/s390x/s390-pci-bus.c
|
|
|
ae23c9 |
+++ b/hw/s390x/s390-pci-bus.c
|
|
|
ae23c9 |
@@ -1097,6 +1097,21 @@ static void s390_pcihost_reset(DeviceState *dev)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
|
|
|
ae23c9 |
PCIBus *bus = s->parent_obj.bus;
|
|
|
ae23c9 |
+ S390PCIBusDevice *pbdev, *next;
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ /* Process all pending unplug requests */
|
|
|
ae23c9 |
+ QTAILQ_FOREACH_SAFE(pbdev, &s->zpci_devs, link, next) {
|
|
|
ae23c9 |
+ if (pbdev->unplug_requested) {
|
|
|
ae23c9 |
+ if (pbdev->summary_ind) {
|
|
|
ae23c9 |
+ pci_dereg_irqs(pbdev);
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
+ if (pbdev->iommu->enabled) {
|
|
|
ae23c9 |
+ pci_dereg_ioat(pbdev->iommu);
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
+ pbdev->state = ZPCI_FS_STANDBY;
|
|
|
ae23c9 |
+ s390_pci_perform_unplug(pbdev);
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
|
|
|
ae23c9 |
/*
|
|
|
ae23c9 |
* When resetting a PCI bridge, the assigned numbers are set to 0. So
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|