yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
36a43f
From 8c8c1a97b07700a2115bf23986fb402fc842bfe1 Mon Sep 17 00:00:00 2001
36a43f
From: Cornelia Huck <cohuck@redhat.com>
36a43f
Date: Tue, 5 Nov 2019 12:54:41 +0000
36a43f
Subject: [PATCH] s390: PCI: fix IOMMU region init
36a43f
36a43f
RH-Author: Cornelia Huck <cohuck@redhat.com>
36a43f
Message-id: <20191105125441.19477-1-cohuck@redhat.com>
36a43f
Patchwork-id: 92032
36a43f
O-Subject: [RHEL-8.1.0.z qemu-kvm PATCH] s390: PCI: fix IOMMU region init
36a43f
Bugzilla: 1764829
36a43f
RH-Acked-by: David Hildenbrand <david@redhat.com>
36a43f
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
36a43f
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
36a43f
RH-Acked-by: Thomas Huth <thuth@redhat.com>
36a43f
36a43f
From: Matthew Rosato <mjrosato@linux.ibm.com>
36a43f
36a43f
BUGZILLA: https://bugzilla.redhat.com/show_bug.cgi?id=1764829
36a43f
BRANCH: rhel-8.1.0
36a43f
UPSTREAM: 7df1dac5f1c85312474df9cb3a8fcae72303da62
36a43f
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=24461099
36a43f
TESTED: only sanity checked, as we lack PCI hardware
36a43f
36a43f
The fix in dbe9cf606c shrinks the IOMMU memory region to a size
36a43f
that seems reasonable on the surface, however is actually too
36a43f
small as it is based against a 0-mapped address space.  This
36a43f
causes breakage with small guests as they can overrun the IOMMU window.
36a43f
36a43f
Let's go back to the prior method of initializing iommu for now.
36a43f
36a43f
Fixes: dbe9cf606c ("s390x/pci: Set the iommu region size mpcifc request")
36a43f
Cc: qemu-stable@nongnu.org
36a43f
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
36a43f
Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
36a43f
Tested-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
36a43f
Reported-by: Stefan Zimmerman <stzi@linux.ibm.com>
36a43f
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
36a43f
Message-Id: <1569507036-15314-1-git-send-email-mjrosato@linux.ibm.com>
36a43f
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
36a43f
(cherry picked from commit 7df1dac5f1c85312474df9cb3a8fcae72303da62)
36a43f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
36a43f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
36a43f
---
36a43f
 hw/s390x/s390-pci-bus.c | 7 ++++++-
36a43f
 1 file changed, 6 insertions(+), 1 deletion(-)
36a43f
36a43f
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
36a43f
index 383b3e7..069e152 100644
36a43f
--- a/hw/s390x/s390-pci-bus.c
36a43f
+++ b/hw/s390x/s390-pci-bus.c
36a43f
@@ -691,10 +691,15 @@ static const MemoryRegionOps s390_msi_ctrl_ops = {
36a43f
 
36a43f
 void s390_pci_iommu_enable(S390PCIIOMMU *iommu)
36a43f
 {
36a43f
+    /*
36a43f
+     * The iommu region is initialized against a 0-mapped address space,
36a43f
+     * so the smallest IOMMU region we can define runs from 0 to the end
36a43f
+     * of the PCI address space.
36a43f
+     */
36a43f
     char *name = g_strdup_printf("iommu-s390-%04x", iommu->pbdev->uid);
36a43f
     memory_region_init_iommu(&iommu->iommu_mr, sizeof(iommu->iommu_mr),
36a43f
                              TYPE_S390_IOMMU_MEMORY_REGION, OBJECT(&iommu->mr),
36a43f
-                             name, iommu->pal - iommu->pba + 1);
36a43f
+                             name, iommu->pal + 1);
36a43f
     iommu->enabled = true;
36a43f
     memory_region_add_subregion(&iommu->mr, 0, MEMORY_REGION(&iommu->iommu_mr));
36a43f
     g_free(name);
36a43f
-- 
36a43f
1.8.3.1
36a43f