target/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_maybe_interrupt

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-11-17 19:07:11 -08:00
parent 6fa8c46e55
commit 2fc4f9f3ff

View File

@ -2163,22 +2163,13 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *env)
void ppc_maybe_interrupt(CPUPPCState *env) void ppc_maybe_interrupt(CPUPPCState *env)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
bool locked = false; QEMU_IOTHREAD_LOCK_GUARD();
if (!qemu_mutex_iothread_locked()) {
locked = true;
qemu_mutex_lock_iothread();
}
if (ppc_next_unmasked_interrupt(env)) { if (ppc_next_unmasked_interrupt(env)) {
cpu_interrupt(cs, CPU_INTERRUPT_HARD); cpu_interrupt(cs, CPU_INTERRUPT_HARD);
} else { } else {
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
} }
if (locked) {
qemu_mutex_unlock_iothread();
}
} }
#if defined(TARGET_PPC64) #if defined(TARGET_PPC64)