On Fri, Feb 03, 2023 at 02:55:45PM +0800, Yuan Yao <yuan.yao@xxxxxxxxxxxxxxx> wrote: > > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c > > index e68816999387..c4c5a8f786c1 100644 > > --- a/arch/x86/kvm/vmx/tdx.c > > +++ b/arch/x86/kvm/vmx/tdx.c > > @@ -309,6 +309,25 @@ int tdx_vm_init(struct kvm *kvm) > > return 0; > > } > > > > +u8 tdx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) > > +{ > > + /* TDX private GPA is always WB. */ > > + if (gfn & kvm_gfn_shared_mask(vcpu->kvm)) { > > + WARN_ON_ONCE(is_mmio); > > + return MTRR_TYPE_WRBACK << VMX_EPT_MT_EPTE_SHIFT; > > + } > > This looks not clear enough, the comment says things about private GPA > but the code returns WB for shared GPA, please align them. It should be !(gfn & shared mask). Thanks for the catch. -- Isaku Yamahata <isaku.yamahata@xxxxxxxxx>