arch/loongarch/kernel/process.c:190:46: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Fri Jun 30 2023 - 15:15:53 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 533925cb760431cb496a8c965cfd765a1a21d37e
commit: 49232773d8233ed70c4998851bc84e465fc1c788 LoongArch: Add guess unwinder support
date: 11 months ago
config: loongarch-randconfig-r073-20230627 (https://download.01.org/0day-ci/archive/20230701/202307010315.q5hnCLaT-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230701/202307010315.q5hnCLaT-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307010315.q5hnCLaT-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/process.c:190:46: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned long [noderef] __percpu * @@
arch/loongarch/kernel/process.c:190:46: sparse: expected void *ptr
arch/loongarch/kernel/process.c:190:46: sparse: got unsigned long [noderef] __percpu *
>> arch/loongarch/kernel/process.c:190:46: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned long [noderef] __percpu * @@
arch/loongarch/kernel/process.c:190:46: sparse: expected void *ptr
arch/loongarch/kernel/process.c:190:46: sparse: got unsigned long [noderef] __percpu *
>> arch/loongarch/kernel/process.c:190:46: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned long [noderef] __percpu * @@
arch/loongarch/kernel/process.c:190:46: sparse: expected void *ptr
arch/loongarch/kernel/process.c:190:46: sparse: got unsigned long [noderef] __percpu *
>> arch/loongarch/kernel/process.c:190:46: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned long [noderef] __percpu * @@
arch/loongarch/kernel/process.c:190:46: sparse: expected void *ptr
arch/loongarch/kernel/process.c:190:46: sparse: got unsigned long [noderef] __percpu *
arch/loongarch/kernel/process.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:232:16: sparse: sparse: undefined identifier '__builtin_loongarch_csrrd_w'
arch/loongarch/include/asm/loongarch.h:232:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:242:9: sparse: sparse: undefined identifier '__builtin_loongarch_csrwr_w'
arch/loongarch/include/asm/loongarch.h:242:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:232:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:232:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:232:16: sparse: sparse: cast from unknown type

vim +190 arch/loongarch/kernel/process.c

186
187 bool in_irq_stack(unsigned long stack, struct stack_info *info)
188 {
189 unsigned long nextsp;
> 190 unsigned long begin = (unsigned long)this_cpu_read(irq_stack);
191 unsigned long end = begin + IRQ_STACK_START;
192
193 if (stack < begin || stack >= end)
194 return false;
195
196 nextsp = *(unsigned long *)end;
197 if (nextsp & (SZREG - 1))
198 return false;
199
200 info->begin = begin;
201 info->end = end;
202 info->next_sp = nextsp;
203 info->type = STACK_TYPE_IRQ;
204
205 return true;
206 }
207

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