Re: [PATCH 2/2] KVM: TDX: Remove redundant definitions of TDX_TD_ATTR_*

From: Sean Christopherson
Date: Tue Jul 08 2025 - 10:45:27 EST


On Tue, Jul 08, 2025, Rick P Edgecombe wrote:
> On Tue, 2025-07-08 at 07:03 -0700, Sean Christopherson wrote:
> > > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> > > index c539c2e6109f..efb7d589b672 100644
> > > --- a/arch/x86/kvm/vmx/tdx.c
> > > +++ b/arch/x86/kvm/vmx/tdx.c
> > > @@ -62,7 +62,7 @@ void tdh_vp_wr_failed(struct vcpu_tdx *tdx, char *uclass,
> > > char *op, u32 field,
> > >    pr_err("TDH_VP_WR[%s.0x%x]%s0x%llx failed: 0x%llx\n", uclass,
> > > field, op, val, err);
> > >   }
> > >  
> > > -#define KVM_SUPPORTED_TD_ATTRS (TDX_TD_ATTR_SEPT_VE_DISABLE)
> > > +#define KVM_SUPPORTED_TD_ATTRS (TDX_ATTR_SEPT_VE_DISABLE)
> >
> > Would it make sense to rename KVM_SUPPORTED_TD_ATTRS to
> > KVM_SUPPORTED_TDX_ATTRS?
> > The names from common code lack the TD qualifier, and I think it'd be helpful
> > for
> > readers to have have TDX in the name (even though I agree "TD" is more
> > precise).
>
> It's useful to know that these are per-TD attributes and not per-TDX module.
> Especially for TDX_TD_ATTR_DEBUG. I kind of prefer the KVM naming scheme that is
> removed in this patch.

Heh, as does Xiaoyao, and me too. I thought I was just being nitpicky :-)

Though in that case, I think I'd prefer KVM_SUPPORTED_TDX_TD_ATTRS.