target/ppc: always use ppc_set_irq to set env->pending_interrupts

Use ppc_set_irq to raise/clear interrupts to ensure CPU_INTERRUPT_HARD
will be set/reset accordingly.

Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com>
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
Message-Id: <20221011204829.1641124-3-matheus.ferst@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Matheus Ferst 2022-10-11 17:48:02 -03:00 committed by Daniel Henrique Barboza
parent f003109f71
commit 7b694df6a6
2 changed files with 9 additions and 17 deletions

View file

@ -23,6 +23,7 @@
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "internal.h" #include "internal.h"
#include "helper_regs.h" #include "helper_regs.h"
#include "hw/ppc/ppc.h"
#include "trace.h" #include "trace.h"
@ -2086,7 +2087,6 @@ void helper_rfebb(CPUPPCState *env, target_ulong s)
static void do_ebb(CPUPPCState *env, int ebb_excp) static void do_ebb(CPUPPCState *env, int ebb_excp)
{ {
PowerPCCPU *cpu = env_archcpu(env); PowerPCCPU *cpu = env_archcpu(env);
CPUState *cs = CPU(cpu);
/* /*
* FSCR_EBB and FSCR_IC_EBB are the same bits used with * FSCR_EBB and FSCR_IC_EBB are the same bits used with
@ -2104,8 +2104,7 @@ static void do_ebb(CPUPPCState *env, int ebb_excp)
if (FIELD_EX64(env->msr, MSR, PR)) { if (FIELD_EX64(env->msr, MSR, PR)) {
powerpc_excp(cpu, ebb_excp); powerpc_excp(cpu, ebb_excp);
} else { } else {
env->pending_interrupts |= PPC_INTERRUPT_EBB; ppc_set_irq(cpu, PPC_INTERRUPT_EBB, 1);
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
} }
} }
@ -2298,7 +2297,7 @@ void helper_msgclr(CPUPPCState *env, target_ulong rb)
return; return;
} }
env->pending_interrupts &= ~irq; ppc_set_irq(env_archcpu(env), irq, 0);
} }
void helper_msgsnd(target_ulong rb) void helper_msgsnd(target_ulong rb)
@ -2317,8 +2316,7 @@ void helper_msgsnd(target_ulong rb)
CPUPPCState *cenv = &cpu->env; CPUPPCState *cenv = &cpu->env;
if ((rb & DBELL_BRDCAST) || (cenv->spr[SPR_BOOKE_PIR] == pir)) { if ((rb & DBELL_BRDCAST) || (cenv->spr[SPR_BOOKE_PIR] == pir)) {
cenv->pending_interrupts |= irq; ppc_set_irq(cpu, irq, 1);
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
} }
} }
qemu_mutex_unlock_iothread(); qemu_mutex_unlock_iothread();
@ -2342,7 +2340,7 @@ void helper_book3s_msgclr(CPUPPCState *env, target_ulong rb)
return; return;
} }
env->pending_interrupts &= ~PPC_INTERRUPT_HDOORBELL; ppc_set_irq(env_archcpu(env), PPC_INTERRUPT_HDOORBELL, 0);
} }
static void book3s_msgsnd_common(int pir, int irq) static void book3s_msgsnd_common(int pir, int irq)
@ -2356,8 +2354,7 @@ static void book3s_msgsnd_common(int pir, int irq)
/* TODO: broadcast message to all threads of the same processor */ /* TODO: broadcast message to all threads of the same processor */
if (cenv->spr_cb[SPR_PIR].default_value == pir) { if (cenv->spr_cb[SPR_PIR].default_value == pir) {
cenv->pending_interrupts |= irq; ppc_set_irq(cpu, irq, 1);
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
} }
} }
qemu_mutex_unlock_iothread(); qemu_mutex_unlock_iothread();
@ -2383,7 +2380,7 @@ void helper_book3s_msgclrp(CPUPPCState *env, target_ulong rb)
return; return;
} }
env->pending_interrupts &= ~PPC_INTERRUPT_DOORBELL; ppc_set_irq(env_archcpu(env), PPC_INTERRUPT_HDOORBELL, 0);
} }
/* /*

View file

@ -25,6 +25,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "mmu-book3s-v3.h" #include "mmu-book3s-v3.h"
#include "hw/ppc/ppc.h"
#include "helper_regs.h" #include "helper_regs.h"
@ -173,7 +174,6 @@ target_ulong helper_load_dpdes(CPUPPCState *env)
void helper_store_dpdes(CPUPPCState *env, target_ulong val) void helper_store_dpdes(CPUPPCState *env, target_ulong val)
{ {
PowerPCCPU *cpu = env_archcpu(env); PowerPCCPU *cpu = env_archcpu(env);
CPUState *cs = CPU(cpu);
helper_hfscr_facility_check(env, HFSCR_MSGP, "store DPDES", HFSCR_IC_MSGP); helper_hfscr_facility_check(env, HFSCR_MSGP, "store DPDES", HFSCR_IC_MSGP);
@ -184,12 +184,7 @@ void helper_store_dpdes(CPUPPCState *env, target_ulong val)
return; return;
} }
if (val & 0x1) { ppc_set_irq(cpu, PPC_INTERRUPT_DOORBELL, val & 0x1);
env->pending_interrupts |= PPC_INTERRUPT_DOORBELL;
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
} else {
env->pending_interrupts &= ~PPC_INTERRUPT_DOORBELL;
}
} }
#endif /* defined(TARGET_PPC64) */ #endif /* defined(TARGET_PPC64) */