Re: [PATCH v2 3/8] KVM: TDX: Add a place holder for handler of TDX hypercalls (TDG.VP.VMCALL)

From: Sean Christopherson
Date: Tue Feb 11 2025 - 18:46:29 EST


On Tue, Feb 11, 2025, Chao Gao wrote:
> >@@ -810,6 +829,7 @@ static bool tdx_guest_state_is_invalid(struct kvm_vcpu *vcpu)
> > static __always_inline u32 tdx_to_vmx_exit_reason(struct kvm_vcpu *vcpu)
> > {
> > struct vcpu_tdx *tdx = to_tdx(vcpu);
> >+ u32 exit_reason;
> >
> > switch (tdx->vp_enter_ret & TDX_SEAMCALL_STATUS_MASK) {
> > case TDX_SUCCESS:
> >@@ -822,7 +842,21 @@ static __always_inline u32 tdx_to_vmx_exit_reason(struct kvm_vcpu *vcpu)
> > return -1u;
> > }
> >
> >- return tdx->vp_enter_ret;
> >+ exit_reason = tdx->vp_enter_ret;
> >+
> >+ switch (exit_reason) {
> >+ case EXIT_REASON_TDCALL:
> >+ if (tdvmcall_exit_type(vcpu))
> >+ return EXIT_REASON_VMCALL;
> >+
> >+ if (tdvmcall_leaf(vcpu) < 0x10000)
>
> Can you add a comment for the hard-coded 0x10000?

Or better yet, a #define of some kind (with a comment ;-) ).