Re: [PATCH v11 025/113] KVM: TDX: Use private memory for TDX
From: Sean Christopherson
Date: Tue Jan 17 2023 - 20:20:24 EST
On Tue, Jan 17, 2023, Huang, Kai wrote:
> On Tue, 2023-01-17 at 16:40 +0000, Sean Christopherson wrote:
> > On Mon, Jan 16, 2023, Huang, Kai wrote:
> > > AMD's series has a different solution:
> > >
> > > https://lore.kernel.org/lkml/20221214194056.161492-3-michael.roth@xxxxxxx/
> > >
> > > I think somehow this needs to get aligned.
> >
> > Ya. My thought is
> >
> > bool kvm_arch_has_private_mem(struct kvm *kvm)
> > {
> > return kvm->arch.vm_type != KVM_X86_DEFAULT_VM;
> > }
> >
> > where the VM types end up being:
> >
> > #define KVM_X86_DEFAULT_VM 0
> > #define KVM_X86_PROTECTED_VM 1
> > #define KVM_X86_TDX_VM 2
> > #define KVM_X86_SNP_VM 3
>
> What's the difference between PROTECTED_VM vs TDX_VM/SNP_VM, may I ask?
Not sure :-)
At this point, PROTECTED_VM is a handwavy "guest that can access restricted memory".
I think/hope it can be used in combination with existing SEV/SEV-ES APIs to allow
backing such guests with restrictedmem.
As for TDX_VM and SNP_VM, I'm speculating that KVM will need to differentiate between
SNP, TDX, and everything else. E.g. if KVM needs to uniquely identify TDX VMs at
creation time, then adding dedicated VM types seems like the obvious choice. Ditto
for SNP VMs.
That's partly why I want to smush everything together, to see if we actually need
multiple VM types.