Re: arch/powerpc/platforms/83xx/suspend.c:210:3: error: call to undeclared function 'enable_kernel_fp'; ISO C99 and later do not support implicit function declarations

From: Randy Dunlap
Date: Sun Feb 19 2023 - 02:13:32 EST


Hi Christophe,

On 2/17/23 22:21, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 38f8ccde04a3fa317b51b05e63c3cb57e1641931
> commit: e8c07082a810fbb9db303a2b66b66b8d7e588b53 Kbuild: move to -std=gnu11
> date: 11 months ago
> config: powerpc-randconfig-r013-20230218 (https://download.01.org/0day-ci/archive/20230218/202302181414.nAdxC08J-lkp@xxxxxxxxx/config)
> compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db89896bbbd2251fff457699635acbbedeead27f)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install powerpc cross compiling tool for clang build
> # apt-get install binutils-powerpc-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e8c07082a810fbb9db303a2b66b66b8d7e588b53
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout e8c07082a810fbb9db303a2b66b66b8d7e588b53
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/platforms/83xx/ drivers/android/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Link: https://lore.kernel.org/oe-kbuild-all/202302181414.nAdxC08J-lkp@xxxxxxxxx/
>
> All errors (new ones prefixed by >>):
>
>>> arch/powerpc/platforms/83xx/suspend.c:210:3: error: call to undeclared function 'enable_kernel_fp'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> enable_kernel_fp();
> ^
> arch/powerpc/platforms/83xx/suspend.c:210:3: note: did you mean 'enable_kernel_vsx'?
> arch/powerpc/include/asm/switch_to.h:75:20: note: 'enable_kernel_vsx' declared here
> static inline void enable_kernel_vsx(void)
> ^
> 1 error generated.
>

When # CONFIG_PPC_FPU is not set, enable_kernel_fp() is not defined.
Looks to me like it is caused by:

commit 7d68c8916950
Author: Christophe Leroy <christophe.leroy@xxxxxxxxxx>
Date: Tue Aug 18 17:19:18 2020 +0000

powerpc/32s: Allow deselecting CONFIG_PPC_FPU on mpc832x

Adding a stub for enable_kernel_fp() in include/asm/switch_to.h
makes this problem disappear. (There is still a different build error.)

Ideas?

Thanks.


