Re: Re: [PATCH v3] KVM: PPC: Book3S HV: Fix L2 guest reboot failure due to empty 'arch_compat'

2024-02-06 Thread Amit Machhiwal
Hi Michael,

Thanks for looking into the patch and your comments.

On 2024/02/06 09:09 PM, Michael Ellerman wrote:
> Hi Amit,
> 
> One comment below ...
> 
> Amit Machhiwal  writes:
> > Currently, rebooting a pseries nested qemu-kvm guest (L2) results in
> > below error as L1 qemu sends PVR value 'arch_compat' == 0 via
> > ppc_set_compat ioctl. This triggers a condition failure in
> > kvmppc_set_arch_compat() resulting in an EINVAL.
> ...
> > 
> > diff --git a/arch/powerpc/kvm/book3s_hv_nestedv2.c 
> > b/arch/powerpc/kvm/book3s_hv_nestedv2.c
> > index 5378eb40b162..6042bdc70230 100644
> > --- a/arch/powerpc/kvm/book3s_hv_nestedv2.c
> > +++ b/arch/powerpc/kvm/book3s_hv_nestedv2.c
> > @@ -347,8 +348,26 @@ static int gs_msg_ops_vcpu_fill_info(struct 
> > kvmppc_gs_buff *gsb,
> > break;
> > }
> > case KVMPPC_GSID_LOGICAL_PVR:
> > -   rc = kvmppc_gse_put_u32(gsb, iden,
> > -   vcpu->arch.vcore->arch_compat);
> > +   /*
> > +* Though 'arch_compat == 0' would mean the default
> > +* compatibility, arch_compat, being a Guest Wide
> > +* Element, cannot be filled with a value of 0 in GSB
> > +* as this would result into a kernel trap.
> > +* Hence, when `arch_compat == 0`, arch_compat should
> > +* default to L1's PVR.
> > +*
> > +* Rework this when PowerVM supports a value of 0
> > +* for arch_compat for KVM API v2.
> > +*/
> 
> Is there an actual plan that PowerVM will support this in future?
> 
> If so, how will a future kernel know that it's running on a version of
> PowerVM that does support arch_compat == 0?
> 
> Similarly how will we know when it's OK to drop support for this
> workaround?

I'm sending a v4 based on an off mailing list discussion.

> 
> cheers

~Amit


Re: [PATCH v3] KVM: PPC: Book3S HV: Fix L2 guest reboot failure due to empty 'arch_compat'

2024-02-06 Thread Michael Ellerman
Hi Amit,

One comment below ...

Amit Machhiwal  writes:
> Currently, rebooting a pseries nested qemu-kvm guest (L2) results in
> below error as L1 qemu sends PVR value 'arch_compat' == 0 via
> ppc_set_compat ioctl. This triggers a condition failure in
> kvmppc_set_arch_compat() resulting in an EINVAL.
...
>   
> diff --git a/arch/powerpc/kvm/book3s_hv_nestedv2.c 
> b/arch/powerpc/kvm/book3s_hv_nestedv2.c
> index 5378eb40b162..6042bdc70230 100644
> --- a/arch/powerpc/kvm/book3s_hv_nestedv2.c
> +++ b/arch/powerpc/kvm/book3s_hv_nestedv2.c
> @@ -347,8 +348,26 @@ static int gs_msg_ops_vcpu_fill_info(struct 
> kvmppc_gs_buff *gsb,
>   break;
>   }
>   case KVMPPC_GSID_LOGICAL_PVR:
> - rc = kvmppc_gse_put_u32(gsb, iden,
> - vcpu->arch.vcore->arch_compat);
> + /*
> +  * Though 'arch_compat == 0' would mean the default
> +  * compatibility, arch_compat, being a Guest Wide
> +  * Element, cannot be filled with a value of 0 in GSB
> +  * as this would result into a kernel trap.
> +  * Hence, when `arch_compat == 0`, arch_compat should
> +  * default to L1's PVR.
> +  *
> +  * Rework this when PowerVM supports a value of 0
> +  * for arch_compat for KVM API v2.
> +  */

Is there an actual plan that PowerVM will support this in future?

If so, how will a future kernel know that it's running on a version of
PowerVM that does support arch_compat == 0?

Similarly how will we know when it's OK to drop support for this
workaround?

cheers