thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-s390x-pci-don-t-use-hard-coded-dma-range-in-reg_ioat.patch

62547e
From 67ebb71d56e95adf185ab4971939e31c4c899863 Mon Sep 17 00:00:00 2001
62547e
From: Matthew Rosato <mjrosato@linux.ibm.com>
62547e
Date: Fri, 3 Dec 2021 09:27:04 -0500
62547e
Subject: [PATCH 02/42] s390x/pci: don't use hard-coded dma range in reg_ioat
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: [2/41] c7897321f9848ef8f115130832774bbcd6724f03
62547e
62547e
Instead use the values from clp info, they will either be the hard-coded
62547e
values or what came from the host driver via vfio.
62547e
62547e
Fixes: 9670ee752727 ("s390x/pci: use a PCI Function structure")
62547e
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
62547e
Reviewed-by: Eric Farman <farman@linux.ibm.com>
62547e
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
62547e
Message-Id: <20211203142706.427279-3-mjrosato@linux.ibm.com>
62547e
Signed-off-by: Thomas Huth <thuth@redhat.com>
62547e
(cherry picked from commit df7ce0a94d9283f0656b4bc0f21566973ff649a3)
62547e
Signed-off-by: Cédric Le Goater <clg@redhat.com>
62547e
---
62547e
 hw/s390x/s390-pci-inst.c | 9 +++++----
62547e
 1 file changed, 5 insertions(+), 4 deletions(-)
62547e
62547e
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
62547e
index 1c8ad91175..11b7f6bfa1 100644
62547e
--- a/hw/s390x/s390-pci-inst.c
62547e
+++ b/hw/s390x/s390-pci-inst.c
62547e
@@ -916,9 +916,10 @@ int pci_dereg_irqs(S390PCIBusDevice *pbdev)
62547e
     return 0;
62547e
 }
62547e
 
62547e
-static int reg_ioat(CPUS390XState *env, S390PCIIOMMU *iommu, ZpciFib fib,
62547e
+static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib,
62547e
                     uintptr_t ra)
62547e
 {
62547e
+    S390PCIIOMMU *iommu = pbdev->iommu;
62547e
     uint64_t pba = ldq_p(&fib.pba);
62547e
     uint64_t pal = ldq_p(&fib.pal);
62547e
     uint64_t g_iota = ldq_p(&fib.iota);
62547e
@@ -927,7 +928,7 @@ static int reg_ioat(CPUS390XState *env, S390PCIIOMMU *iommu, ZpciFib fib,
62547e
 
62547e
     pba &= ~0xfff;
62547e
     pal |= 0xfff;
62547e
-    if (pba > pal || pba < ZPCI_SDMA_ADDR || pal > ZPCI_EDMA_ADDR) {
62547e
+    if (pba > pal || pba < pbdev->zpci_fn.sdma || pal > pbdev->zpci_fn.edma) {
62547e
         s390_program_interrupt(env, PGM_OPERAND, ra);
62547e
         return -EINVAL;
62547e
     }
62547e
@@ -1125,7 +1126,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar,
62547e
         } else if (pbdev->iommu->enabled) {
62547e
             cc = ZPCI_PCI_LS_ERR;
62547e
             s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE);
62547e
-        } else if (reg_ioat(env, pbdev->iommu, fib, ra)) {
62547e
+        } else if (reg_ioat(env, pbdev, fib, ra)) {
62547e
             cc = ZPCI_PCI_LS_ERR;
62547e
             s390_set_status_code(env, r1, ZPCI_MOD_ST_INSUF_RES);
62547e
         }
62547e
@@ -1150,7 +1151,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar,
62547e
             s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE);
62547e
         } else {
62547e
             pci_dereg_ioat(pbdev->iommu);
62547e
-            if (reg_ioat(env, pbdev->iommu, fib, ra)) {
62547e
+            if (reg_ioat(env, pbdev, fib, ra)) {
62547e
                 cc = ZPCI_PCI_LS_ERR;
62547e
                 s390_set_status_code(env, r1, ZPCI_MOD_ST_INSUF_RES);
62547e
             }
62547e
-- 
62547e
2.37.3
62547e