From: Yupeng Li <liyupeng@zbhlos.com>
To: chenhuacai@kernel.org, kernel@xen0n.name, jiaxun.yang@flygoat.com
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
caizp2008@163.com, Yupeng Li <liyupeng@zbhlos.com>
Subject: [PATCH 1/1] LoongArch: Fixed loongarch kernel csr_xxx implicit declaration.
Date: Wed, 31 Aug 2022 14:14:06 +0800 [thread overview]
Message-ID: <20220831061406.431027-1-liyupeng@zbhlos.com> (raw)
Loongarch CSR register operation related interface, use the
interface defined __builtin_loongarch_xxx instead.
Build kernel error messages like:
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
./arch/loongarch/include/asm/loongarch.h: In function 'csr_read64':
./arch/loongarch/include/asm/loongarch.h:237:9: error: implicit declaration of function '__csrrd_d'; did you mean '__iocsrrd_d'? [-Werror=implicit-function-declaration]
return __csrrd_d(reg);
^~~~~~~~~
__iocsrrd_d
./arch/loongarch/include/asm/loongarch.h: In function 'csr_write32':
./arch/loongarch/include/asm/loongarch.h:242:2: error: implicit declaration of function '__csrwr_w'; did you mean '__iocsrwr_w'? [-Werror=implicit-function-declaration]
__csrwr_w(val, reg);
^~~~~~~~~
__iocsrwr_w
./arch/loongarch/include/asm/loongarch.h: In function 'csr_write64':
./arch/loongarch/include/asm/loongarch.h:247:2: error: implicit declaration of function '__csrwr_d'; did you mean '__iocsrwr_d'? [-Werror=implicit-function-declaration]
__csrwr_d(val, reg);
^~~~~~~~~
__iocsrwr_d
./arch/loongarch/include/asm/loongarch.h: In function 'csr_xchg32':
./arch/loongarch/include/asm/loongarch.h:252:9: error: implicit declaration of function '__csrxchg_w'; did you mean '__cmpxchg'? [-Werror=implicit-function-declaration]
return __csrxchg_w(val, mask, reg);
^~~~~~~~~~~
__cmpxchg
./arch/loongarch/include/asm/loongarch.h: In function 'csr_xchg64':
./arch/loongarch/include/asm/loongarch.h:257:9: error: implicit declaration of function '__csrxchg_d'; did you mean '__cmpxchg'? [-Werror=implicit-function-declaration]
return __csrxchg_d(val, mask, reg);
^~~~~~~~~~~
__cmpxchg
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:117:arch/loongarch/kernel/asm-offsets.s] 错误 1
make: *** [Makefile:1205:prepare0] 错误 2
Signed-off-by: Yupeng Li <liyupeng@zbhlos.com>
Signed-off-by: Caicai <caizp2008@163.com>
---
arch/loongarch/include/asm/loongarch.h | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/arch/loongarch/include/asm/loongarch.h b/arch/loongarch/include/asm/loongarch.h
index 3ba4f7e87cd2..576ec266d9fc 100644
--- a/arch/loongarch/include/asm/loongarch.h
+++ b/arch/loongarch/include/asm/loongarch.h
@@ -10,7 +10,6 @@
#include <linux/types.h>
#ifndef __ASSEMBLY__
-#include <larchintrin.h>
/*
* parse_r var, r - Helper assembler macro for parsing register names.
@@ -58,7 +57,7 @@ __asm__(".macro parse_r var r\n\t"
/* CPUCFG */
static inline u32 read_cpucfg(u32 reg)
{
- return __cpucfg(reg);
+ return __builtin_loongarch_cpucfg(reg);
}
#endif /* !__ASSEMBLY__ */
@@ -229,53 +228,53 @@ static inline u32 read_cpucfg(u32 reg)
/* CSR */
static __always_inline u32 csr_read32(u32 reg)
{
- return __csrrd_w(reg);
+ return __builtin_loongarch_csrrd(reg);
}
static __always_inline u64 csr_read64(u32 reg)
{
- return __csrrd_d(reg);
+ return __builtin_loongarch_csrrd(reg);
}
static __always_inline void csr_write32(u32 val, u32 reg)
{
- __csrwr_w(val, reg);
+ __builtin_loongarch_csrwr(val, reg);
}
static __always_inline void csr_write64(u64 val, u32 reg)
{
- __csrwr_d(val, reg);
+ __builtin_loongarch_csrwr(val, reg);
}
static __always_inline u32 csr_xchg32(u32 val, u32 mask, u32 reg)
{
- return __csrxchg_w(val, mask, reg);
+ return __builtin_loongarch_csrxchg(val, mask, reg);
}
static __always_inline u64 csr_xchg64(u64 val, u64 mask, u32 reg)
{
- return __csrxchg_d(val, mask, reg);
+ return __builtin_loongarch_csrxchg(val, mask, reg);
}
/* IOCSR */
static __always_inline u32 iocsr_read32(u32 reg)
{
- return __iocsrrd_w(reg);
+ return __builtin_loongarch_iocsrrd_w(reg);
}
static __always_inline u64 iocsr_read64(u32 reg)
{
- return __iocsrrd_d(reg);
+ return __builtin_loongarch_iocsrrd_d(reg);
}
static __always_inline void iocsr_write32(u32 val, u32 reg)
{
- __iocsrwr_w(val, reg);
+ __builtin_loongarch_iocsrwr_w(val, reg);
}
static __always_inline void iocsr_write64(u64 val, u32 reg)
{
- __iocsrwr_d(val, reg);
+ __builtin_loongarch_iocsrwr_d(val, reg);
}
#endif /* !__ASSEMBLY__ */
--
2.34.1
next reply other threads:[~2022-08-31 6:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 6:14 Yupeng Li [this message]
2022-08-31 6:50 ` Xi Ruoyao
[not found] ` <AGcAvgDYFKf5CnvlznsCy4ok.3.1661932466929.Hmail.liyupeng@zbhlos.com>
2022-08-31 11:09 ` Xi Ruoyao
2022-08-31 14:49 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220831061406.431027-1-liyupeng@zbhlos.com \
--to=liyupeng@zbhlos.com \
--cc=caizp2008@163.com \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®