thebeanogamer / rpms / qemu-kvm

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