[intel-amx:init-fpstate 2/3] arch/x86/kernel/fpu/xstate.c:364:13: error: implicit declaration of function 'is_supported_xstate_size'

From: kernel test robot
Date: Tue Aug 16 2022 - 23:42:16 EST


tree: https://github.com/intel/amx-linux.git init-fpstate
head: ecaf24cb37353309ec194fa7e091eda041f962df
commit: 427beb3b420197545d034370ab76acf64b804ebc [2/3] x86/fpu: Do the init_fpstate size check with the actual size
config: i386-tinyconfig (https://download.01.org/0day-ci/archive/20220817/202208171117.pKb8AOTV-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel/amx-linux/commit/427beb3b420197545d034370ab76acf64b804ebc
git remote add intel-amx https://github.com/intel/amx-linux.git
git fetch --no-tags intel-amx init-fpstate
git checkout 427beb3b420197545d034370ab76acf64b804ebc
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/fpu/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/x86/kernel/fpu/xstate.c: In function 'setup_init_fpu_buf':
>> arch/x86/kernel/fpu/xstate.c:364:13: error: implicit declaration of function 'is_supported_xstate_size' [-Werror=implicit-function-declaration]
364 | if (is_supported_xstate_size(init_fpstate.size))
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/fpu/xstate.c: At top level:
>> arch/x86/kernel/fpu/xstate.c:690:20: error: conflicting types for 'is_supported_xstate_size'; have 'bool(unsigned int)' {aka '_Bool(unsigned int)'}
690 | static bool __init is_supported_xstate_size(unsigned int test_xstate_size)
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/fpu/xstate.c:364:13: note: previous implicit declaration of 'is_supported_xstate_size' with type 'int()'
364 | if (is_supported_xstate_size(init_fpstate.size))
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/fpu/xstate.c:690:20: warning: 'is_supported_xstate_size' defined but not used [-Wunused-function]
690 | static bool __init is_supported_xstate_size(unsigned int test_xstate_size)
| ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/is_supported_xstate_size +364 arch/x86/kernel/fpu/xstate.c

328
329 /*
330 * All supported features have either init state all zeros or are
331 * handled in setup_init_fpu() individually. This is an explicit
332 * feature list and does not use XFEATURE_MASK*SUPPORTED to catch
333 * newly added supported features at build time and make people
334 * actually look at the init state for the new feature.
335 */
336 #define XFEATURES_INIT_FPSTATE_HANDLED \
337 (XFEATURE_MASK_FP | \
338 XFEATURE_MASK_SSE | \
339 XFEATURE_MASK_YMM | \
340 XFEATURE_MASK_OPMASK | \
341 XFEATURE_MASK_ZMM_Hi256 | \
342 XFEATURE_MASK_Hi16_ZMM | \
343 XFEATURE_MASK_PKRU | \
344 XFEATURE_MASK_BNDREGS | \
345 XFEATURE_MASK_BNDCSR | \
346 XFEATURE_MASK_PASID | \
347 XFEATURE_MASK_XTILE)
348
349 /*
350 * setup the xstate image representing the init state
351 */
352 static int __init setup_init_fpu_buf(void)
353 {
354 BUILD_BUG_ON((XFEATURE_MASK_USER_SUPPORTED |
355 XFEATURE_MASK_SUPERVISOR_SUPPORTED) !=
356 XFEATURES_INIT_FPSTATE_HANDLED);
357
358 if (!boot_cpu_has(X86_FEATURE_XSAVE))
359 return -ENODEV;
360
361 print_xstate_features();
362
363 /* Ensure the space to record the scoped init state. */
> 364 if (is_supported_xstate_size(init_fpstate.size))
365 return -EINVAL;
366
367 xstate_init_xcomp_bv(&init_fpstate.regs.xsave, init_fpstate.xfeatures);
368
369 /*
370 * Init all the features state with header.xfeatures being 0x0
371 */
372 os_xrstor_booting(&init_fpstate.regs.xsave);
373
374 /*
375 * All components are now in init state. Read the state back so
376 * that init_fpstate contains all non-zero init state. This only
377 * works with XSAVE, but not with XSAVEOPT and XSAVEC/S because
378 * those use the init optimization which skips writing data for
379 * components in init state.
380 *
381 * XSAVE could be used, but that would require to reshuffle the
382 * data when XSAVEC/S is available because XSAVEC/S uses xstate
383 * compaction. But doing so is a pointless exercise because most
384 * components have an all zeros init state except for the legacy
385 * ones (FP and SSE). Those can be saved with FXSAVE into the
386 * legacy area. Adding new features requires to ensure that init
387 * state is all zeroes or if not to add the necessary handling
388 * here.
389 */
390 fxsave(&init_fpstate.regs.fxsave);
391 return 0;
392 }
393

--
0-DAY CI Kernel Test Service
https://01.org/lkp