[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/6] x86/match-cpu: Introduce X86_MATCH_VFM() and convert intel_idle_ids[]
mwait-idle's ICPU() is the most convenient place to get started. Introduce X86_MATCH_CPU() and X86_MATCH_VFM() following their Linux counterparts. This involves match-cpu.h including more headers, which in turn allows us to drop a few. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> We now have X86_FEATURE_ANY and X86_FEATURE_ALWAYS as aliases of LM. Given the contexts they're used in, I've left the naming as-is. It's a bit nasty (preprocessing wise) triple-expanding VFM in X86_MATCH_VFM(), but we need an Integer Constant Expression. --- xen/arch/x86/cpu/intel.c | 1 - xen/arch/x86/cpu/mwait-idle.c | 4 +--- xen/arch/x86/include/asm/match-cpu.h | 21 ++++++++++++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c index ee1ae92cd7e6..26a171aa363e 100644 --- a/xen/arch/x86/cpu/intel.c +++ b/xen/arch/x86/cpu/intel.c @@ -7,7 +7,6 @@ #include <asm/apic.h> #include <asm/i387.h> -#include <asm/intel-family.h> #include <asm/match-cpu.h> #include <asm/mpspec.h> #include <asm/msr.h> diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c index eec2823cbacf..e837cbf50eb3 100644 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -51,7 +51,6 @@ #include <asm/cpuidle.h> #include <asm/hpet.h> -#include <asm/intel-family.h> #include <asm/match-cpu.h> #include <asm/msr.h> #include <asm/mwait.h> @@ -1302,8 +1301,7 @@ static const struct idle_cpu idle_cpu_srf = { }; #define ICPU(model, cpu) \ - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ ## model, X86_FEATURE_ALWAYS, \ - &idle_cpu_ ## cpu} + X86_MATCH_VFM(INTEL_ ## model, &idle_cpu_ ## cpu) static const struct x86_cpu_id intel_idle_ids[] __initconstrel = { ICPU(NEHALEM_EP, nehalem), diff --git a/xen/arch/x86/include/asm/match-cpu.h b/xen/arch/x86/include/asm/match-cpu.h index 2704b84d74c9..dcdc50a70d14 100644 --- a/xen/arch/x86/include/asm/match-cpu.h +++ b/xen/arch/x86/include/asm/match-cpu.h @@ -4,14 +4,33 @@ #include <xen/stdint.h> +#include <asm/cpufeature.h> +#include <asm/intel-family.h> +#include <asm/x86-vendors.h> + +#define X86_FEATURE_ANY X86_FEATURE_LM + struct x86_cpu_id { uint16_t vendor; uint16_t family; uint16_t model; - uint16_t feature; + uint16_t feature; /* X86_FEATURE_*, or X86_FEATURE_ANY */ const void *driver_data; }; +#define X86_MATCH_CPU(v, f, m, feat, data) \ + { \ + .vendor = (v), \ + .family = (f), \ + .model = (m), \ + .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) + /* * x86_match_cpu() - match the CPU against an array of x86_cpu_ids[] * -- 2.39.5
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |