|
|
ddf19c |
From 0d1c0adf25a323be0663863ebe44a6aefb5f7baf Mon Sep 17 00:00:00 2001
|
|
|
ddf19c |
From: Thomas Huth <thuth@redhat.com>
|
|
|
ddf19c |
Date: Fri, 29 May 2020 05:53:47 -0400
|
|
|
ddf19c |
Subject: [PATCH 05/42] s390x: Move initial reset
|
|
|
ddf19c |
MIME-Version: 1.0
|
|
|
ddf19c |
Content-Type: text/plain; charset=UTF-8
|
|
|
ddf19c |
Content-Transfer-Encoding: 8bit
|
|
|
ddf19c |
|
|
|
ddf19c |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
ddf19c |
Message-id: <20200529055420.16855-6-thuth@redhat.com>
|
|
|
ddf19c |
Patchwork-id: 97024
|
|
|
ddf19c |
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 05/38] s390x: Move initial reset
|
|
|
ddf19c |
Bugzilla: 1828317
|
|
|
ddf19c |
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@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 move the intial reset into the reset handler and cleanup
|
|
|
ddf19c |
afterwards.
|
|
|
ddf19c |
|
|
|
ddf19c |
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
|
|
ddf19c |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
ddf19c |
Message-Id: <20191128083723.11937-1-frankja@linux.ibm.com>
|
|
|
ddf19c |
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
|
|
ddf19c |
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ddf19c |
(cherry picked from commit 81b9222358e5c8f666f0d86057c75e40531d804c)
|
|
|
ddf19c |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ddf19c |
---
|
|
|
ddf19c |
target/s390x/cpu-qom.h | 2 +-
|
|
|
ddf19c |
target/s390x/cpu.c | 46 +++++++++++++++++-------------------------
|
|
|
ddf19c |
target/s390x/cpu.h | 2 +-
|
|
|
ddf19c |
target/s390x/sigp.c | 2 +-
|
|
|
ddf19c |
4 files changed, 21 insertions(+), 31 deletions(-)
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h
|
|
|
ddf19c |
index f3b71bac67..6f0a12042e 100644
|
|
|
ddf19c |
--- a/target/s390x/cpu-qom.h
|
|
|
ddf19c |
+++ b/target/s390x/cpu-qom.h
|
|
|
ddf19c |
@@ -36,6 +36,7 @@ typedef struct S390CPUDef S390CPUDef;
|
|
|
ddf19c |
|
|
|
ddf19c |
typedef enum cpu_reset_type {
|
|
|
ddf19c |
S390_CPU_RESET_NORMAL,
|
|
|
ddf19c |
+ S390_CPU_RESET_INITIAL,
|
|
|
ddf19c |
} cpu_reset_type;
|
|
|
ddf19c |
|
|
|
ddf19c |
/**
|
|
|
ddf19c |
@@ -62,7 +63,6 @@ typedef struct S390CPUClass {
|
|
|
ddf19c |
void (*parent_reset)(CPUState *cpu);
|
|
|
ddf19c |
void (*load_normal)(CPUState *cpu);
|
|
|
ddf19c |
void (*reset)(CPUState *cpu, cpu_reset_type type);
|
|
|
ddf19c |
- void (*initial_cpu_reset)(CPUState *cpu);
|
|
|
ddf19c |
} S390CPUClass;
|
|
|
ddf19c |
|
|
|
ddf19c |
typedef struct S390CPU S390CPU;
|
|
|
ddf19c |
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
|
|
|
ddf19c |
index 67d6fbfa44..ca62fe7685 100644
|
|
|
ddf19c |
--- a/target/s390x/cpu.c
|
|
|
ddf19c |
+++ b/target/s390x/cpu.c
|
|
|
ddf19c |
@@ -94,6 +94,23 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type)
|
|
|
ddf19c |
s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
|
|
|
ddf19c |
|
|
|
ddf19c |
switch (type) {
|
|
|
ddf19c |
+ case S390_CPU_RESET_INITIAL:
|
|
|
ddf19c |
+ /* initial reset does not clear everything! */
|
|
|
ddf19c |
+ memset(&env->start_initial_reset_fields, 0,
|
|
|
ddf19c |
+ offsetof(CPUS390XState, end_reset_fields) -
|
|
|
ddf19c |
+ offsetof(CPUS390XState, start_initial_reset_fields));
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+ /* architectured initial value for Breaking-Event-Address register */
|
|
|
ddf19c |
+ env->gbea = 1;
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+ /* architectured initial values for CR 0 and 14 */
|
|
|
ddf19c |
+ env->cregs[0] = CR0_RESET;
|
|
|
ddf19c |
+ env->cregs[14] = CR14_RESET;
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+ /* tininess for underflow is detected before rounding */
|
|
|
ddf19c |
+ set_float_detect_tininess(float_tininess_before_rounding,
|
|
|
ddf19c |
+ &env->fpu_status);
|
|
|
ddf19c |
+ /* fall through */
|
|
|
ddf19c |
case S390_CPU_RESET_NORMAL:
|
|
|
ddf19c |
env->pfault_token = -1UL;
|
|
|
ddf19c |
env->bpbc = false;
|
|
|
ddf19c |
@@ -101,35 +118,9 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type)
|
|
|
ddf19c |
default:
|
|
|
ddf19c |
g_assert_not_reached();
|
|
|
ddf19c |
}
|
|
|
ddf19c |
-}
|
|
|
ddf19c |
-
|
|
|
ddf19c |
-/* S390CPUClass::initial_reset() */
|
|
|
ddf19c |
-static void s390_cpu_initial_reset(CPUState *s)
|
|
|
ddf19c |
-{
|
|
|
ddf19c |
- S390CPU *cpu = S390_CPU(s);
|
|
|
ddf19c |
- CPUS390XState *env = &cpu->env;
|
|
|
ddf19c |
-
|
|
|
ddf19c |
- s390_cpu_reset(s, S390_CPU_RESET_NORMAL);
|
|
|
ddf19c |
- /* initial reset does not clear everything! */
|
|
|
ddf19c |
- memset(&env->start_initial_reset_fields, 0,
|
|
|
ddf19c |
- offsetof(CPUS390XState, end_reset_fields) -
|
|
|
ddf19c |
- offsetof(CPUS390XState, start_initial_reset_fields));
|
|
|
ddf19c |
-
|
|
|
ddf19c |
- /* architectured initial values for CR 0 and 14 */
|
|
|
ddf19c |
- env->cregs[0] = CR0_RESET;
|
|
|
ddf19c |
- env->cregs[14] = CR14_RESET;
|
|
|
ddf19c |
-
|
|
|
ddf19c |
- /* architectured initial value for Breaking-Event-Address register */
|
|
|
ddf19c |
- env->gbea = 1;
|
|
|
ddf19c |
-
|
|
|
ddf19c |
- env->pfault_token = -1UL;
|
|
|
ddf19c |
-
|
|
|
ddf19c |
- /* tininess for underflow is detected before rounding */
|
|
|
ddf19c |
- set_float_detect_tininess(float_tininess_before_rounding,
|
|
|
ddf19c |
- &env->fpu_status);
|
|
|
ddf19c |
|
|
|
ddf19c |
/* Reset state inside the kernel that we cannot access yet from QEMU. */
|
|
|
ddf19c |
- if (kvm_enabled()) {
|
|
|
ddf19c |
+ if (kvm_enabled() && type != S390_CPU_RESET_NORMAL) {
|
|
|
ddf19c |
kvm_s390_reset_vcpu(cpu);
|
|
|
ddf19c |
}
|
|
|
ddf19c |
}
|
|
|
ddf19c |
@@ -481,7 +472,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
|
|
|
ddf19c |
scc->load_normal = s390_cpu_load_normal;
|
|
|
ddf19c |
#endif
|
|
|
ddf19c |
scc->reset = s390_cpu_reset;
|
|
|
ddf19c |
- scc->initial_cpu_reset = s390_cpu_initial_reset;
|
|
|
ddf19c |
cc->reset = s390_cpu_full_reset;
|
|
|
ddf19c |
cc->class_by_name = s390_cpu_class_by_name,
|
|
|
ddf19c |
cc->has_work = s390_cpu_has_work;
|
|
|
ddf19c |
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
|
|
|
ddf19c |
index 18123dfd5b..d2af13b345 100644
|
|
|
ddf19c |
--- a/target/s390x/cpu.h
|
|
|
ddf19c |
+++ b/target/s390x/cpu.h
|
|
|
ddf19c |
@@ -748,7 +748,7 @@ static inline void s390_do_cpu_initial_reset(CPUState *cs, run_on_cpu_data arg)
|
|
|
ddf19c |
{
|
|
|
ddf19c |
S390CPUClass *scc = S390_CPU_GET_CLASS(cs);
|
|
|
ddf19c |
|
|
|
ddf19c |
- scc->initial_cpu_reset(cs);
|
|
|
ddf19c |
+ scc->reset(cs, S390_CPU_RESET_INITIAL);
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
static inline void s390_do_cpu_load_normal(CPUState *cs, run_on_cpu_data arg)
|
|
|
ddf19c |
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
|
|
|
ddf19c |
index 850139b9cd..727875bb4a 100644
|
|
|
ddf19c |
--- a/target/s390x/sigp.c
|
|
|
ddf19c |
+++ b/target/s390x/sigp.c
|
|
|
ddf19c |
@@ -254,7 +254,7 @@ static void sigp_initial_cpu_reset(CPUState *cs, run_on_cpu_data arg)
|
|
|
ddf19c |
SigpInfo *si = arg.host_ptr;
|
|
|
ddf19c |
|
|
|
ddf19c |
cpu_synchronize_state(cs);
|
|
|
ddf19c |
- scc->initial_cpu_reset(cs);
|
|
|
ddf19c |
+ scc->reset(cs, S390_CPU_RESET_INITIAL);
|
|
|
ddf19c |
cpu_synchronize_post_reset(cs);
|
|
|
ddf19c |
si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;
|
|
|
ddf19c |
}
|
|
|
ddf19c |
--
|
|
|
ddf19c |
2.27.0
|
|
|
ddf19c |
|