[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 21/27] target-arm: helpers which may affect globa
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v7 21/27] target-arm: helpers which may affect global state need the BQL |
Date: |
Thu, 19 Jan 2017 17:05:01 +0000 |
As the arm_call_el_change_hook may affect global state (for example with
updating the global GIC state) we need to assert/take the BQL.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
target/arm/helper.c | 6 ++++++
target/arm/op_helper.c | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index b3875c7c6e..87809562b9 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6672,6 +6672,12 @@ void arm_cpu_do_interrupt(CPUState *cs)
arm_cpu_do_interrupt_aarch32(cs);
}
+ /* Hooks may change global state so BQL should be held, also the
+ * BQL needs to be held for any modification of
+ * cs->interrupt_request.
+ */
+ g_assert(qemu_mutex_iothread_locked());
+
arm_call_el_change_hook(cpu);
if (!kvm_enabled()) {
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
index 1348789760..e1a883c595 100644
--- a/target/arm/op_helper.c
+++ b/target/arm/op_helper.c
@@ -488,7 +488,9 @@ void HELPER(cpsr_write_eret)(CPUARMState *env, uint32_t val)
*/
env->regs[15] &= (env->thumb ? ~1 : ~3);
+ qemu_mutex_lock_iothread();
arm_call_el_change_hook(arm_env_get_cpu(env));
+ qemu_mutex_unlock_iothread();
}
/* Access to user mode registers from privileged modes. */
@@ -1020,7 +1022,9 @@ void HELPER(exception_return)(CPUARMState *env)
cur_el, new_el, env->pc);
}
+ qemu_mutex_lock_iothread();
arm_call_el_change_hook(arm_env_get_cpu(env));
+ qemu_mutex_unlock_iothread();
return;
--
2.11.0
- [Qemu-devel] [PATCH v7 26/27] tcg: enable MTTCG by default for ARM on x86 hosts, (continued)
- [Qemu-devel] [PATCH v7 18/27] cputlb: introduce tlb_flush_*_all_cpus, Alex Bennée, 2017/01/19
- [Qemu-devel] [PATCH v7 20/27] target-arm: ensure BQL taken for ARM_CP_IO register access, Alex Bennée, 2017/01/19
- [Qemu-devel] [PATCH v7 19/27] target-arm/powerctl: defer cpu reset work to CPU context, Alex Bennée, 2017/01/19
- [Qemu-devel] [PATCH v7 27/27] target-ppc: take global mutex for set_irq, Alex Bennée, 2017/01/19
- [Qemu-devel] [PATCH v7 24/27] target-arm: introduce ARM_CP_EXIT_PC, Alex Bennée, 2017/01/19
- [Qemu-devel] [PATCH v7 21/27] target-arm: helpers which may affect global state need the BQL,
Alex Bennée <=
- [Qemu-devel] [PATCH v7 23/27] target-arm/cpu.h: make ARM_CP defined consistent, Alex Bennée, 2017/01/19
- [Qemu-devel] [PATCH v7 22/27] target-arm: don't generate WFE/YIELD calls for MTTCG, Alex Bennée, 2017/01/19
- [Qemu-devel] [PATCH v7 25/27] target-arm: ensure all cross vCPUs TLB flushes complete, Alex Bennée, 2017/01/19
- [Qemu-devel] [PATCH v7 17/27] cputlb: atomically update tlb fields used by tlb_reset_dirty, Alex Bennée, 2017/01/19