[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/16] s390x: Fix cpu normal reset ri clearing
From: |
Cornelia Huck |
Subject: |
[PULL 09/16] s390x: Fix cpu normal reset ri clearing |
Date: |
Fri, 13 Dec 2019 17:18:44 +0100 |
From: Janosch Frank <address@hidden>
As it turns out we need to clear the ri controls and PSW enablement
bit to be architecture compliant.
Signed-off-by: Janosch Frank <address@hidden>
Reviewed-by: Christian Borntraeger <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
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 bd39cb54b7aa..99ea09085a30 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -100,7 +100,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 */
@@ -123,6 +123,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 d2af13b345cc..7e1c18d59696 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
@@ -273,6 +277,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.21.0
- [PULL 00/16] first s390x update for 5.0, Cornelia Huck, 2019/12/13
- [PULL 01/16] vfio-ccw: Fix error message, Cornelia Huck, 2019/12/13
- [PULL 02/16] hw: add compat machines for 5.0, Cornelia Huck, 2019/12/13
- [PULL 03/16] s390x: Don't do a normal reset on the initial cpu, Cornelia Huck, 2019/12/13
- [PULL 04/16] s390x: Move reset normal to shared reset handler, Cornelia Huck, 2019/12/13
- [PULL 05/16] s390x: Move initial reset, Cornelia Huck, 2019/12/13
- [PULL 06/16] s390x: Move clear reset, Cornelia Huck, 2019/12/13
- [PULL 07/16] s390x: Beautify diag308 handling, Cornelia Huck, 2019/12/13
- [PULL 08/16] s390x: kvm: Make kvm_sclp_service_call void, Cornelia Huck, 2019/12/13
- [PULL 09/16] s390x: Fix cpu normal reset ri clearing,
Cornelia Huck <=
- [PULL 10/16] s390x/event-facility: Fix realize() error API violations, Cornelia Huck, 2019/12/13
- [PULL 11/16] s390x/cpumodel: Fix feature property error API violations, Cornelia Huck, 2019/12/13
- [PULL 12/16] s390x/cpumodel: Fix realize() error API violations, Cornelia Huck, 2019/12/13
- [PULL 13/16] s390x/cpumodel: Fix query-cpu-model-FOO error API violations, Cornelia Huck, 2019/12/13
- [PULL 14/16] s390x/cpumodel: Fix query-cpu-definitions error API violations, Cornelia Huck, 2019/12/13
- [PULL 15/16] s390x/tcg: clear local interrupts on reset normal, Cornelia Huck, 2019/12/13
- [PULL 16/16] qga: fence guest-set-time if hwclock not available, Cornelia Huck, 2019/12/13
- Re: [PULL 00/16] first s390x update for 5.0, Peter Maydell, 2019/12/13