[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 18/21] target/sh4: add BQL to do_interrupt and cpu_exec_interr
From: |
Robert Foley |
Subject: |
[PATCH v1 18/21] target/sh4: add BQL to do_interrupt and cpu_exec_interrupt |
Date: |
Wed, 5 Aug 2020 14:13:00 -0400 |
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(-)
diff --git a/target/sh4/helper.c b/target/sh4/helper.c
index 1e32365c75..c4d5b9a374 100644
--- a/target/sh4/helper.c
+++ b/target/sh4/helper.c
@@ -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)
--
2.17.1
- [PATCH v1 11/21] target/mips: add BQL to do_interrupt and cpu_exec_interrupt, (continued)
- [PATCH v1 11/21] target/mips: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 12/21] target/nios2: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 13/21] target/openrisc: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 14/21] target/ppc: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 15/21] target/riscv: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 16/21] target/rx: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 17/21] target/s390x: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 18/21] target/sh4: add BQL to do_interrupt and cpu_exec_interrupt,
Robert Foley <=
- [PATCH v1 19/21] target/sparc: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 20/21] target/unicore32: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05
- [PATCH v1 21/21] target/xtensa: add BQL to do_interrupt and cpu_exec_interrupt, Robert Foley, 2020/08/05