Re: [PATCH 08/16] KVM: x86/mmu: Bug the VM if kvm_zap_gfn_range() is called for TDX

From: Sean Christopherson
Date: Wed May 15 2024 - 19:26:27 EST


On Wed, May 15, 2024, Rick P Edgecombe wrote:
> On Wed, 2024-05-15 at 12:48 -0700, Sean Christopherson wrote:
> > > It's just another little quirk in an already complicated solution. They
> > > third
> > > thing we discussed was somehow rejecting or not supporting non-coherent DMA.
> > > This seemed simpler than that.
> >
> > Again, huh?  This has _nothing_ to do with non-coherent DMA.  Devices can't
> > DMA
> > into TDX private memory.
>
> Hmm... I'm confused how you are confused... :)
>
> For normal VMs (after that change you linked), guests will honor guest PAT on
> newer HW. On older HW it will only honor guest PAT if non-coherent DMA is
> attached.
>
> For TDX we can't honor guest PAT for private memory. So we can either have:
> 1. Have shared honor PAT and private not.
> 2. Have private and shared both not honor PAT and be consistent. Unless non-
> coherent DMA is attached. In that case KVM could zap shared only and switch to
> 1.

Oh good gravy, hell no :-)