summary refs log tree commit diff stats
path: root/hw/core/cpu-common.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-08-29 11:26:05 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2025-09-17 19:00:55 +0200
commit27e76d010104646c997d20ca0996fb5a046587b0 (patch)
treeed37640209e6666425cd1251101cc28214bd1e75 /hw/core/cpu-common.c
parent602d5ebba26b245730a0b6a4855b1812d587725c (diff)
downloadfocaccia-qemu-27e76d010104646c997d20ca0996fb5a046587b0.tar.gz
focaccia-qemu-27e76d010104646c997d20ca0996fb5a046587b0.zip
cpu-common: use atomic access for interrupt_request
Writes to interrupt_request used non-atomic accesses, but there are a
few cases where the access was not protected by the BQL.  Now that
there is a full set of helpers, it's easier to guarantee that
interrupt_request accesses are fully atomic, so just drop the
requirement instead of fixing them.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/core/cpu-common.c')
-rw-r--r--hw/core/cpu-common.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index 259cf2a3c3..152abc9024 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -67,19 +67,9 @@ CPUState *cpu_create(const char *typename)
     return cpu;
 }
 
-/* Resetting the IRQ comes from across the code base so we take the
- * BQL here if we need to.  cpu_interrupt assumes it is held.*/
 void cpu_reset_interrupt(CPUState *cpu, int mask)
 {
-    bool need_lock = !bql_locked();
-
-    if (need_lock) {
-        bql_lock();
-    }
-    cpu->interrupt_request &= ~mask;
-    if (need_lock) {
-        bql_unlock();
-    }
+    qatomic_and(&cpu->interrupt_request, ~mask);
 }
 
 void cpu_exit(CPUState *cpu)