On Fri, 2024-11-01 at 14:39 +0800, Binbin Wu wrote: > > +static int tdx_read_cpuid(struct kvm_vcpu *vcpu, u32 leaf, u32 sub_leaf, > > + bool sub_leaf_set, struct kvm_cpuid_entry2 *out) > > +{ > > + struct kvm_tdx *kvm_tdx = to_kvm_tdx(vcpu->kvm); > > + u64 field_id = TD_MD_FIELD_ID_CPUID_VALUES; > > + u64 ebx_eax, edx_ecx; > > + u64 err = 0; > > + > > + if (sub_leaf & TDX_MD_UNREADABLE_LEAF_MASK || > > + sub_leaf_set & TDX_MD_UNREADABLE_SUBLEAF_MASK) > > + return -EINVAL; > It looks weird. > Should be the following? > > + if (leaf & TDX_MD_UNREADABLE_LEAF_MASK || > + sub_leaf & TDX_MD_UNREADABLE_SUBLEAF_MASK) > + return -EINVAL; > Yes, nice catch.