* [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory
@ 2024-07-12 11:39 Peter Maydell
2024-07-12 14:28 ` Philippe Mathieu-Daudé
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Peter Maydell @ 2024-07-12 11:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Bastian Koppelmann
The TCGCPUOps::cpu_exec_interrupt hook is currently not mandatory; if
it is left NULL then we treat it as if it had returned false. However
since pretty much every architecture needs to handle interrupts,
almost every target we have provides the hook. The one exception is
Tricore, which doesn't currently implement the architectural
interrupt handling.
Add a "do nothing" implementation of cpu_exec_hook for Tricore,
assert on startup that the CPU does provide the hook, and remove
the runtime NULL check before calling it.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
accel/tcg/cpu-exec.c | 4 ++--
target/tricore/cpu.c | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 245fd6327da..9010dad0738 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -857,8 +857,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
else {
const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
- if (tcg_ops->cpu_exec_interrupt &&
- tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) {
+ if (tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) {
if (!tcg_ops->need_replay_interrupt ||
tcg_ops->need_replay_interrupt(interrupt_request)) {
replay_interrupt();
@@ -1080,6 +1079,7 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
/* Check mandatory TCGCPUOps handlers */
#ifndef CONFIG_USER_ONLY
assert(cpu->cc->tcg_ops->cpu_exec_halt);
+ assert(cpu->cc->tcg_ops->cpu_exec_interrupt);
#endif /* !CONFIG_USER_ONLY */
cpu->cc->tcg_ops->initialize();
tcg_target_initialized = true;
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index 4d9c0368f2b..1a261715907 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -155,6 +155,11 @@ static void tc37x_initfn(Object *obj)
set_feature(&cpu->env, TRICORE_FEATURE_162);
}
+static bool tricore_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
+{
+ /* Interrupts are not implemented */
+ return false;
+}
#include "hw/core/sysemu-cpu-ops.h"
@@ -169,6 +174,7 @@ static const TCGCPUOps tricore_tcg_ops = {
.synchronize_from_tb = tricore_cpu_synchronize_from_tb,
.restore_state_to_opc = tricore_restore_state_to_opc,
.tlb_fill = tricore_cpu_tlb_fill,
+ .cpu_exec_interrupt = tricore_cpu_exec_interrupt,
.cpu_exec_halt = tricore_cpu_has_work,
};
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory
2024-07-12 11:39 [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory Peter Maydell
@ 2024-07-12 14:28 ` Philippe Mathieu-Daudé
2024-07-12 14:52 ` Alex Bennée
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-12 14:28 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Richard Henderson, Bastian Koppelmann
On 12/7/24 13:39, Peter Maydell wrote:
> The TCGCPUOps::cpu_exec_interrupt hook is currently not mandatory; if
> it is left NULL then we treat it as if it had returned false. However
> since pretty much every architecture needs to handle interrupts,
> almost every target we have provides the hook. The one exception is
> Tricore, which doesn't currently implement the architectural
> interrupt handling.
>
> Add a "do nothing" implementation of cpu_exec_hook for Tricore,
> assert on startup that the CPU does provide the hook, and remove
> the runtime NULL check before calling it.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> accel/tcg/cpu-exec.c | 4 ++--
> target/tricore/cpu.c | 6 ++++++
> 2 files changed, 8 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory
2024-07-12 11:39 [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory Peter Maydell
2024-07-12 14:28 ` Philippe Mathieu-Daudé
@ 2024-07-12 14:52 ` Alex Bennée
2024-07-12 15:04 ` Richard Henderson
2024-07-13 21:04 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 5+ messages in thread
From: Alex Bennée @ 2024-07-12 14:52 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, Richard Henderson, Bastian Koppelmann
Peter Maydell <peter.maydell@linaro.org> writes:
> The TCGCPUOps::cpu_exec_interrupt hook is currently not mandatory; if
> it is left NULL then we treat it as if it had returned false. However
> since pretty much every architecture needs to handle interrupts,
> almost every target we have provides the hook. The one exception is
> Tricore, which doesn't currently implement the architectural
> interrupt handling.
>
> Add a "do nothing" implementation of cpu_exec_hook for Tricore,
> assert on startup that the CPU does provide the hook, and remove
> the runtime NULL check before calling it.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory
2024-07-12 11:39 [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory Peter Maydell
2024-07-12 14:28 ` Philippe Mathieu-Daudé
2024-07-12 14:52 ` Alex Bennée
@ 2024-07-12 15:04 ` Richard Henderson
2024-07-13 21:04 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2024-07-12 15:04 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Bastian Koppelmann
On 7/12/24 04:39, Peter Maydell wrote:
> TheTCGCPUOps::cpu_exec_interrupt hook is currently not mandatory; if
> it is left NULL then we treat it as if it had returned false. However
> since pretty much every architecture needs to handle interrupts,
> almost every target we have provides the hook. The one exception is
> Tricore, which doesn't currently implement the architectural
> interrupt handling.
>
> Add a "do nothing" implementation of cpu_exec_hook for Tricore,
> assert on startup that the CPU does provide the hook, and remove
> the runtime NULL check before calling it.
>
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
> accel/tcg/cpu-exec.c | 4 ++--
> target/tricore/cpu.c | 6 ++++++
> 2 files changed, 8 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory
2024-07-12 11:39 [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory Peter Maydell
` (2 preceding siblings ...)
2024-07-12 15:04 ` Richard Henderson
@ 2024-07-13 21:04 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-13 21:04 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Richard Henderson, Bastian Koppelmann
On 12/7/24 13:39, Peter Maydell wrote:
> The TCGCPUOps::cpu_exec_interrupt hook is currently not mandatory; if
> it is left NULL then we treat it as if it had returned false. However
> since pretty much every architecture needs to handle interrupts,
> almost every target we have provides the hook. The one exception is
> Tricore, which doesn't currently implement the architectural
> interrupt handling.
>
> Add a "do nothing" implementation of cpu_exec_hook for Tricore,
> assert on startup that the CPU does provide the hook, and remove
> the runtime NULL check before calling it.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> accel/tcg/cpu-exec.c | 4 ++--
> target/tricore/cpu.c | 6 ++++++
> 2 files changed, 8 insertions(+), 2 deletions(-)
Patch queued, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-13 21:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-12 11:39 [PATCH] accel/tcg: Make cpu_exec_interrupt hook mandatory Peter Maydell
2024-07-12 14:28 ` Philippe Mathieu-Daudé
2024-07-12 14:52 ` Alex Bennée
2024-07-12 15:04 ` Richard Henderson
2024-07-13 21:04 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).