On 8/14/2026 4:32 PM, Xiaoyao Li wrote:

[...]
>>   +static void tdx_vcpu_init(struct kvm_vm *vm, struct kvm_vcpu *vcpu)
>> +{
>> +    struct kvm_cpuid2 *cpuid;
>> +
>> +    cpuid = allocate_kvm_cpuid2(MAX_NR_CPUID_ENTRIES);
>> +    tdx_vcpu_ioctl(vcpu, KVM_TDX_GET_CPUID, 0, cpuid);
> 
> If I remember correctly, though KVM_TDX_GET_CPUID is a vcpu ioctl, the data 
> returned by KVM is retrived from TDX module and TDX module only maintains the 
> TD scope CPUID.

KVM_TDX_GET_CPUID does return TD-scoped CPUID metadata only.

> So the CPUID returned here is TD scope, for per-vcpu CPUIDs, e.g., x2apicid, 
> we need to update them accordingly.
> 
> This seems not a functional gap. I'm OK to leave it to the future, but please 
> leave a TODO comment for it.
> 

The handling for legacy VMs is similar, i.e. kvm_get_supported_cpuid()also has
no per-vcpu CPUID info like APIC ID. It seems that KVM selftests doesn't test
CPUID topology enumeration.

A comment could be helpful, although it may not be a TODO comment.


Reply via email to