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