On 25.11.19 14:19, Cornelia Huck wrote: > On Mon, 25 Nov 2019 04:03:45 -0500 > Janosch Frank <fran...@linux.ibm.com> wrote: > >> Let's start moving the cpu reset functions into a single function with >> a switch/case, so we can use fallthroughs and share more code between >> resets. >> >> This patch introduces the reset function by renaming cpu_reset() and >> cleaning up leftovers. >> >> Signed-off-by: Janosch Frank <fran...@linux.ibm.com> >> Reviewed-by: David Hildenbrand <da...@redhat.com> >> --- >> target/s390x/cpu-qom.h | 6 +++++- >> target/s390x/cpu.c | 16 ++++++++++------ >> target/s390x/cpu.h | 2 +- >> target/s390x/sigp.c | 2 +- >> 4 files changed, 17 insertions(+), 9 deletions(-) >> > >> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c >> index 3abe7e80fd..8d35a2a723 100644 >> --- a/target/s390x/cpu.c >> +++ b/target/s390x/cpu.c >> @@ -82,18 +82,22 @@ static void s390_cpu_load_normal(CPUState *s) >> } >> #endif >> >> -/* S390CPUClass::cpu_reset() */ >> -static void s390_cpu_reset(CPUState *s) >> +/* S390CPUClass::reset() */ >> +static void s390_cpu_reset(CPUState *s, cpu_reset_type type) >> { >> S390CPU *cpu = S390_CPU(s); >> S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); >> CPUS390XState *env = &cpu->env; >> >> - env->pfault_token = -1UL; >> - env->bpbc = false; >> scc->parent_reset(s); >> cpu->env.sigp_order = 0; >> s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); >> + >> + switch (type) { >> + case S390_CPU_RESET_NORMAL: >> + env->pfault_token = -1UL; >> + env->bpbc = false; > > I'm wondering whether we want a default case here to catch programming > errors.
+1, g_assert_not_reached(). -- Thanks, David / dhildenb