yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-s390x-protvirt-Move-diag-308-data-over-SIDA.patch

77c23f
From 33d4e21cfd236aecd9e4dbe8228d058fd1f22400 Mon Sep 17 00:00:00 2001
77c23f
From: Thomas Huth <thuth@redhat.com>
77c23f
Date: Fri, 29 May 2020 05:54:12 -0400
77c23f
Subject: [PATCH 30/42] s390x: protvirt: Move diag 308 data over SIDA
77c23f
77c23f
RH-Author: Thomas Huth <thuth@redhat.com>
77c23f
Message-id: <20200529055420.16855-31-thuth@redhat.com>
77c23f
Patchwork-id: 97048
77c23f
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 30/38] s390x: protvirt: Move diag 308 data over SIDA
77c23f
Bugzilla: 1828317
77c23f
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
77c23f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
77c23f
RH-Acked-by: David Hildenbrand <david@redhat.com>
77c23f
77c23f
From: Janosch Frank <frankja@linux.ibm.com>
77c23f
77c23f
For protected guests the IPIB is written/read to/from the SIDA, so we
77c23f
need those accesses to go through s390_cpu_pv_mem_read/write().
77c23f
77c23f
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
77c23f
Reviewed-by: David Hildenbrand <david@redhat.com>
77c23f
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
77c23f
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
77c23f
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
77c23f
Message-Id: <20200319131921.2367-12-frankja@linux.ibm.com>
77c23f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
77c23f
(cherry picked from commit 9c61e11238cfa8f70e3eb90aac5d3e5646e5432f)
77c23f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
77c23f
---
77c23f
 target/s390x/diag.c | 25 ++++++++++++++++++++-----
77c23f
 1 file changed, 20 insertions(+), 5 deletions(-)
77c23f
77c23f
diff --git a/target/s390x/diag.c b/target/s390x/diag.c
77c23f
index b2cbefb8cf..1a48429564 100644
77c23f
--- a/target/s390x/diag.c
77c23f
+++ b/target/s390x/diag.c
77c23f
@@ -75,6 +75,7 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
77c23f
 {
77c23f
     bool valid;
77c23f
     CPUState *cs = env_cpu(env);
77c23f
+    S390CPU *cpu = S390_CPU(cs);
77c23f
     uint64_t addr =  env->regs[r1];
77c23f
     uint64_t subcode = env->regs[r3];
77c23f
     IplParameterBlock *iplb;
77c23f
@@ -111,13 +112,22 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
77c23f
             return;
77c23f
         }
77c23f
         iplb = g_new0(IplParameterBlock, 1);
77c23f
-        cpu_physical_memory_read(addr, iplb, sizeof(iplb->len));
77c23f
+        if (!s390_is_pv()) {
77c23f
+            cpu_physical_memory_read(addr, iplb, sizeof(iplb->len));
77c23f
+        } else {
77c23f
+            s390_cpu_pv_mem_read(cpu, 0, iplb, sizeof(iplb->len));
77c23f
+        }
77c23f
+
77c23f
         if (!iplb_valid_len(iplb)) {
77c23f
             env->regs[r1 + 1] = DIAG_308_RC_INVALID;
77c23f
             goto out;
77c23f
         }
77c23f
 
77c23f
-        cpu_physical_memory_read(addr, iplb, be32_to_cpu(iplb->len));
77c23f
+        if (!s390_is_pv()) {
77c23f
+            cpu_physical_memory_read(addr, iplb, be32_to_cpu(iplb->len));
77c23f
+        } else {
77c23f
+            s390_cpu_pv_mem_read(cpu, 0, iplb, be32_to_cpu(iplb->len));
77c23f
+        }
77c23f
 
77c23f
         valid = subcode == DIAG308_PV_SET ? iplb_valid_pv(iplb) : iplb_valid(iplb);
77c23f
         if (!valid) {
77c23f
@@ -140,12 +150,17 @@ out:
77c23f
         } else {
77c23f
             iplb = s390_ipl_get_iplb();
77c23f
         }
77c23f
-        if (iplb) {
77c23f
+        if (!iplb) {
77c23f
+            env->regs[r1 + 1] = DIAG_308_RC_NO_CONF;
77c23f
+            return;
77c23f
+        }
77c23f
+
77c23f
+        if (!s390_is_pv()) {
77c23f
             cpu_physical_memory_write(addr, iplb, be32_to_cpu(iplb->len));
77c23f
-            env->regs[r1 + 1] = DIAG_308_RC_OK;
77c23f
         } else {
77c23f
-            env->regs[r1 + 1] = DIAG_308_RC_NO_CONF;
77c23f
+            s390_cpu_pv_mem_write(cpu, 0, iplb, be32_to_cpu(iplb->len));
77c23f
         }
77c23f
+        env->regs[r1 + 1] = DIAG_308_RC_OK;
77c23f
         return;
77c23f
     case DIAG308_PV_START:
77c23f
         iplb = s390_ipl_get_iplb_pv();
77c23f
-- 
77c23f
2.27.0
77c23f