Blame SOURCES/kvm-s390x-pci-don-t-fence-interpreted-devices-without-MS.patch

97168e
From 5bd57d8ac3a4e75337eae81a3623b4dc2b417e2f Mon Sep 17 00:00:00 2001
97168e
From: Matthew Rosato <mjrosato@linux.ibm.com>
97168e
Date: Fri, 2 Sep 2022 13:27:33 -0400
97168e
Subject: [PATCH 08/42] s390x/pci: don't fence interpreted devices without
97168e
 MSI-X
97168e
MIME-Version: 1.0
97168e
Content-Type: text/plain; charset=UTF-8
97168e
Content-Transfer-Encoding: 8bit
97168e
97168e
RH-Author: Cédric Le Goater <clg@redhat.com>
97168e
RH-MergeRequest: 226: s390: Enhanced Interpretation for PCI Functions and Secure Execution guest dump
97168e
RH-Bugzilla: 1664378 2043909
97168e
RH-Acked-by: Thomas Huth <thuth@redhat.com>
97168e
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
97168e
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
97168e
RH-Commit: [8/41] 52bad4368e9494c43133338b386dc0cc159aeedc
97168e
97168e
Lack of MSI-X support is not an issue for interpreted passthrough
97168e
devices, so let's let these in.  This will allow, for example, ISM
97168e
devices to be passed through -- but only when interpretation is
97168e
available and being used.
97168e
97168e
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
97168e
Reviewed-by: Thomas Huth <thuth@redhat.com>
97168e
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
97168e
Message-Id: <20220902172737.170349-5-mjrosato@linux.ibm.com>
97168e
Signed-off-by: Thomas Huth <thuth@redhat.com>
97168e
(cherry picked from commit 15d0e7942d3b31ff71d8e0e8cec3a8203214f19b)
97168e
Signed-off-by: Cédric Le Goater <clg@redhat.com>
97168e
---
97168e
 hw/s390x/s390-pci-bus.c | 6 +++++-
97168e
 1 file changed, 5 insertions(+), 1 deletion(-)
97168e
97168e
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
97168e
index 18bfae0465..07c7c155e3 100644
97168e
--- a/hw/s390x/s390-pci-bus.c
97168e
+++ b/hw/s390x/s390-pci-bus.c
97168e
@@ -881,6 +881,10 @@ static int s390_pci_msix_init(S390PCIBusDevice *pbdev)
97168e
 
97168e
 static void s390_pci_msix_free(S390PCIBusDevice *pbdev)
97168e
 {
97168e
+    if (pbdev->msix.entries == 0) {
97168e
+        return;
97168e
+    }
97168e
+
97168e
     memory_region_del_subregion(&pbdev->iommu->mr, &pbdev->msix_notify_mr);
97168e
     object_unparent(OBJECT(&pbdev->msix_notify_mr));
97168e
 }
97168e
@@ -1093,7 +1097,7 @@ static void s390_pcihost_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
97168e
             pbdev->interp = false;
97168e
         }
97168e
 
97168e
-        if (s390_pci_msix_init(pbdev)) {
97168e
+        if (s390_pci_msix_init(pbdev) && !pbdev->interp) {
97168e
             error_setg(errp, "MSI-X support is mandatory "
97168e
                        "in the S390 architecture");
97168e
             return;
97168e
-- 
97168e
2.37.3
97168e