Re: [PATCH v12 050/106] KVM: TDX: MTRR: implement get_mt_mask() for TDX

From: Isaku Yamahata
Date: Fri Mar 10 2023 - 16:18:43 EST


On Thu, Mar 09, 2023 at 05:03:13PM +0800,
Chenyi Qiang <chenyi.qiang@xxxxxxxxx> wrote:

> > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> > index 8f191177bfe9..f532f5c352f3 100644
> > --- a/arch/x86/kvm/vmx/tdx.c
> > +++ b/arch/x86/kvm/vmx/tdx.c
> > @@ -5,6 +5,7 @@
> >
> > #include "capabilities.h"
> > #include "x86_ops.h"
> > +#include "common.h"
> > #include "tdx.h"
> > #include "vmx.h"
> > #include "x86.h"
> > @@ -345,6 +346,22 @@ 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 (kvm_gfn_private(vcpu->kvm, gfn)) {
>
> kvm_gfn_private() only drops shared bit instead of checking if gfn is
> private of shared. It should be !(gfn & shared mask) as mentioned in
> your v11 series :)

Oops. Will fix it. thanks for catching it.
--
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>