[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/2] x86/cpuid: Infrastructure to support pseudo feature identifiers
A future change will want a cpuid-like identifier which doesn't have a mapping to a feature bit. * Pass the feature name into the parse callback. * Exclude a feature value of ~0u from falling into the general set/clear bit paths. * In gen-cpuid.py, insert a placeholder to collect all the pseudo feature names. No practical change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Henry Wang <Henry.Wang@xxxxxxx> CC: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx> CC: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx> --- xen/arch/x86/cpuid.c | 17 +++++++++++++---- xen/tools/gen-cpuid.py | 13 +++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index 822f9ace1087..112ee63a9449 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -39,7 +39,8 @@ static const struct feature_name { * function pointer call in the middle of the loop. */ static int __init always_inline parse_cpuid( - const char *s, void (*callback)(unsigned int feat, bool val)) + const char *s, void (*callback)(const char *name, + unsigned int feat, bool val)) { const char *ss; int val, rc = 0; @@ -81,7 +82,7 @@ static int __init always_inline parse_cpuid( if ( (val = parse_boolean(mid->name, s, ss)) >= 0 ) { - callback(mid->bit, val); + callback(mid->name, mid->bit, val); mid = NULL; } @@ -101,8 +102,12 @@ static int __init always_inline parse_cpuid( return rc; } -static void __init cf_check _parse_xen_cpuid(unsigned int feat, bool val) +static void __init cf_check _parse_xen_cpuid( + const char *name, unsigned int feat, bool val) { + if ( unlikely(feat == ~0u) ) + return; + if ( !val ) setup_clear_cpu_cap(feat); else if ( feat == X86_FEATURE_RDRAND && @@ -120,8 +125,12 @@ static bool __initdata dom0_cpuid_cmdline; static uint32_t __initdata dom0_enable_feat[FSCAPINTS]; static uint32_t __initdata dom0_disable_feat[FSCAPINTS]; -static void __init cf_check _parse_dom0_cpuid(unsigned int feat, bool val) +static void __init cf_check _parse_dom0_cpuid( + const char *name, unsigned int feat, bool val) { + if ( unlikely(feat == ~0u) ) + return; + __set_bit (feat, val ? dom0_enable_feat : dom0_disable_feat); __clear_bit(feat, val ? dom0_disable_feat : dom0_enable_feat ); } diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py index 4f7c8d78cce7..f3045b3bfd36 100755 --- a/xen/tools/gen-cpuid.py +++ b/xen/tools/gen-cpuid.py @@ -297,6 +297,19 @@ def crunch_numbers(state): RTM: [TSXLDTRK], } + # + # Pseudo feature names. These don't map to a feature bit, but are + # inserted into the values dictionary so they can be parsed and handled + # specially + # + pseduo_names = ( + ) + + for n in pseduo_names: + if n in state.values: + raise Fail("Pseduo feature name %s aliases real feature" % (n, )) + state.values[n] = 0xffffffff + deep_features = tuple(sorted(deps.keys())) state.deep_deps = {} -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |