mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
826a13acd7
commit
a381e094cf
2 files changed
+10
-4
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
@@ -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[]
|
||||
|
||||