Skip to content

Commit

Permalink
target/ppc: Fix the order of kvm_enable judgment about kvmppc_set_int…
Browse files Browse the repository at this point in the history
…errupt()

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>
  • Loading branch information
JOANNES-JIAN authored and legoater committed Sep 6, 2023
1 parent 6ec65b6 commit 76d93e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions hw/ppc/ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion target/ppc/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 76d93e1

Please sign in to comment.