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

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