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>
This commit is contained in:
jianchunfu 2023-07-21 15:37:34 +08:00 committed by Cédric Le Goater
parent 6ec65b69ba
commit 76d93e1467
2 changed files with 7 additions and 3 deletions

View File

@ -59,8 +59,10 @@ void ppc_set_irq(PowerPCCPU *cpu, int irq, int level)
if (old_pending != env->pending_interrupts) {
ppc_maybe_interrupt(env);
if (kvm_enabled()) {
kvmppc_set_interrupt(cpu, irq, level);
}
}
trace_ppc_irq_set_exit(env, irq, level, env->pending_interrupts,
CPU(cpu)->interrupt_request);
@ -1532,5 +1534,7 @@ void ppc_irq_reset(PowerPCCPU *cpu)
CPUPPCState *env = &cpu->env;
env->irq_input_state = 0;
if (kvm_enabled()) {
kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0);
}
}

View File

@ -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;
}