From: Janosch Frank <frankja@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, qemu-s390x@nongnu.org,
mihajlov@linux.ibm.com, cohuck@redhat.com
Subject: [PATCH v3 3/4] s390x: Fix cpu normal reset ri clearing
Date: Tue, 3 Dec 2019 08:28:12 -0500 [thread overview]
Message-ID: <20191203132813.2734-4-frankja@linux.ibm.com> (raw)
In-Reply-To: <20191203132813.2734-1-frankja@linux.ibm.com>
As it turns out we need to clear the ri controls and PSW enablement
bit to be architecture compliant.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
target/s390x/cpu.c | 7 ++++++-
target/s390x/cpu.h | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 4973365d6c..c282c36b69 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -108,7 +108,7 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type)
case S390_CPU_RESET_INITIAL:
/* initial reset does not clear everything! */
memset(&env->start_initial_reset_fields, 0,
- offsetof(CPUS390XState, end_reset_fields) -
+ offsetof(CPUS390XState, start_normal_reset_fields) -
offsetof(CPUS390XState, start_initial_reset_fields));
/* architectured initial value for Breaking-Event-Address register */
@@ -131,6 +131,11 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type)
&env->fpu_status);
/* fall through */
case S390_CPU_RESET_NORMAL:
+ env->psw.mask &= ~PSW_MASK_RI;
+ memset(&env->start_normal_reset_fields, 0,
+ offsetof(CPUS390XState, end_reset_fields) -
+ offsetof(CPUS390XState, start_normal_reset_fields));
+
env->pfault_token = -1UL;
env->bpbc = false;
break;
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index d5e18b096e..7f5fa1d35b 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -58,7 +58,6 @@ struct CPUS390XState {
*/
uint64_t vregs[32][2] QEMU_ALIGNED(16); /* vector registers */
uint32_t aregs[16]; /* access registers */
- uint8_t riccb[64]; /* runtime instrumentation control */
uint64_t gscb[4]; /* guarded storage control */
uint64_t etoken; /* etoken */
uint64_t etoken_extension; /* etoken extension */
@@ -114,6 +113,10 @@ struct CPUS390XState {
uint64_t gbea;
uint64_t pp;
+ /* Fields up to this point are not cleared by normal CPU reset */
+ struct {} start_normal_reset_fields;
+ uint8_t riccb[64]; /* runtime instrumentation control */
+
/* Fields up to this point are cleared by a CPU reset */
struct {} end_reset_fields;
@@ -252,6 +255,7 @@ extern const VMStateDescription vmstate_s390_cpu;
#undef PSW_SHIFT_ASC
#undef PSW_MASK_CC
#undef PSW_MASK_PM
+#undef PSW_MASK_RI
#undef PSW_SHIFT_MASK_PM
#undef PSW_MASK_64
#undef PSW_MASK_32
@@ -274,6 +278,7 @@ extern const VMStateDescription vmstate_s390_cpu;
#define PSW_MASK_CC 0x0000300000000000ULL
#define PSW_MASK_PM 0x00000F0000000000ULL
#define PSW_SHIFT_MASK_PM 40
+#define PSW_MASK_RI 0x0000008000000000ULL
#define PSW_MASK_64 0x0000000100000000ULL
#define PSW_MASK_32 0x0000000080000000ULL
#define PSW_MASK_ESA_ADDR 0x000000007fffffffULL
--
2.20.1
next prev parent reply other threads:[~2019-12-03 13:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-03 13:28 [PATCH v3 0/4] s390x: Increase architectural compliance Janosch Frank
2019-12-03 13:28 ` [PATCH v3 1/4] Header sync Janosch Frank
2019-12-03 13:28 ` [PATCH v3 2/4] s390x: Add missing vcpu reset functions Janosch Frank
2019-12-03 17:44 ` Cornelia Huck
2019-12-04 9:00 ` Janosch Frank
2019-12-04 9:15 ` Cornelia Huck
2019-12-04 14:59 ` Cornelia Huck
2019-12-04 15:07 ` David Hildenbrand
2019-12-04 15:08 ` David Hildenbrand
2019-12-04 15:33 ` Cornelia Huck
2019-12-04 15:35 ` David Hildenbrand
2019-12-03 13:28 ` Janosch Frank [this message]
2019-12-05 13:32 ` [PATCH v3 3/4] s390x: Fix cpu normal reset ri clearing Cornelia Huck
2019-12-03 13:28 ` [PATCH v3 4/4] pc-bios/s390x: Fix reset psw mask Janosch Frank
2019-12-03 13:33 ` Christian Borntraeger
2019-12-03 17:18 ` Cornelia Huck
2019-12-03 17:22 ` Cornelia Huck
2019-12-03 18:32 ` Christian Borntraeger
2019-12-05 10:12 ` Cornelia Huck
2019-12-13 12:06 ` Cornelia Huck
2019-12-13 12:37 ` Janosch Frank
2019-12-17 12:36 ` Thomas Huth
2019-12-17 15:09 ` Thomas Huth
2019-12-18 12:15 ` Janosch Frank
2019-12-18 12:28 ` Cornelia Huck
2019-12-18 16:54 ` Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191203132813.2734-4-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=mihajlov@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).