thebeanogamer / rpms / qemu-kvm

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