Re: [PATCH v14 19/22] KVM: selftests: Finalize TD memory as part of kvm_arch_vm_finalize_vcpus

From: Ackerley Tng

Date: Tue Sep 08 2026 - 19:24:49 EST


Xiaoyao Li <xiaoyao.li@xxxxxxxxx> writes:

> On 7/23/2026 7:13 AM, Lisa Wang wrote:
>> From: Sagi Shahar <sagis@xxxxxxxxxx>
>>
>> Finalize TDX VM after creation to make it runnable.
>
> The changelog is too weak.
>

Some other points I can think of (Xiaoyao, please add on!):

+ Why was kvm_arch_vm_finalize_vcpus() was picked as the lifecycle hook
in which to finalize the VM? (See comments from the earlier revision
from Sean) What are the rejected alternatives?
+ Expand on "make it runnable": finalizing also performs measurements

Just confirming: Peter, you meant to add the () at the end of
kvm_arch_vm_finalize_vcpus in the commit subject, right?

>>
>> Signed-off-by: Sagi Shahar <sagis@xxxxxxxxxx>
>> Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>
>> Signed-off-by: Lisa Wang <wyihan@xxxxxxxxxx>
>> ---
>> tools/testing/selftests/kvm/lib/x86/processor.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/tools/testing/selftests/kvm/lib/x86/processor.c b/tools/testing/selftests/kvm/lib/x86/processor.c
>> index 4b97a9a1bb5e..8319ae3d9fe6 100644
>> --- a/tools/testing/selftests/kvm/lib/x86/processor.c
>> +++ b/tools/testing/selftests/kvm/lib/x86/processor.c
>> @@ -1489,6 +1489,12 @@ bool kvm_arch_has_default_irqchip(void)
>> return true;
>> }
>>
>> +void kvm_arch_vm_finalize_vcpus(struct kvm_vm *vm)
>> +{
>> + if (is_tdx_vm(vm))
>> + tdx_vm_finalize(vm);
>> +}
>> +
>> void setup_smram(struct kvm_vm *vm, struct kvm_vcpu *vcpu, u64 smram_gpa,
>> const void *smi_handler, size_t handler_size)
>> {
>>