cryptospore / 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

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