yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
4ec855
From 324a0ffc5140c4ece5b720708da2c673a8d1b9cc Mon Sep 17 00:00:00 2001
4ec855
From: Thomas Huth <thuth@redhat.com>
4ec855
Date: Tue, 1 Oct 2019 06:02:58 +0100
4ec855
Subject: [PATCH 12/22] s390: PCI: fix IOMMU region init
4ec855
4ec855
RH-Author: Thomas Huth <thuth@redhat.com>
4ec855
Message-id: <20191001060258.28206-2-thuth@redhat.com>
4ec855
Patchwork-id: 90929
4ec855
O-Subject: [RHEL-8.2.0/RHEL-8.1.z qemu-kvm PATCH 1/1] s390: PCI: fix IOMMU region init
4ec855
Bugzilla: 1754643
4ec855
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
4ec855
RH-Acked-by: David Hildenbrand <david@redhat.com>
4ec855
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
4ec855
4ec855
From: Matthew Rosato <mjrosato@linux.ibm.com>
4ec855
4ec855
The fix in dbe9cf606c shrinks the IOMMU memory region to a size
4ec855
that seems reasonable on the surface, however is actually too
4ec855
small as it is based against a 0-mapped address space.  This
4ec855
causes breakage with small guests as they can overrun the IOMMU window.
4ec855
4ec855
Let's go back to the prior method of initializing iommu for now.
4ec855
4ec855
Fixes: dbe9cf606c ("s390x/pci: Set the iommu region size mpcifc request")
4ec855
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
4ec855
Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
4ec855
Tested-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
4ec855
Reported-by: Stefan Zimmerman <stzi@linux.ibm.com>
4ec855
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
4ec855
Message-Id: <1569507036-15314-1-git-send-email-mjrosato@linux.ibm.com>
4ec855
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4ec855
(cherry picked from commit 7df1dac5f1c85312474df9cb3a8fcae72303da62)
4ec855
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
4ec855
---
4ec855
 hw/s390x/s390-pci-bus.c | 7 ++++++-
4ec855
 1 file changed, 6 insertions(+), 1 deletion(-)
4ec855
4ec855
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
4ec855
index 383b3e7..069e152 100644
4ec855
--- a/hw/s390x/s390-pci-bus.c
4ec855
+++ b/hw/s390x/s390-pci-bus.c
4ec855
@@ -691,10 +691,15 @@ static const MemoryRegionOps s390_msi_ctrl_ops = {
4ec855
 
4ec855
 void s390_pci_iommu_enable(S390PCIIOMMU *iommu)
4ec855
 {
4ec855
+    /*
4ec855
+     * The iommu region is initialized against a 0-mapped address space,
4ec855
+     * so the smallest IOMMU region we can define runs from 0 to the end
4ec855
+     * of the PCI address space.
4ec855
+     */
4ec855
     char *name = g_strdup_printf("iommu-s390-%04x", iommu->pbdev->uid);
4ec855
     memory_region_init_iommu(&iommu->iommu_mr, sizeof(iommu->iommu_mr),
4ec855
                              TYPE_S390_IOMMU_MEMORY_REGION, OBJECT(&iommu->mr),
4ec855
-                             name, iommu->pal - iommu->pba + 1);
4ec855
+                             name, iommu->pal + 1);
4ec855
     iommu->enabled = true;
4ec855
     memory_region_add_subregion(&iommu->mr, 0, MEMORY_REGION(&iommu->iommu_mr));
4ec855
     g_free(name);
4ec855
-- 
4ec855
1.8.3.1
4ec855