Re: [PATCH 3/3] KVM: TDX: Exit to userspace for GetTdVmCallInfo

From: Paolo Bonzini
Date: Fri Jun 20 2025 - 08:04:45 EST


Il ven 20 giu 2025, 03:21 Xiaoyao Li <xiaoyao.li@xxxxxxxxx> ha scritto:
>
> > tdx->vp_enter_args.r11 = 0;
> > + tdx->vp_enter_args.r12 = 0;
> > tdx->vp_enter_args.r13 = 0;
> > tdx->vp_enter_args.r14 = 0;
> > + return 1;
>
> Though it looks OK to return all-0 for r12 == 0 and undefined case of
> r12 > 1, I prefer returning TDVMCALL_STATUS_INVALID_OPERAND for
> undefined case.


>From the GHCI I wasn't sure that TDVMCALL_STATUS_INVALID_OPERAND is a
valid result at all.

Paolo

>
> So please make above "case 0:", and make the "default:" return
> TDVMCALL_STATUS_INVALID_OPERAND
>
> > }
> > - return 1;
> > }
> >
> > static int tdx_complete_simple(struct kvm_vcpu *vcpu)
> > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> > index 6708bc88ae69..fb3b4cd8d662 100644
> > --- a/include/uapi/linux/kvm.h
> > +++ b/include/uapi/linux/kvm.h
> > @@ -461,6 +461,11 @@ struct kvm_run {
> > __u64 gpa;
> > __u64 size;
> > } get_quote;
> > + struct {
> > + __u64 ret;
> > + __u64 leaf;
> > + __u64 r11, r12, r13, r14;
> > + } get_tdvmcall_info;
> > };
> > } tdx;
> > /* Fix the size of the union. */
>