arch/loongarch/kernel/kfpu.c:17:9: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Fri May 05 2023 - 16:50:35 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7163a2111f6c030ee39635ac3334bfa1a52a3dd3
commit: 2b3bd32ea3a22ea2d5e591da4ac2c2b1fb17c0e0 LoongArch: Provide kernel fpu functions
date: 4 days ago
config: loongarch-randconfig-s043-20230501 (https://download.01.org/0day-ci/archive/20230506/202305060451.grzli3Av-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2b3bd32ea3a22ea2d5e591da4ac2c2b1fb17c0e0
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 2b3bd32ea3a22ea2d5e591da4ac2c2b1fb17c0e0
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash arch/loongarch/kernel/

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/202305060451.grzli3Av-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/kfpu.c:17:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:17:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:17:9: sparse: got bool [noderef] __percpu *
>> arch/loongarch/kernel/kfpu.c:17:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:17:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:17:9: sparse: got bool [noderef] __percpu *
>> arch/loongarch/kernel/kfpu.c:17:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:17:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:17:9: sparse: got bool [noderef] __percpu *
>> arch/loongarch/kernel/kfpu.c:17:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:17:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:17:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:19:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:19:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:19:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:19:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:19:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:19:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:19:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:19:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:19:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:19:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:19:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:19:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:32:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:32:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:32:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:32:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:32:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:32:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:32:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:32:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:32:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:32:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:32:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:32:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:39:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:39:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:39:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:39:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:39:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:39:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:39:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:39:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:39:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c:39:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got bool [noderef] __percpu * @@
arch/loongarch/kernel/kfpu.c:39:9: sparse: expected void *ptr
arch/loongarch/kernel/kfpu.c:39:9: sparse: got bool [noderef] __percpu *
arch/loongarch/kernel/kfpu.c: note: in included file (through arch/loongarch/include/asm/cpu-info.h, arch/loongarch/include/asm/processor.h, ...):
arch/loongarch/include/asm/loongarch.h:211:16: sparse: sparse: undefined identifier '__builtin_loongarch_csrrd_w'
arch/loongarch/include/asm/loongarch.h:211:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:221:9: sparse: sparse: undefined identifier '__builtin_loongarch_csrwr_w'
arch/loongarch/include/asm/loongarch.h:221:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:211:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:221:9: sparse: sparse: cast from unknown type

vim +17 arch/loongarch/kernel/kfpu.c

12
13 void kernel_fpu_begin(void)
14 {
15 preempt_disable();
16
> 17 WARN_ON(this_cpu_read(in_kernel_fpu));
18
19 this_cpu_write(in_kernel_fpu, true);
20
21 if (!is_fpu_owner())
22 enable_fpu();
23 else
24 _save_fp(&current->thread.fpu);
25
26 write_fcsr(LOONGARCH_FCSR0, 0);
27 }
28 EXPORT_SYMBOL_GPL(kernel_fpu_begin);
29

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests