Blame SOURCES/kvm-s390x-Properly-fetch-and-test-the-short-psw-on-diag3.patch

ddf19c
From 7171a794e8a7d91805516174187addc3b8e6b423 Mon Sep 17 00:00:00 2001
ddf19c
From: Thomas Huth <thuth@redhat.com>
ddf19c
Date: Fri, 29 May 2020 05:53:54 -0400
ddf19c
Subject: [PATCH 12/42] s390x: Properly fetch and test the short psw on diag308
ddf19c
 subc 0/1
ddf19c
ddf19c
RH-Author: Thomas Huth <thuth@redhat.com>
ddf19c
Message-id: <20200529055420.16855-13-thuth@redhat.com>
ddf19c
Patchwork-id: 97025
ddf19c
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 12/38] s390x: Properly fetch and test the short psw on diag308 subc 0/1
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
We need to actually fetch the cpu mask and set it. As we invert the
ddf19c
short psw indication in the mask, SIE will report a specification
ddf19c
exception, if it wasn't present in the reset psw.
ddf19c
ddf19c
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
ddf19c
Reviewed-by: David Hildenbrand <david@redhat.com>
ddf19c
Message-Id: <20191129142025.21453-2-frankja@linux.ibm.com>
ddf19c
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
(cherry picked from commit 104130cb7c106378dab944397c6a455c4a6d552f)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 target/s390x/cpu.c | 12 ++++++++++--
ddf19c
 target/s390x/cpu.h |  1 +
ddf19c
 2 files changed, 11 insertions(+), 2 deletions(-)
ddf19c
ddf19c
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
ddf19c
index 99ea09085a..625daeedd1 100644
ddf19c
--- a/target/s390x/cpu.c
ddf19c
+++ b/target/s390x/cpu.c
ddf19c
@@ -76,8 +76,16 @@ static bool s390_cpu_has_work(CPUState *cs)
ddf19c
 static void s390_cpu_load_normal(CPUState *s)
ddf19c
 {
ddf19c
     S390CPU *cpu = S390_CPU(s);
ddf19c
-    cpu->env.psw.addr = ldl_phys(s->as, 4) & PSW_MASK_ESA_ADDR;
ddf19c
-    cpu->env.psw.mask = PSW_MASK_32 | PSW_MASK_64;
ddf19c
+    uint64_t spsw = ldq_phys(s->as, 0);
ddf19c
+
ddf19c
+    cpu->env.psw.mask = spsw & 0xffffffff80000000ULL;
ddf19c
+    /*
ddf19c
+     * Invert short psw indication, so SIE will report a specification
ddf19c
+     * exception if it was not set.
ddf19c
+     */
ddf19c
+    cpu->env.psw.mask ^= PSW_MASK_SHORTPSW;
ddf19c
+    cpu->env.psw.addr = spsw & 0x7fffffffULL;
ddf19c
+
ddf19c
     s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu);
ddf19c
 }
ddf19c
 #endif
ddf19c
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
ddf19c
index 7e1c18d596..7f5fa1d35b 100644
ddf19c
--- a/target/s390x/cpu.h
ddf19c
+++ b/target/s390x/cpu.h
ddf19c
@@ -269,6 +269,7 @@ extern const VMStateDescription vmstate_s390_cpu;
ddf19c
 #define PSW_MASK_EXT            0x0100000000000000ULL
ddf19c
 #define PSW_MASK_KEY            0x00F0000000000000ULL
ddf19c
 #define PSW_SHIFT_KEY           52
ddf19c
+#define PSW_MASK_SHORTPSW       0x0008000000000000ULL
ddf19c
 #define PSW_MASK_MCHECK         0x0004000000000000ULL
ddf19c
 #define PSW_MASK_WAIT           0x0002000000000000ULL
ddf19c
 #define PSW_MASK_PSTATE         0x0001000000000000ULL
ddf19c
-- 
ddf19c
2.27.0
ddf19c