summary refs log tree commit diff stats
path: root/target/avr/cpu.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2025-08-21 17:56:03 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2025-08-29 12:48:14 +0200
commit87511341c30d8c9c77178db16491a0ccacc5d64b (patch)
treef2a99d1629f140c57cd7bdfcae4f5fd681763d94 /target/avr/cpu.c
parentb8217bbaf2bafef1a4f54082a3548613eeef8f2b (diff)
downloadfocaccia-qemu-87511341c30d8c9c77178db16491a0ccacc5d64b.tar.gz
focaccia-qemu-87511341c30d8c9c77178db16491a0ccacc5d64b.zip
add cpu_test_interrupt()/cpu_set_interrupt() helpers and use them tree wide
The helpers form load-acquire/store-release pair and ensure
that appropriate barriers are in place in case checks happen
outside of BQL.

Use them to replace open-coded checkers/setters across the code,
to make sure that barriers are not missed.  Helpers also make code a
bit more readable.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Link: https://lore.kernel.org/r/20250821155603.2422553-1-imammedo@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/avr/cpu.c')
-rw-r--r--target/avr/cpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
index 6995de6a12..a6df71d020 100644
--- a/target/avr/cpu.c
+++ b/target/avr/cpu.c
@@ -45,7 +45,7 @@ static vaddr avr_cpu_get_pc(CPUState *cs)
 
 static bool avr_cpu_has_work(CPUState *cs)
 {
-    return (cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_RESET))
+    return cpu_test_interrupt(cs, CPU_INTERRUPT_HARD | CPU_INTERRUPT_RESET)
             && cpu_interrupts_enabled(cpu_env(cs));
 }