Re: [PATCH 1/1] LoongArch: Fixed loongarch kernel csr_xxx implicit declaration.

From: Xi Ruoyao
Date: Wed Aug 31 2022 - 02:50:21 EST


On Wed, 2022-08-31 at 14:14 +0800, Yupeng Li wrote:
> Loongarch CSR register operation related interface, use the
> interface defined  __builtin_loongarch_xxx instead.
> Build kernel error messages like:

It's likely because you are using a draft version of LoongArch GCC port.
Wrapper functions like __csrrd_w has been there in larchintrin.h since
the first day GCC port was merged upstream
(https://gcc.gnu.org/r12-7881).

A quick search shows IA64 and PowerPC also use GCC ia64intrin.h and
spu_intrinsics.h, so the use of these wrappers are not forbidden in
kernel source.

Unless there is some new good reason for the change,

Nacked-by: Xi Ruoyao <xry111@xxxxxxxxxxx>

>
>   CALL    scripts/atomic/check-atomics.sh
>   CC      arch/loongarch/kernel/asm-offsets.s
> In file included from ./arch/loongarch/include/asm/cpu-info.h:11,
>                  from ./arch/loongarch/include/asm/processor.h:13,
>                  from ./arch/loongarch/include/asm/thread_info.h:15,
>                  from ./include/linux/thread_info.h:60,
>                  from ./include/asm-generic/current.h:5,
>                  from
> ./arch/loongarch/include/generated/asm/current.h:1,
>                  from ./include/linux/sched.h:12,
>                  from arch/loongarch/kernel/asm-offsets.c:8:
> ./arch/loongarch/include/asm/loongarch.h: In function 'csr_read32':
> ./arch/loongarch/include/asm/loongarch.h:232:9: error: implicit
> declaration of function '__csrrd_w'; did you mean '__iocsrrd_w'? [-
> Werror=implicit-function-declaration]
>   return __csrrd_w(reg);
>          ^~~~~~~~~
>          __iocsrrd_w

--
Xi Ruoyao <xry111@xxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University