[PATCH v7 088/120] KVM: x86: Use standard CPUID(0xa) types
"Ahmed S. Darwish" <[email protected]> Thu, 28 May 2026 17:38:50 +0200
| Newsgroups | dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
For KVM guest CPUID build-up, use the auto-generated CPUID(0xa) types from x86-cpuid-db instead of relying on the custom perf types. The latter types are in process of getting removed from the kernel. Signed-off-by: Ahmed S. Darwish <[email protected]> --- arch/x86/kvm/cpuid.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index e69156b54cff..706903ad6628 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -1504,28 +1504,28 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) } break; case 0xa: { /* Architectural Performance Monitoring */ - union cpuid10_eax eax = { }; - union cpuid10_edx edx = { }; + struct leaf_0xa_0 l = { }; + struct cpuid_regs *regs = (struct cpuid_regs *)&l; if (!enable_pmu || !static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { entry->eax = entry->ebx = entry->ecx = entry->edx = 0; break; } - eax.split.version_id = kvm_pmu_cap.version; - eax.split.num_counters = kvm_pmu_cap.num_counters_gp; - eax.split.bit_width = kvm_pmu_cap.bit_width_gp; - eax.split.mask_length = kvm_pmu_cap.events_mask_len; - edx.split.num_counters_fixed = kvm_pmu_cap.num_counters_fixed; - edx.split.bit_width_fixed = kvm_pmu_cap.bit_width_fixed; + l.pmu_version = kvm_pmu_cap.version; + l.num_counters_gp = kvm_pmu_cap.num_counters_gp; + l.bit_width_gp = kvm_pmu_cap.bit_width_gp; + l.events_mask_len = kvm_pmu_cap.events_mask_len; + l.num_counters_fixed = kvm_pmu_cap.num_counters_fixed; + l.bitwidth_fixed = kvm_pmu_cap.bit_width_fixed; if (kvm_pmu_cap.version) - edx.split.anythread_deprecated = 1; + l.anythread_deprecation = 1; - entry->eax = eax.full; + entry->eax = regs->eax; entry->ebx = kvm_pmu_cap.events_mask; entry->ecx = 0; - entry->edx = edx.full; + entry->edx = regs->edx; break; } case 0x1f: -- 2.54.0