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);