@@ -62,8 +62,11 @@ void superh_cpu_do_interrupt(CPUState *cs)
{
SuperHCPU *cpu = SUPERH_CPU(cs);
CPUSH4State *env = &cpu->env;
- int do_irq = cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD;
- int do_exp, irq_vector = cs->exception_index;
+ int do_irq;
+ int do_exp, irq_vector;
+ qemu_mutex_lock_iothread();
+ do_irq = cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD;
+ irq_vector = cs->exception_index;
/* prioritize exceptions over interrupts */
@@ -79,9 +82,11 @@ void superh_cpu_do_interrupt(CPUState *cs)
should be loaded with the kernel entry point.
qemu_system_reset_request takes care of that. */
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+ qemu_mutex_unlock_iothread();
return;
}
if (do_irq && !env->in_sleep) {
+ qemu_mutex_unlock_iothread();
return; /* masked */
}
}
@@ -91,6 +96,7 @@ void superh_cpu_do_interrupt(CPUState *cs)
irq_vector = sh_intc_get_pending_vector(env->intc_handle,
(env->sr >> 4) & 0xf);
if (irq_vector == -1) {
+ qemu_mutex_unlock_iothread();
return; /* masked */
}
}
@@ -180,14 +186,17 @@ void superh_cpu_do_interrupt(CPUState *cs)
env->pc = env->vbr + 0x100;
break;
}
+ qemu_mutex_unlock_iothread();
return;
}
if (do_irq) {
env->intevt = irq_vector;
env->pc = env->vbr + 0x600;
+ qemu_mutex_unlock_iothread();
return;
}
+ qemu_mutex_unlock_iothread();
}
static void update_itlb_use(CPUSH4State * env, int itlbnb)
This is part of a series of changes to remove the implied BQL from the common code of cpu_handle_interrupt and cpu_handle_exception. As part of removing the implied BQL from the common code, we are pushing the BQL holding down into the per-arch implementation functions of do_interrupt and cpu_exec_interrupt. The purpose of this set of changes is to set the groundwork so that an arch could move towards removing the BQL from the cpu_handle_interrupt/exception paths. This approach was suggested by Paolo Bonzini. For reference, here are two key posts in the discussion, explaining the reasoning/benefits of this approach. https://lists.gnu.org/archive/html/qemu-devel/2020-07/msg08731.html https://lists.gnu.org/archive/html/qemu-devel/2020-08/msg00044.html Signed-off-by: Robert Foley <robert.foley@linaro.org> --- target/sh4/helper.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)