thebeanogamer / rpms / qemu-kvm

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