Re: [PATCH v14 04/22] KVM: selftests: TDX: Use KVM_TDX_CAPABILITIES to validate TDs' attribute configuration

"Edgecombe, Rick P" <[email protected]>
Newsgroups org.kernel.vger.kvm,dev.linux.lists.linux-coco,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
On Wed, 2026-07-22 at 23:13 +0000, Lisa Wang wrote:
> +static void tdx_check_attributes(struct kvm_vm *vm, u64 attributes)
> +{
> +	struct kvm_tdx_capabilities *tdx_cap;
> +
> +	tdx_cap = tdx_read_capabilities(vm);
> +
> +	/* Make sure all the attributes are reported as supported */
> +	TEST_ASSERT_EQ(attributes & tdx_cap->supported_attrs, attributes);

I think this patch actually does nothing because attributes is passed in as 0?
So 0 & supported == 0. It does exercise KVM_TDX_CAPABILITIES as claimed, but so
does tdx_filter_cpuid(). So for a minimal support, we could probably drop this
patch.

> +}
> +
>  void tdx_init_vm(struct kvm_vm *vm, u64 attributes)
>  {
>  	struct kvm_tdx_init_vm *init_vm;
> @@ -112,6 +122,8 @@ void tdx_init_vm(struct kvm_vm *vm, u64 attributes)
>  	memcpy(&init_vm->cpuid, cpuid, kvm_cpuid2_size(cpuid->nent));
>  	free(cpuid);
>  
> +	tdx_check_attributes(vm, attributes);
> +
>  	init_vm->attributes = attributes;
>  
>  	tdx_vm_ioctl(vm, KVM_TDX_INIT_VM, 0, init_vm);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.