Commit fbf08c0fbd for qemu.org
commit fbf08c0fbd5ebf96d23ca1e9a56fc2c2a1b0bc57
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Tue Sep 22 07:54:46 2026 +0200
system: Document has_work() synchronization requirements
Document that has_work() may be called with or without the BQL.
Require implementations to remain idempotent and avoid consuming
work, and to synchronize state shared with other threads without
acquiring the BQL unconditionally.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260923171116.31276-2-philmd@oss.qualcomm.com>
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
index e56eea18b7..d125540262 100644
--- a/include/hw/core/sysemu-cpu-ops.h
+++ b/include/hw/core/sysemu-cpu-ops.h
@@ -19,8 +19,10 @@ typedef struct SysemuCPUOps {
/**
* @has_work: Callback for checking if there is work to do.
*
- * This function should be idempotent (i.e. not change state) as
- * it will likely be queried multiple times before a CPU resumes.
+ * This callback may be called with or without the BQL. It must be
+ * idempotent, must not consume work, and must not assume that the BQL
+ * is held or acquire it unconditionally. State shared with other
+ * threads must use appropriate synchronization.
*/
bool (*has_work)(CPUState *cpu); /* MANDATORY NON-NULL */
/**