yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-s390x-Rename-and-use-constants-for-short-PSW-address.patch

ddf19c
From 4bd5ae889376816238ecad1bce054b0e198cde2b Mon Sep 17 00:00:00 2001
ddf19c
From: Thomas Huth <thuth@redhat.com>
ddf19c
Date: Fri, 29 May 2020 05:53:55 -0400
ddf19c
Subject: [PATCH 13/42] s390x: Rename and use constants for short PSW address
ddf19c
 and mask
ddf19c
ddf19c
RH-Author: Thomas Huth <thuth@redhat.com>
ddf19c
Message-id: <20200529055420.16855-14-thuth@redhat.com>
ddf19c
Patchwork-id: 97050
ddf19c
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 13/38] s390x: Rename and use constants for short PSW address and mask
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
Let's rename PSW_MASK_ESA_ADDR to PSW_MASK_SHORT_ADDR because we're
ddf19c
not working with a ESA PSW which would not support the extended
ddf19c
addressing bit. Also let's actually use it.
ddf19c
ddf19c
Additionally we introduce PSW_MASK_SHORT_CTRL and use it throughout
ddf19c
the codebase.
ddf19c
ddf19c
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
ddf19c
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
ddf19c
Reviewed-by: David Hildenbrand <david@redhat.com>
ddf19c
Message-Id: <20200227092341.38558-1-frankja@linux.ibm.com>
ddf19c
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
(cherry picked from commit b6c2dbd7214b0b2396e1dcf9668c8b48ab571115)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 hw/s390x/ipl.c     | 2 +-
ddf19c
 target/s390x/cpu.c | 4 ++--
ddf19c
 target/s390x/cpu.h | 3 ++-
ddf19c
 3 files changed, 5 insertions(+), 4 deletions(-)
ddf19c
ddf19c
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
ddf19c
index ca544d64c5..0b7548a549 100644
ddf19c
--- a/hw/s390x/ipl.c
ddf19c
+++ b/hw/s390x/ipl.c
ddf19c
@@ -179,7 +179,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
ddf19c
                 /* if not Linux load the address of the (short) IPL PSW */
ddf19c
                 ipl_psw = rom_ptr(4, 4);
ddf19c
                 if (ipl_psw) {
ddf19c
-                    pentry = be32_to_cpu(*ipl_psw) & 0x7fffffffUL;
ddf19c
+                    pentry = be32_to_cpu(*ipl_psw) & PSW_MASK_SHORT_ADDR;
ddf19c
                 } else {
ddf19c
                     error_setg(&err, "Could not get IPL PSW");
ddf19c
                     goto error;
ddf19c
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
ddf19c
index 625daeedd1..e538a4a3e2 100644
ddf19c
--- a/target/s390x/cpu.c
ddf19c
+++ b/target/s390x/cpu.c
ddf19c
@@ -78,13 +78,13 @@ static void s390_cpu_load_normal(CPUState *s)
ddf19c
     S390CPU *cpu = S390_CPU(s);
ddf19c
     uint64_t spsw = ldq_phys(s->as, 0);
ddf19c
 
ddf19c
-    cpu->env.psw.mask = spsw & 0xffffffff80000000ULL;
ddf19c
+    cpu->env.psw.mask = spsw & PSW_MASK_SHORT_CTRL;
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
+    cpu->env.psw.addr = spsw & PSW_MASK_SHORT_ADDR;
ddf19c
 
ddf19c
     s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu);
ddf19c
 }
ddf19c
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
ddf19c
index 7f5fa1d35b..1ff84e6b3a 100644
ddf19c
--- a/target/s390x/cpu.h
ddf19c
+++ b/target/s390x/cpu.h
ddf19c
@@ -281,7 +281,8 @@ extern const VMStateDescription vmstate_s390_cpu;
ddf19c
 #define PSW_MASK_RI             0x0000008000000000ULL
ddf19c
 #define PSW_MASK_64             0x0000000100000000ULL
ddf19c
 #define PSW_MASK_32             0x0000000080000000ULL
ddf19c
-#define PSW_MASK_ESA_ADDR       0x000000007fffffffULL
ddf19c
+#define PSW_MASK_SHORT_ADDR     0x000000007fffffffULL
ddf19c
+#define PSW_MASK_SHORT_CTRL     0xffffffff80000000ULL
ddf19c
 
ddf19c
 #undef PSW_ASC_PRIMARY
ddf19c
 #undef PSW_ASC_ACCREG
ddf19c
-- 
ddf19c
2.27.0
ddf19c