diff mbox series

[3/4] target/ppc: Add machine check interrupt injection helper

Message ID 20240118143459.166994-4-npiggin@gmail.com
State New
Headers show
Series ppc: add machine check injection HMP command | expand

Commit Message

Nicholas Piggin Jan. 18, 2024, 2:34 p.m. UTC
This matches the NMI injection helper function.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 hw/ppc/spapr_events.c    | 3 +--
 target/ppc/excp_helper.c | 7 +++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index cb0eeee587..4be9a5ba3a 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -875,8 +875,7 @@  void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered)
 
     if (spapr->fwnmi_machine_check_addr == -1) {
         /* Non-FWNMI case, deliver it like an architected CPU interrupt. */
-        cs->exception_index = POWERPC_EXCP_MCHECK;
-        ppc_cpu_do_interrupt(cs);
+        ppc_cpu_do_machine_check(cs);
         return;
     }
 
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 58fd08729a..133477acba 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -2601,6 +2601,13 @@  void ppc_cpu_do_system_reset(CPUState *cs)
     powerpc_excp(cpu, POWERPC_EXCP_RESET);
 }
 
+void ppc_cpu_do_machine_check(CPUState *cs)
+{
+    PowerPCCPU *cpu = POWERPC_CPU(cs);
+
+    powerpc_excp(cpu, POWERPC_EXCP_MCHECK);
+}
+
 void ppc_cpu_do_fwnmi_machine_check(CPUState *cs, target_ulong vector)
 {
     PowerPCCPU *cpu = POWERPC_CPU(cs);