]> git.ipfire.org Git - thirdparty/qemu.git/commit
i386/cpu: Unify family, model and stepping calculation for x86 CPU
authorXiaoyao Li <xiaoyao.li@intel.com>
Mon, 30 Jun 2025 08:06:10 +0000 (16:06 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 12 Jul 2025 13:28:21 +0000 (15:28 +0200)
commitb6c5b41ba28198030ce2f2b19cf333a9129d07dc
tree4ebbcdfa3ddf113606ff1890b877135def792836
parent3359b588f1f51c1ceaa72eb95cdc7e842d00a5b0
i386/cpu: Unify family, model and stepping calculation for x86 CPU

There are multiple places where CPUID family/model/stepping info
are retrieved from env->cpuid_version.

Besides, the calculation of family and model inside host_cpu_vendor_fms()
doesn't comply to what Intel and AMD define. For family, both Intel
and AMD define that Extended Family ID needs to be counted only when
(base) Family is 0xF. For model, Intel counts Extended Model when
(base) Family is 0x6 or 0xF, while AMD counts EXtended MOdel when
(base) Family is 0xF.

Introduce generic helper functions to get family, model and stepping
from the EAX value of CPUID leaf 1, with the correct calculation
formula.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20250630080610.3151956-5-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/cpu.c
target/i386/cpu.h
target/i386/host-cpu.c
target/i386/kvm/kvm.c