summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorAlex Bennée2017-03-01 14:20:02 +0100
committerAlex Bennée2017-03-09 11:41:38 +0100
commit5ee5993001cf32addb86a92e2ae8cb090fbc1462 (patch)
tree5c54fe7fef9dddfcc18ec6c56ae2e17903e2b726 /hw
parentcpus.c: add additional error_report when !TARGET_SUPPORT_MTTCG (diff)
downloadqemu-5ee5993001cf32addb86a92e2ae8cb090fbc1462.tar.gz
qemu-5ee5993001cf32addb86a92e2ae8cb090fbc1462.tar.xz
qemu-5ee5993001cf32addb86a92e2ae8cb090fbc1462.zip
sparc/sparc64: grab BQL before calling cpu_check_irqs
IRQ modification is part of device emulation and should be done while the BQL is held to prevent races when MTTCG is enabled. This adds assertions in the hw emulation layer and wraps the calls from helpers in the BQL. Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/sparc/sun4m.c3
-rw-r--r--hw/sparc64/sparc64.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 61416a6426..873cd7df9a 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -142,6 +142,9 @@ void cpu_check_irqs(CPUSPARCState *env)
{
CPUState *cs;
+ /* We should be holding the BQL before we mess with IRQs */
+ g_assert(qemu_mutex_iothread_locked());
+
if (env->pil_in && (env->interrupt_index == 0 ||
(env->interrupt_index & ~15) == TT_EXTINT)) {
unsigned int i;
diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c
index b3d219c769..4e4fdab065 100644
--- a/hw/sparc64/sparc64.c
+++ b/hw/sparc64/sparc64.c
@@ -55,6 +55,9 @@ void cpu_check_irqs(CPUSPARCState *env)
uint32_t pil = env->pil_in |
(env->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER));
+ /* We should be holding the BQL before we mess with IRQs */
+ g_assert(qemu_mutex_iothread_locked());
+
/* TT_IVEC has a higher priority (16) than TT_EXTINT (31..17) */
if (env->ivec_status & 0x20) {
return;