62547e
From de6319fe0ce09297beae5ff4636c03217abe6f26 Mon Sep 17 00:00:00 2001
62547e
From: Matthew Rosato <mjrosato@linux.ibm.com>
62547e
Date: Fri, 3 Dec 2021 09:27:06 -0500
62547e
Subject: [PATCH 04/42] s390x/pci: add supported DT information to clp response
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: [4/41] 275668f6d38fbc1dfa2f1aa8f58b2c319de2657d
62547e
62547e
The DTSM is a mask that specifies which I/O Address Translation designation
62547e
types are supported.  Today QEMU only supports DT=1.
62547e
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-5-mjrosato@linux.ibm.com>
62547e
Signed-off-by: Thomas Huth <thuth@redhat.com>
62547e
(cherry picked from commit ac6aa30ac47b2abaf142f76de46374da2a98f6e7)
62547e
Signed-off-by: Cédric Le Goater <clg@redhat.com>
62547e
---
62547e
 hw/s390x/s390-pci-bus.c         | 1 +
62547e
 hw/s390x/s390-pci-inst.c        | 1 +
62547e
 hw/s390x/s390-pci-vfio.c        | 1 +
62547e
 include/hw/s390x/s390-pci-bus.h | 1 +
62547e
 include/hw/s390x/s390-pci-clp.h | 3 ++-
62547e
 5 files changed, 6 insertions(+), 1 deletion(-)
62547e
62547e
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
62547e
index 1b51a72838..01b58ebc70 100644
62547e
--- a/hw/s390x/s390-pci-bus.c
62547e
+++ b/hw/s390x/s390-pci-bus.c
62547e
@@ -782,6 +782,7 @@ static void s390_pci_init_default_group(void)
62547e
     resgrp->i = 128;
62547e
     resgrp->maxstbl = 128;
62547e
     resgrp->version = 0;
62547e
+    resgrp->dtsm = ZPCI_DTSM;
62547e
 }
62547e
 
62547e
 static void set_pbdev_info(S390PCIBusDevice *pbdev)
62547e
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
62547e
index 07bab85ce5..6d400d4147 100644
62547e
--- a/hw/s390x/s390-pci-inst.c
62547e
+++ b/hw/s390x/s390-pci-inst.c
62547e
@@ -329,6 +329,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
62547e
         stw_p(&resgrp->i, group->zpci_group.i);
62547e
         stw_p(&resgrp->maxstbl, group->zpci_group.maxstbl);
62547e
         resgrp->version = group->zpci_group.version;
62547e
+        resgrp->dtsm = group->zpci_group.dtsm;
62547e
         stw_p(&resgrp->hdr.rsp, CLP_RC_OK);
62547e
         break;
62547e
     }
62547e
diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
62547e
index 2a153fa8c9..6f80a47e29 100644
62547e
--- a/hw/s390x/s390-pci-vfio.c
62547e
+++ b/hw/s390x/s390-pci-vfio.c
62547e
@@ -160,6 +160,7 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev,
62547e
         resgrp->i = cap->noi;
62547e
         resgrp->maxstbl = cap->maxstbl;
62547e
         resgrp->version = cap->version;
62547e
+        resgrp->dtsm = ZPCI_DTSM;
62547e
     }
62547e
 }
62547e
 
62547e
diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bus.h
62547e
index 2727e7bdef..da3cde2bb4 100644
62547e
--- a/include/hw/s390x/s390-pci-bus.h
62547e
+++ b/include/hw/s390x/s390-pci-bus.h
62547e
@@ -37,6 +37,7 @@
62547e
 #define ZPCI_MAX_UID 0xffff
62547e
 #define UID_UNDEFINED 0
62547e
 #define UID_CHECKING_ENABLED 0x01
62547e
+#define ZPCI_DTSM 0x40
62547e
 
62547e
 OBJECT_DECLARE_SIMPLE_TYPE(S390pciState, S390_PCI_HOST_BRIDGE)
62547e
 OBJECT_DECLARE_SIMPLE_TYPE(S390PCIBus, S390_PCI_BUS)
62547e
diff --git a/include/hw/s390x/s390-pci-clp.h b/include/hw/s390x/s390-pci-clp.h
62547e
index 96b8e3f133..cc8c8662b8 100644
62547e
--- a/include/hw/s390x/s390-pci-clp.h
62547e
+++ b/include/hw/s390x/s390-pci-clp.h
62547e
@@ -163,7 +163,8 @@ typedef struct ClpRspQueryPciGrp {
62547e
     uint8_t fr;
62547e
     uint16_t maxstbl;
62547e
     uint16_t mui;
62547e
-    uint64_t reserved3;
62547e
+    uint8_t dtsm;
62547e
+    uint8_t reserved3[7];
62547e
     uint64_t dasm; /* dma address space mask */
62547e
     uint64_t msia; /* MSI address */
62547e
     uint64_t reserved4;
62547e
-- 
62547e
2.37.3
62547e