From ba1e022f06300e6dafc7e89a4f3fe756dc9691dd Mon Sep 17 00:00:00 2001 From: JianChunfu Date: Wed, 20 Sep 2023 18:58:00 +0800 Subject: [PATCH] target/ppc: Fix the order of kvm_enable judgment about kvmppc_set_interrupt() It's unnecessary for non-KVM accelerators(TCG, for example), to call this function, so change the order of kvm_enable() judgment. The static inline function that returns -1 directly does not work in TCG's situation. Signed-off-by: JianChunfu --- hw/ppc/ppc.c | 8 ++++++-- target/ppc/kvm.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index e8127599c9..cf90ab7805 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -66,7 +66,9 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) } if (old_pending != env->pending_interrupts) { - kvmppc_set_interrupt(cpu, n_IRQ, level); + if (kvm_enabled()) { + kvmppc_set_interrupt(cpu, irq, level); + } } @@ -1461,5 +1463,7 @@ void ppc_irq_reset(PowerPCCPU *cpu) CPUPPCState *env = &cpu->env; env->irq_input_state = 0; - kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0); + if (kvm_enabled()) { + kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0); + } } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index d73563045b..397b1e902b 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1323,7 +1323,7 @@ int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level) return 0; } - if (!kvm_enabled() || !cap_interrupt_unset) { + if (!cap_interrupt_unset) { return 0; } -- 2.41.0.windows.1