[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] target/ppc: Make checkstop stop the system
From: |
Nicholas Piggin |
Subject: |
[PATCH 4/4] target/ppc: Make checkstop stop the system |
Date: |
Fri, 23 Jun 2023 18:19:53 +1000 |
checkstop state does not halt the system, interrupts continue to be
serviced, and other CPUs run.
Stop the machine with vm_stop(), and print a register dump too.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
target/ppc/excp_helper.c | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 4bfcfc3c3d..51e83d7f07 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -19,6 +19,7 @@
#include "qemu/osdep.h"
#include "qemu/main-loop.h"
#include "qemu/log.h"
+#include "sysemu/runstate.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "internal.h"
@@ -165,6 +166,24 @@ static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int
excp)
env->error_code);
}
+static void powerpc_checkstop(PowerPCCPU *cpu, const char *reason)
+{
+ CPUState *cs = CPU(cpu);
+
+ vm_stop(RUN_STATE_GUEST_PANICKED);
+
+ fprintf(stderr, "Entering checkstop state: %s\n", reason);
+ cpu_dump_state(cs, stderr, CPU_DUMP_FPU | CPU_DUMP_CCOP);
+ if (qemu_log_separate()) {
+ FILE *logfile = qemu_log_trylock();
+ if (logfile) {
+ fprintf(logfile, "Entering checkstop state: %s\n", reason);
+ cpu_dump_state(cs, logfile, CPU_DUMP_FPU | CPU_DUMP_CCOP);
+ qemu_log_unlock(logfile);
+ }
+ }
+}
+
#if defined(TARGET_PPC64)
static int powerpc_reset_wakeup(CPUState *cs, CPUPPCState *env, int excp,
target_ulong *msr)
@@ -406,21 +425,9 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu,
target_ulong vector,
static void powerpc_mcheck_test_and_checkstop(CPUPPCState *env)
{
- CPUState *cs = env_cpu(env);
-
- if (FIELD_EX64(env->msr, MSR, ME)) {
- return;
- }
-
- /* Machine check exception is not enabled. Enter checkstop state. */
- fprintf(stderr, "Machine check while not allowed. "
- "Entering checkstop state\n");
- if (qemu_log_separate()) {
- qemu_log("Machine check while not allowed. "
- "Entering checkstop state\n");
+ if (!FIELD_EX64(env->msr, MSR, ME)) {
+ powerpc_checkstop(env_archcpu(env), "machine check with MSR[ME]=0");
}
- cs->halted = 1;
- cpu_interrupt_exittb(cs);
}
static void powerpc_excp_40x(PowerPCCPU *cpu, int excp)
--
2.40.1
- [PATCH 0/4] target/ppc: Catch invalid real address accesses, Nicholas Piggin, 2023/06/23
- [PATCH 1/4] target/ppc: Machine check on invalid real address access, Nicholas Piggin, 2023/06/23
- [PATCH 2/4] target/ppc: Add POWER9/10 invalid-real machine check codes, Nicholas Piggin, 2023/06/23
- [PATCH 3/4] target/ppc: Move common check in machne check handlers to a function, Nicholas Piggin, 2023/06/23
- [PATCH 4/4] target/ppc: Make checkstop stop the system,
Nicholas Piggin <=
- Re: [PATCH 0/4] target/ppc: Catch invalid real address accesses, Peter Maydell, 2023/06/23
- Re: [PATCH 0/4] target/ppc: Catch invalid real address accesses, Mark Cave-Ayland, 2023/06/27