>
> vim +/enable_kernel_fp +210 arch/powerpc/platforms/83xx/suspend.c
>
> 87faaabb09d080 Anton Vorontsov 2009-12-10 173
> d49747bdfb2dde Scott Wood 2007-10-09 174 static int mpc83xx_suspend_enter(suspend_state_t state)
> d49747bdfb2dde Scott Wood 2007-10-09 175 {
> d49747bdfb2dde Scott Wood 2007-10-09 176 int ret = -EAGAIN;
> d49747bdfb2dde Scott Wood 2007-10-09 177
> d49747bdfb2dde Scott Wood 2007-10-09 178 /* Don't go to sleep if there's a race where pci_pm_state changes
> d49747bdfb2dde Scott Wood 2007-10-09 179 * between the agent thread checking it and the PM code disabling
> d49747bdfb2dde Scott Wood 2007-10-09 180 * interrupts.
> d49747bdfb2dde Scott Wood 2007-10-09 181 */
> d49747bdfb2dde Scott Wood 2007-10-09 182 if (wake_from_pci) {
> d49747bdfb2dde Scott Wood 2007-10-09 183 if (pci_pm_state != (deep_sleeping ? 3 : 2))
> d49747bdfb2dde Scott Wood 2007-10-09 184 goto out;
> d49747bdfb2dde Scott Wood 2007-10-09 185
> d49747bdfb2dde Scott Wood 2007-10-09 186 out_be32(&pmc_regs->config1,
> d49747bdfb2dde Scott Wood 2007-10-09 187 in_be32(&pmc_regs->config1) | PMCCR1_PME_EN);
> d49747bdfb2dde Scott Wood 2007-10-09 188 }
> d49747bdfb2dde Scott Wood 2007-10-09 189
> d49747bdfb2dde Scott Wood 2007-10-09 190 /* Put the system into low-power mode and the RAM
> d49747bdfb2dde Scott Wood 2007-10-09 191 * into self-refresh mode once the core goes to
> d49747bdfb2dde Scott Wood 2007-10-09 192 * sleep.
> d49747bdfb2dde Scott Wood 2007-10-09 193 */
> d49747bdfb2dde Scott Wood 2007-10-09 194
> d49747bdfb2dde Scott Wood 2007-10-09 195 out_be32(&pmc_regs->config, PMCCR_SLPEN | PMCCR_DLPEN);
> d49747bdfb2dde Scott Wood 2007-10-09 196
> d49747bdfb2dde Scott Wood 2007-10-09 197 /* If it has deep sleep (i.e. it's an 831x or compatible),
> d49747bdfb2dde Scott Wood 2007-10-09 198 * disable power to the core upon entering sleep mode. This will
> d49747bdfb2dde Scott Wood 2007-10-09 199 * require going through the boot firmware upon a wakeup event.
> d49747bdfb2dde Scott Wood 2007-10-09 200 */
> d49747bdfb2dde Scott Wood 2007-10-09 201
> d49747bdfb2dde Scott Wood 2007-10-09 202 if (deep_sleeping) {
> 87faaabb09d080 Anton Vorontsov 2009-12-10 203 mpc83xx_suspend_save_regs();
> 87faaabb09d080 Anton Vorontsov 2009-12-10 204
> d49747bdfb2dde Scott Wood 2007-10-09 205 out_be32(&pmc_regs->mask, PMCER_ALL);
> d49747bdfb2dde Scott Wood 2007-10-09 206
> d49747bdfb2dde Scott Wood 2007-10-09 207 out_be32(&pmc_regs->config1,
> d49747bdfb2dde Scott Wood 2007-10-09 208 in_be32(&pmc_regs->config1) | PMCCR1_POWER_OFF);
> d49747bdfb2dde Scott Wood 2007-10-09 209
> d49747bdfb2dde Scott Wood 2007-10-09 @210 enable_kernel_fp();
> d49747bdfb2dde Scott Wood 2007-10-09 211
> d49747bdfb2dde Scott Wood 2007-10-09 212 mpc83xx_enter_deep_sleep(immrbase);
> d49747bdfb2dde Scott Wood 2007-10-09 213
> d49747bdfb2dde Scott Wood 2007-10-09 214 out_be32(&pmc_regs->config1,
> d49747bdfb2dde Scott Wood 2007-10-09 215 in_be32(&pmc_regs->config1) & ~PMCCR1_POWER_OFF);
> d49747bdfb2dde Scott Wood 2007-10-09 216
> d49747bdfb2dde Scott Wood 2007-10-09 217 out_be32(&pmc_regs->mask, PMCER_PMCI);
> 87faaabb09d080 Anton Vorontsov 2009-12-10 218
> 87faaabb09d080 Anton Vorontsov 2009-12-10 219 mpc83xx_suspend_restore_regs();
> d49747bdfb2dde Scott Wood 2007-10-09 220 } else {
> d49747bdfb2dde Scott Wood 2007-10-09 221 out_be32(&pmc_regs->mask, PMCER_PMCI);
> d49747bdfb2dde Scott Wood 2007-10-09 222
> d49747bdfb2dde Scott Wood 2007-10-09 223 mpc6xx_enter_standby();
> d49747bdfb2dde Scott Wood 2007-10-09 224 }
> d49747bdfb2dde Scott Wood 2007-10-09 225
> d49747bdfb2dde Scott Wood 2007-10-09 226 ret = 0;
> d49747bdfb2dde Scott Wood 2007-10-09 227
> d49747bdfb2dde Scott Wood 2007-10-09 228 out:
> d49747bdfb2dde Scott Wood 2007-10-09 229 out_be32(&pmc_regs->config1,
> d49747bdfb2dde Scott Wood 2007-10-09 230 in_be32(&pmc_regs->config1) & ~PMCCR1_PME_EN);
> d49747bdfb2dde Scott Wood 2007-10-09 231
> d49747bdfb2dde Scott Wood 2007-10-09 232 return ret;
> d49747bdfb2dde Scott Wood 2007-10-09 233 }
> d49747bdfb2dde Scott Wood 2007-10-09 234
>
> :::::: The code at line 210 was first introduced by commit
> :::::: d49747bdfb2ddebea24d1580da55b79d093d48a9 powerpc/mpc83xx: Power Management support
>
> :::::: TO: Scott Wood <scottwood@xxxxxxxxxxxxx>
> :::::: CC: Kumar Gala <galak@xxxxxxxxxxxxxxxxxxx>
>

--
~Randy