yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
77c23f
From d738b4336c79be68b6040f73427e089f46957728 Mon Sep 17 00:00:00 2001
77c23f
From: Thomas Huth <thuth@redhat.com>
77c23f
Date: Fri, 29 May 2020 05:54:11 -0400
77c23f
Subject: [PATCH 29/42] s390x: protvirt: Set guest IPL PSW
77c23f
77c23f
RH-Author: Thomas Huth <thuth@redhat.com>
77c23f
Message-id: <20200529055420.16855-30-thuth@redhat.com>
77c23f
Patchwork-id: 97049
77c23f
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 29/38] s390x: protvirt: Set guest IPL PSW
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
Handling of CPU reset and setting of the IPL psw from guest storage at
77c23f
offset 0 is done by a Ultravisor call. Let's only fetch it if
77c23f
necessary.
77c23f
77c23f
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
77c23f
Reviewed-by: Thomas Huth <thuth@redhat.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-11-frankja@linux.ibm.com>
77c23f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
77c23f
(cherry picked from commit 59181010a2ff82c3a97e9b5768ee87c38e4815f1)
77c23f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
77c23f
---
77c23f
 target/s390x/cpu.c | 26 +++++++++++++++++---------
77c23f
 1 file changed, 17 insertions(+), 9 deletions(-)
77c23f
77c23f
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
77c23f
index 8f38cd8e6f..371b91b2d7 100644
77c23f
--- a/target/s390x/cpu.c
77c23f
+++ b/target/s390x/cpu.c
77c23f
@@ -77,16 +77,24 @@ static bool s390_cpu_has_work(CPUState *cs)
77c23f
 static void s390_cpu_load_normal(CPUState *s)
77c23f
 {
77c23f
     S390CPU *cpu = S390_CPU(s);
77c23f
-    uint64_t spsw = ldq_phys(s->as, 0);
77c23f
-
77c23f
-    cpu->env.psw.mask = spsw & PSW_MASK_SHORT_CTRL;
77c23f
-    /*
77c23f
-     * Invert short psw indication, so SIE will report a specification
77c23f
-     * exception if it was not set.
77c23f
-     */
77c23f
-    cpu->env.psw.mask ^= PSW_MASK_SHORTPSW;
77c23f
-    cpu->env.psw.addr = spsw & PSW_MASK_SHORT_ADDR;
77c23f
+    uint64_t spsw;
77c23f
 
77c23f
+    if (!s390_is_pv()) {
77c23f
+        spsw = ldq_phys(s->as, 0);
77c23f
+        cpu->env.psw.mask = spsw & PSW_MASK_SHORT_CTRL;
77c23f
+        /*
77c23f
+         * Invert short psw indication, so SIE will report a specification
77c23f
+         * exception if it was not set.
77c23f
+         */
77c23f
+        cpu->env.psw.mask ^= PSW_MASK_SHORTPSW;
77c23f
+        cpu->env.psw.addr = spsw & PSW_MASK_SHORT_ADDR;
77c23f
+    } else {
77c23f
+        /*
77c23f
+         * Firmware requires us to set the load state before we set
77c23f
+         * the cpu to operating on protected guests.
77c23f
+         */
77c23f
+        s390_cpu_set_state(S390_CPU_STATE_LOAD, cpu);
77c23f
+    }
77c23f
     s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu);
77c23f
 }
77c23f
 #endif
77c23f
-- 
77c23f
2.27.0
77c23f