On 8/13/24 00:48, Rick Edgecombe wrote:
+ + cpuid_e = kvm_find_cpuid_entry2(supported_cpuid->entries, supported_cpuid->nent, + dest->leaf, dest->sub_leaf); + if (!cpuid_e) { + dest->eax = dest->ebx = dest->ecx = dest->edx = 0; + } else { + dest->eax &= cpuid_e->eax; + dest->ebx &= cpuid_e->ebx; + dest->ecx &= cpuid_e->ecx; + dest->edx &= cpuid_e->edx; + }
This can only work with CPUID entries that consists of 4*32 features, so it has to be done specifically for each leaf, unfortunately. I suggest defining a kvm_merge_cpuid_entries in cpuid.c that takes two struct cpuid_entry2* that refer to the same leaf and subleaf.
Paolo