[PATCH v3 5/6] KVM: PPC: Add support for nestedv2 guests

Michael Ellerman mpe at ellerman.id.au
Thu Aug 17 14:19:38 AEST 2023


Jordan Niethe <jniethe5 at gmail.com> writes:
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 2357545dffd7..7d5edbc6ecd9 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -4165,7 +4231,10 @@ static int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
>  	vcpu_vpa_increment_dispatch(vcpu);
>  
>  	if (kvmhv_on_pseries()) {
> -		trap = kvmhv_vcpu_entry_p9_nested(vcpu, time_limit, lpcr, tb);
> +		if (kvmhv_is_nestedv1())
> +			trap = kvmhv_vcpu_entry_p9_nested(vcpu, time_limit, lpcr, tb);
> +		else if (kvmhv_is_nestedv2())
> +			trap = kvmhv_vcpu_entry_nestedv2(vcpu, time_limit, lpcr, tb);

Clang warns:

/linux/arch/powerpc/kvm/book3s_hv.c:4236:12: error: variable 'trap' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                else if (kvmhv_is_nestedv2())
                         ^~~~~~~~~~~~~~~~~~~
/linux/arch/powerpc/kvm/book3s_hv.c:4240:7: note: uninitialized use occurs here
                if (trap == BOOK3S_INTERRUPT_SYSCALL && !nested &&
                    ^~~~
/linux/arch/powerpc/kvm/book3s_hv.c:4236:8: note: remove the 'if' if its condition is always true
                else if (kvmhv_is_nestedv2())
                     ^~~~~~~~~~~~~~~~~~~~~~~~
/linux/arch/powerpc/kvm/book3s_hv.c:4219:10: note: initialize the variable 'trap' to silence this warning
        int trap;
                ^
                 = 0

cheers


More information about the Linuxppc-dev mailing list