summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorjianchunfu <chunfu.jian@shingroup.cn>2023-07-21 15:37:34 +0800
committerCédric Le Goater <clg@kaod.org>2023-09-06 11:19:33 +0200
commit76d93e146768dde7e38b6e5e43c27e478ccb580e (patch)
tree63c4ace577fa527e9845af19facf782eb37a294f
parent6ec65b69ba17c954414fa23a397fb8a3fcfb4a43 (diff)
downloadfocaccia-qemu-76d93e146768dde7e38b6e5e43c27e478ccb580e.tar.gz
focaccia-qemu-76d93e146768dde7e38b6e5e43c27e478ccb580e.zip
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 <chunfu.jian@shingroup.cn>
Tested-by: Gautam Menghani <gautam@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
-rw-r--r--hw/ppc/ppc.c8
-rw-r--r--target/ppc/kvm.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index ace8f4e725..aeb116d919 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -59,7 +59,9 @@ void ppc_set_irq(PowerPCCPU *cpu, int irq, int level)
 
     if (old_pending != env->pending_interrupts) {
         ppc_maybe_interrupt(env);
-        kvmppc_set_interrupt(cpu, irq, level);
+        if (kvm_enabled()) {
+            kvmppc_set_interrupt(cpu, irq, level);
+        }
     }
 
     trace_ppc_irq_set_exit(env, irq, level, env->pending_interrupts,
@@ -1532,5 +1534,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 7698501743..51112bd367 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1320,7 +1320,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;
     }