Skip to content

Commit 69a2fdf

Browse files
ChangSeokBaeIngo Molnar
authored andcommitted
x86/fpu/xstate: Simplify print_xstate_features()
print_xstate_features() currently invokes print_xstate_feature() multiple times on separate lines, which can be simplified in a loop. print_xstate_feature() already checks the feature's enabled status and is only called within print_xstate_features(). Inline print_xstate_feature() and iterate over features in a loop to streamline the enabling message. No functional changes. Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://lore.kernel.org/r/20250227184502.10288-2-chang.seok.bae@intel.com
1 parent dc8aa31 commit 69a2fdf

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

arch/x86/kernel/fpu/xstate.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -259,32 +259,20 @@ static void __init setup_xstate_cache(void)
259259
}
260260
}
261261

262-
static void __init print_xstate_feature(u64 xstate_mask)
263-
{
264-
const char *feature_name;
265-
266-
if (cpu_has_xfeatures(xstate_mask, &feature_name))
267-
pr_info("x86/fpu: Supporting XSAVE feature 0x%03Lx: '%s'\n", xstate_mask, feature_name);
268-
}
269-
270262
/*
271263
* Print out all the supported xstate features:
272264
*/
273265
static void __init print_xstate_features(void)
274266
{
275-
print_xstate_feature(XFEATURE_MASK_FP);
276-
print_xstate_feature(XFEATURE_MASK_SSE);
277-
print_xstate_feature(XFEATURE_MASK_YMM);
278-
print_xstate_feature(XFEATURE_MASK_BNDREGS);
279-
print_xstate_feature(XFEATURE_MASK_BNDCSR);
280-
print_xstate_feature(XFEATURE_MASK_OPMASK);
281-
print_xstate_feature(XFEATURE_MASK_ZMM_Hi256);
282-
print_xstate_feature(XFEATURE_MASK_Hi16_ZMM);
283-
print_xstate_feature(XFEATURE_MASK_PKRU);
284-
print_xstate_feature(XFEATURE_MASK_PASID);
285-
print_xstate_feature(XFEATURE_MASK_CET_USER);
286-
print_xstate_feature(XFEATURE_MASK_XTILE_CFG);
287-
print_xstate_feature(XFEATURE_MASK_XTILE_DATA);
267+
int i;
268+
269+
for (i = 0; i < XFEATURE_MAX; i++) {
270+
u64 mask = BIT_ULL(i);
271+
const char *name;
272+
273+
if (cpu_has_xfeatures(mask, &name))
274+
pr_info("x86/fpu: Supporting XSAVE feature 0x%03Lx: '%s'\n", mask, name);
275+
}
288276
}
289277

290278
/*

0 commit comments

Comments
 (0)