summary refs log tree commit diff stats
path: root/system/cpus.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-06-12 14:45:19 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-07-04 14:43:46 +0200
commitb64bb17d14a62ea04b605f81daec8a5a4fad3be4 (patch)
tree649a32d3c83cea5aec1450a6201151adaa116715 /system/cpus.c
parent20a0181600d61f5e58a087be14bd63c40aca2cd4 (diff)
downloadfocaccia-qemu-b64bb17d14a62ea04b605f81daec8a5a4fad3be4.tar.gz
focaccia-qemu-b64bb17d14a62ea04b605f81daec8a5a4fad3be4.zip
accel: Expose and register generic_handle_interrupt()
In order to dispatch over AccelOpsClass::handle_interrupt(),
we need it always defined, not calling a hidden handler under
the hood. Make AccelOpsClass::handle_interrupt() mandatory.
Expose generic_handle_interrupt() prototype and register it
for each accelerator.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Mads Ynddal <mads@ynddal.dk>
Message-Id: <20250703173248.44995-29-philmd@linaro.org>
Diffstat (limited to 'system/cpus.c')
-rw-r--r--system/cpus.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/system/cpus.c b/system/cpus.c
index a43e0e4e79..0d0eec82a2 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -254,7 +254,7 @@ int64_t cpus_get_elapsed_ticks(void)
     return cpu_get_ticks();
 }
 
-static void generic_handle_interrupt(CPUState *cpu, int mask)
+void generic_handle_interrupt(CPUState *cpu, int mask)
 {
     cpu->interrupt_request |= mask;
 
@@ -267,11 +267,7 @@ void cpu_interrupt(CPUState *cpu, int mask)
 {
     g_assert(bql_locked());
 
-    if (cpus_accel->handle_interrupt) {
-        cpus_accel->handle_interrupt(cpu, mask);
-    } else {
-        generic_handle_interrupt(cpu, mask);
-    }
+    cpus_accel->handle_interrupt(cpu, mask);
 }
 
 /*
@@ -680,6 +676,8 @@ void cpus_register_accel(const AccelOpsClass *ops)
 {
     assert(ops != NULL);
     assert(ops->create_vcpu_thread != NULL); /* mandatory */
+    assert(ops->handle_interrupt);
+
     cpus_accel = ops;
 }