[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 08/10] accel/tcg: push i386 specific hacks into handle_cpu_in
From: |
Richard Henderson |
Subject: |
Re: [PATCH 08/10] accel/tcg: push i386 specific hacks into handle_cpu_interrupt callback |
Date: |
Mon, 20 Mar 2023 09:27:40 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 |
On 3/20/23 03:10, Alex Bennée wrote:
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
include/hw/core/sysemu-cpu-ops.h | 11 +++++++++++
target/i386/cpu-internal.h | 1 +
accel/tcg/cpu-exec-softmmu.c | 16 ++++++++++++++++
accel/tcg/cpu-exec.c | 31 ++++++++++---------------------
target/i386/cpu-sysemu.c | 17 +++++++++++++++++
target/i386/cpu.c | 1 +
6 files changed, 56 insertions(+), 21 deletions(-)
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
index c9d30172c4..d53907b517 100644
--- a/include/hw/core/sysemu-cpu-ops.h
+++ b/include/hw/core/sysemu-cpu-ops.h
@@ -53,6 +53,15 @@ typedef struct SysemuCPUOps {
* @cs: The CPUState
*/
void (*handle_cpu_halt)(CPUState *cpu);
+ /**
+ * @handle_cpu_interrupt: handle init/reset interrupts
+ * @cs: The CPUState
+ * @irq_request: the interrupt request
+ *
+ * Most architectures share a common handler. Returns true if the
+ * handler did indeed handle and interrupt.
+ */
and -> the? or any?
This should be a tcg hook, not a sysemu hook, per the previous one.
I would very much like it to never be NULL, but instead your new
common_cpu_handle_interrupt function.
-#if defined(TARGET_I386)
- else if (interrupt_request & CPU_INTERRUPT_INIT) {
- X86CPU *x86_cpu = X86_CPU(cpu);
- CPUArchState *env = &x86_cpu->env;
- replay_interrupt();
- cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0, 0);
- do_cpu_init(x86_cpu);
- cpu->exception_index = EXCP_HALTED;
- return true;
- }
-#else
- else if (interrupt_request & CPU_INTERRUPT_RESET) {
- replay_interrupt();
- cpu_reset(cpu);
+ else if (cpu->cc->sysemu_ops->handle_cpu_interrupt &&
+ cpu->cc->sysemu_ops->handle_cpu_interrupt(cpu,
interrupt_request)) {
+ return true;
+ } else if (common_cpu_handle_interrupt(cpu, interrupt_request)) {
return true;
... because this is pretty ugly, and incorrectly indented.
r~