qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/ppc: Fix the order of kvm_enable judgment about kvmpp


From: Gautam Menghani
Subject: Re: [PATCH] target/ppc: Fix the order of kvm_enable judgment about kvmppc_set_interrupt()
Date: Fri, 28 Jul 2023 14:54:53 +0530

On Fri, Jul 21, 2023 at 03:37:34PM +0800, jianchunfu wrote:
> 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>
> ---
>  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 0e0a3d93c3..3e96b24487 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -58,7 +58,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,
> @@ -1465,5 +1467,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 a8a935e267..11a1fbc244 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -1315,7 +1315,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.27.0
> 

I tested this by launching a QEMU guest in both KVM and TCG modes on a 
Power9 PowerNV box. I was able to use the network, and also read and
write files on the disk.

Tested-by: Gautam Menghani <gautam@linux.ibm.com>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]