Re: [PATCH v16 03/20] KVM: selftests: Initialize the TDX VM

From: Binbin Wu

Date: Mon Nov 09 2026 - 01:01:59 EST


On 11/6/2026 7:46 AM, Lisa Wang wrote:
> From: Sagi Shahar <sagis@xxxxxxxxxx>
>
> Add tdx_init_vm() to handle the mandatory VM-level initialization
> sequence required for Intel TDX.
>
> For TDX, the VM's CPUID configuration must be "sealed" during
> KVM_TDX_INIT_VM before any vCPUs are created. This is necessary because
> the TDX module does not allow the host to create and initialize any
> vCPUs before the VM's CPUID configuration is accepted and sealed into
> the TDCS.
>
> Additionally, to satisfy the strict requirements of the TDH.MNG.INIT
> SEAMCALL, the helper masks the KVM-supported CPUID
> (kvm_get_supported_cpuid()) against the "directly configurable" bits
> reported by KVM_TDX_CAPABILITIES.
>
> Co-developed-by: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
> Co-developed-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
> Signed-off-by: Sagi Shahar <sagis@xxxxxxxxxx>
> Signed-off-by: Lisa Wang <wyihan@xxxxxxxxxx>
> Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>

Reviewed-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>