[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/match-cpu: Support matching on steppings
commit a381e094cfc0ad5b9419fcd4c6f2069d3f973a94 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Jul 16 15:09:16 2025 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Mon Jul 21 12:40:11 2025 +0100 x86/match-cpu: Support matching on steppings Architecturally, stepping is a 4-bit field, so a uint16_t suffices for a bitmap of steppings. In order to keep the size of struct x86_cpu_id the same, shrink the vendor and family fields; there's no need for them to be uint16_t in Xen, and this matches the size of the fields in cpuinfo_x86. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/cpu/common.c | 2 ++ xen/arch/x86/include/asm/match-cpu.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 6ea16edc69..9194ddbd56 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -1022,6 +1022,8 @@ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]) continue; if ( c->model != m->model ) continue; + if ( !((1U << c->stepping) & m->steppings) ) + continue; if ( !cpu_has(c, m->feature) ) continue; diff --git a/xen/arch/x86/include/asm/match-cpu.h b/xen/arch/x86/include/asm/match-cpu.h index f8e4e37d99..e25f414ea1 100644 --- a/xen/arch/x86/include/asm/match-cpu.h +++ b/xen/arch/x86/include/asm/match-cpu.h @@ -8,28 +8,32 @@ #include <asm/intel-family.h> #include <asm/x86-vendors.h> +#define X86_STEPPING_ANY 0xffff #define X86_FEATURE_ANY X86_FEATURE_LM struct x86_cpu_id { - uint16_t vendor; - uint16_t family; + uint8_t vendor; + uint8_t family; uint16_t model; + uint16_t steppings; /* Stepping bitmap, or X86_STEPPING_ANY */ uint16_t feature; /* X86_FEATURE_*, or X86_FEATURE_ANY */ const void *driver_data; }; -#define X86_MATCH_CPU(v, f, m, feat, data) \ +#define X86_MATCH_CPU(v, f, m, steps, feat, data) \ { \ .vendor = (v), \ .family = (f), \ .model = (m), \ + .steppings = (steps), \ .feature = (feat), \ .driver_data = (const void *)(unsigned long)(data), \ } #define X86_MATCH_VFM(vfm, data) \ X86_MATCH_CPU(VFM_VENDOR(vfm), VFM_FAMILY(vfm), \ - VFM_MODEL(vfm), X86_FEATURE_ANY, data) + VFM_MODEL(vfm), X86_STEPPING_ANY, \ + X86_FEATURE_ANY, data) /* * x86_match_cpu() - match the CPU against an array of x86_cpu_ids[] -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |