Commit 33588b52 authored by Ingo Molnar's avatar Ingo Molnar

x86/fpu: Simplify print_xstate_features()

We do a boot time printout of xfeatures in print_xstate_features(),
simplify this code to make use of the recently introduced cpu_has_xfeature()
method.

Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 5b073430
...@@ -545,13 +545,12 @@ static void __init setup_xstate_features(void) ...@@ -545,13 +545,12 @@ static void __init setup_xstate_features(void)
} while (1); } while (1);
} }
static void print_xstate_feature(u64 xstate_mask, const char *desc) static void print_xstate_feature(u64 xstate_mask)
{ {
if (xfeatures_mask & xstate_mask) { const char *feature_name;
int xstate_feature = fls64(xstate_mask)-1;
pr_info("x86/fpu: Supporting XSAVE feature %2d: '%s'\n", xstate_feature, desc); if (cpu_has_xfeatures(xstate_mask, &feature_name))
} pr_info("x86/fpu: Supporting XSAVE feature 0x%02Lx: '%s'\n", xstate_mask, feature_name);
} }
/* /*
...@@ -559,14 +558,14 @@ static void print_xstate_feature(u64 xstate_mask, const char *desc) ...@@ -559,14 +558,14 @@ static void print_xstate_feature(u64 xstate_mask, const char *desc)
*/ */
static void print_xstate_features(void) static void print_xstate_features(void)
{ {
print_xstate_feature(XSTATE_FP, "x87 floating point registers"); print_xstate_feature(XSTATE_FP);
print_xstate_feature(XSTATE_SSE, "SSE registers"); print_xstate_feature(XSTATE_SSE);
print_xstate_feature(XSTATE_YMM, "AVX registers"); print_xstate_feature(XSTATE_YMM);
print_xstate_feature(XSTATE_BNDREGS, "MPX bounds registers"); print_xstate_feature(XSTATE_BNDREGS);
print_xstate_feature(XSTATE_BNDCSR, "MPX CSR"); print_xstate_feature(XSTATE_BNDCSR);
print_xstate_feature(XSTATE_OPMASK, "AVX-512 opmask"); print_xstate_feature(XSTATE_OPMASK);
print_xstate_feature(XSTATE_ZMM_Hi256, "AVX-512 Hi256"); print_xstate_feature(XSTATE_ZMM_Hi256);
print_xstate_feature(XSTATE_Hi16_ZMM, "AVX-512 ZMM_Hi256"); print_xstate_feature(XSTATE_Hi16_ZMM);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment