On 8/14/25 12:05 PM, Igor Mammedov wrote:
the helpers form load-acquire/store-release pair and use them to replace
open-coded checkers/setters consistently across the code, which
ensures that appropriate barriers are in place in case checks happen
outside of BQL.

Signed-off-by: Igor Mammedov <imamm...@redhat.com>
---
v4:
    add cpu_set_interrupt() and merge helpers patch with
    patches that use them (v3 6-7,9/10).
        Peter Xu <pet...@redhat.com>

CC: m...@redhat.com
...

diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 5eaf41a566..3e233ff6de 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -942,6 +942,31 @@ CPUState *cpu_by_arch_id(int64_t id);
void cpu_interrupt(CPUState *cpu, int mask); +/**
+ * cpu_test_interrupt:
+ * @cpu: The CPU to check interrupt(s) on.
+ * @mask: The interrupts to check.
+ *
+ * Checks if any of interrupts in @mask are pending on @cpu.
+ */
+static inline bool cpu_test_interrupt(CPUState *cpu, int mask)
+{
+    return qatomic_load_acquire(&cpu->interrupt_request) & mask;
+}
+
+/**
+ * cpu_set_interrupt:
+ * @cpu: The CPU to set pending interrupt(s) on.
+ * @mask: The interrupts to set.
+ *
+ * Checks if any of interrupts in @mask are pending on @cpu.
+ */

Copy paste error, comment description for 'set' appears to be for the 'test' variant. :)

...
diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c
index 8f4c9fd52e..1eed5125d1 100644
--- a/hw/intc/s390_flic.c
+++ b/hw/intc/s390_flic.c
@@ -190,7 +190,7 @@ static void qemu_s390_flic_notify(uint32_t type)
      CPU_FOREACH(cs) {
          S390CPU *cpu = S390_CPU(cs);
- cs->interrupt_request |= CPU_INTERRUPT_HARD;
+        cpu_set_interrupt(cs, CPU_INTERRUPT_HARD);
/* ignore CPUs that are not sleeping */
          if (s390_cpu_get_state(cpu) != S390_CPU_STATE_OPERATING &&

Looks good wrt s390-flic.

Reviewed-by: Jason J. Herne <jjhe...@linux.ibm.com>

Reply via email to