cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
902636
From 27f5d8a3af2863e39b7c46a3128009988d772f15 Mon Sep 17 00:00:00 2001
902636
From: Thomas Huth <thuth@redhat.com>
902636
Date: Fri, 29 May 2020 05:54:09 -0400
902636
Subject: [PATCH 27/42] s390x: protvirt: Move STSI data over SIDAD
902636
902636
RH-Author: Thomas Huth <thuth@redhat.com>
902636
Message-id: <20200529055420.16855-28-thuth@redhat.com>
902636
Patchwork-id: 97046
902636
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 27/38] s390x: protvirt: Move STSI data over SIDAD
902636
Bugzilla: 1828317
902636
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
902636
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
902636
RH-Acked-by: David Hildenbrand <david@redhat.com>
902636
902636
From: Janosch Frank <frankja@linux.ibm.com>
902636
902636
For protected guests, we need to put the STSI emulation results into
902636
the SIDA, so SIE will write them into the guest at the next entry.
902636
902636
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
902636
Reviewed-by: David Hildenbrand <david@redhat.com>
902636
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
902636
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
902636
Message-Id: <20200319131921.2367-9-frankja@linux.ibm.com>
902636
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
902636
(cherry picked from commit 7c713b8acb70fb61f9650f8a7702dec546752bb6)
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 target/s390x/kvm.c | 11 +++++++++--
902636
 1 file changed, 9 insertions(+), 2 deletions(-)
902636
902636
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
902636
index f67bb5ce2c..6809a5ac40 100644
902636
--- a/target/s390x/kvm.c
902636
+++ b/target/s390x/kvm.c
902636
@@ -50,6 +50,7 @@
902636
 #include "exec/memattrs.h"
902636
 #include "hw/s390x/s390-virtio-ccw.h"
902636
 #include "hw/s390x/s390-virtio-hcall.h"
902636
+#include "hw/s390x/pv.h"
902636
 
902636
 #ifndef DEBUG_KVM
902636
 #define DEBUG_KVM  0
902636
@@ -1803,7 +1804,9 @@ static void insert_stsi_3_2_2(S390CPU *cpu, __u64 addr, uint8_t ar)
902636
     SysIB_322 sysib;
902636
     int del;
902636
 
902636
-    if (s390_cpu_virt_mem_read(cpu, addr, ar, &sysib, sizeof(sysib))) {
902636
+    if (s390_is_pv()) {
902636
+        s390_cpu_pv_mem_read(cpu, 0, &sysib, sizeof(sysib));
902636
+    } else if (s390_cpu_virt_mem_read(cpu, addr, ar, &sysib, sizeof(sysib))) {
902636
         return;
902636
     }
902636
     /* Shift the stack of Extended Names to prepare for our own data */
902636
@@ -1843,7 +1846,11 @@ static void insert_stsi_3_2_2(S390CPU *cpu, __u64 addr, uint8_t ar)
902636
     /* Insert UUID */
902636
     memcpy(sysib.vm[0].uuid, &qemu_uuid, sizeof(sysib.vm[0].uuid));
902636
 
902636
-    s390_cpu_virt_mem_write(cpu, addr, ar, &sysib, sizeof(sysib));
902636
+    if (s390_is_pv()) {
902636
+        s390_cpu_pv_mem_write(cpu, 0, &sysib, sizeof(sysib));
902636
+    } else {
902636
+        s390_cpu_virt_mem_write(cpu, addr, ar, &sysib, sizeof(sysib));
902636
+    }
902636
 }
902636
 
902636
 static int handle_stsi(S390CPU *cpu)
902636
-- 
902636
2.27.0
902636