* [PATCH 0/3] LoongArch: Fix build errors
@ 2022-07-01 14:49 Guenter Roeck
2022-07-01 14:49 ` [PATCH 1/3] LoongArch: page.h: Add missing include file Guenter Roeck
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Guenter Roeck @ 2022-07-01 14:49 UTC (permalink / raw)
To: Huacai Chen; +Cc: WANG Xuerui, Guo Ren, loongarch, linux-kernel, Guenter Roeck
A number of build errors is seen when trying to build loongarch:allnoconfig
or loongarch:tinyconfig. This patch series tries to fix the observed
errors.
----------------------------------------------------------------
Guenter Roeck (3):
LoongArch: page.h: Add missing include file
LoongArch: Do not include file from toolchain
LoongArch: Always select EFI
arch/loongarch/Kconfig | 6 ++----
arch/loongarch/include/asm/loongarch.h | 23 +++++++++++------------
arch/loongarch/include/asm/page.h | 1 +
3 files changed, 14 insertions(+), 16 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] LoongArch: page.h: Add missing include file
2022-07-01 14:49 [PATCH 0/3] LoongArch: Fix build errors Guenter Roeck
@ 2022-07-01 14:49 ` Guenter Roeck
2022-07-01 14:49 ` [RFC PATCH 2/3] LoongArch: Do not include file from toolchain Guenter Roeck
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2022-07-01 14:49 UTC (permalink / raw)
To: Huacai Chen; +Cc: WANG Xuerui, Guo Ren, loongarch, linux-kernel, Guenter Roeck
Building loongarch:tinyconfig fails with the following error.
./arch/loongarch/include/asm/page.h: In function 'pfn_valid':
./arch/loongarch/include/asm/page.h:42:32: error: 'PHYS_OFFSET' undeclared
Add the missing include file.
Fixes: 09cfefb7fa70 ("LoongArch: Add memory management")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
arch/loongarch/include/asm/page.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/loongarch/include/asm/page.h b/arch/loongarch/include/asm/page.h
index 3dba4986f6c9..8cee37f832aa 100644
--- a/arch/loongarch/include/asm/page.h
+++ b/arch/loongarch/include/asm/page.h
@@ -5,6 +5,7 @@
#ifndef _ASM_PAGE_H
#define _ASM_PAGE_H
+#include <asm/addrspace.h>
#include <linux/const.h>
/*
--
2.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC PATCH 2/3] LoongArch: Do not include file from toolchain
2022-07-01 14:49 [PATCH 0/3] LoongArch: Fix build errors Guenter Roeck
2022-07-01 14:49 ` [PATCH 1/3] LoongArch: page.h: Add missing include file Guenter Roeck
@ 2022-07-01 14:49 ` Guenter Roeck
2022-07-01 14:49 ` [PATCH 3/3] LoongArch: Always select EFI Guenter Roeck
2022-07-02 3:34 ` [PATCH 0/3] LoongArch: Fix build errors Huacai Chen
3 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2022-07-01 14:49 UTC (permalink / raw)
To: Huacai Chen; +Cc: WANG Xuerui, Guo Ren, loongarch, linux-kernel, Guenter Roeck
Building loongarch:allnoconfig with a self-compiled toolchain fails
with the following error.
./arch/loongarch/include/asm/loongarch.h:13:10: fatal error:
larchintrin.h: No such file or directory
loongarch.h includes a file from the toolchain which is not neccessarily
available. Drop the include, and call the builtin functions directly.
Fixes: f2ac457a6138 ("LoongArch: Add CPU definition headers")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
RFC: If the builtins are compiler or compiler version specific,
a separate include file may be needed. Either case, the kernel
should not include files from the toolchain.
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..df57f88b2fc5 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_d(reg);
}
static __always_inline u64 csr_read64(u32 reg)
{
- return __csrrd_d(reg);
+ return __builtin_loongarch_csrrd_d(reg);
}
static __always_inline void csr_write32(u32 val, u32 reg)
{
- __csrwr_w(val, reg);
+ __builtin_loongarch_csrwr_w(val, reg);
}
static __always_inline void csr_write64(u64 val, u32 reg)
{
- __csrwr_d(val, reg);
+ __builtin_loongarch_csrwr_d(val, reg);
}
static __always_inline u32 csr_xchg32(u32 val, u32 mask, u32 reg)
{
- return __csrxchg_w(val, mask, reg);
+ return __builtin_loongarch_csrxchg_w(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_d(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.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] LoongArch: Always select EFI
2022-07-01 14:49 [PATCH 0/3] LoongArch: Fix build errors Guenter Roeck
2022-07-01 14:49 ` [PATCH 1/3] LoongArch: page.h: Add missing include file Guenter Roeck
2022-07-01 14:49 ` [RFC PATCH 2/3] LoongArch: Do not include file from toolchain Guenter Roeck
@ 2022-07-01 14:49 ` Guenter Roeck
2022-07-02 3:34 ` [PATCH 0/3] LoongArch: Fix build errors Huacai Chen
3 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2022-07-01 14:49 UTC (permalink / raw)
To: Huacai Chen; +Cc: WANG Xuerui, Guo Ren, loongarch, linux-kernel, Guenter Roeck
Building loongarch:allnoconfig or loongarch:tinyconfig fails with the
following error.
loongarch64-linux-gnu-ld: arch/loongarch/kernel/env.o: in function `init_environ':
env.c:(.init.text+0xe4): undefined reference to `efi'
loongarch64-linux-gnu-ld: env.c:(.init.text+0xe8): undefined reference to `efi'
loongarch64-linux-gnu-ld: env.c:(.init.text+0xe8): undefined reference to `efi'
loongarch64-linux-gnu-ld: env.c:(.init.text+0x108): undefined reference to `efi_get_fdt_params'
loongarch64-linux-gnu-ld: env.c:(.init.text+0x11c): undefined reference to `efi_memmap_init_early'
loongarch64-linux-gnu-ld: arch/loongarch/kernel/setup.o: in function `platform_init':
setup.c:(.init.text+0x228): undefined reference to `efi_init'
loongarch64-linux-gnu-ld: setup.c:(.init.text+0x250): undefined reference to `efi_runtime_init'
loongarch64-linux-gnu-ld: arch/loongarch/kernel/mem.o: in function `memblock_init':
mem.c:(.init.text+0x24): undefined reference to `efi'
loongarch64-linux-gnu-ld: mem.c:(.init.text+0x28): undefined reference to `efi'
loongarch64-linux-gnu-ld: mem.c:(.init.text+0x28): undefined reference to `efi'
Since it is mandatory, auto-select EFI support to fix the error. Drop the
EFI Kconfig help message since it is not needed.
Fixes: fa96b57c1490 ("LoongArch: Add build infrastructure")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
arch/loongarch/Kconfig | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 1920d52653b4..4ed8d0916be7 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -50,6 +50,7 @@ config LOONGARCH
select ARCH_WANTS_NO_INSTR
select BUILDTIME_TABLE_SORT
select COMMON_CLK
+ select EFI
select GENERIC_CLOCKEVENTS
select GENERIC_CMOS_UPDATE
select GENERIC_CPU_AUTOPROBE
@@ -296,13 +297,10 @@ config DMI
DMI to identify machine quirks.
config EFI
- bool "EFI runtime service support"
+ bool
select UCS2_STRING
select EFI_PARAMS_FROM_FDT
select EFI_RUNTIME_WRAPPERS
- help
- This enables the kernel to use EFI runtime services that are
- available (such as the EFI variable services).
config SMP
bool "Multi-Processing support"
--
2.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] LoongArch: Fix build errors
2022-07-01 14:49 [PATCH 0/3] LoongArch: Fix build errors Guenter Roeck
` (2 preceding siblings ...)
2022-07-01 14:49 ` [PATCH 3/3] LoongArch: Always select EFI Guenter Roeck
@ 2022-07-02 3:34 ` Huacai Chen
3 siblings, 0 replies; 5+ messages in thread
From: Huacai Chen @ 2022-07-02 3:34 UTC (permalink / raw)
To: Guenter Roeck; +Cc: WANG Xuerui, Guo Ren, loongarch, LKML
Hi, Guenter,
On Fri, Jul 1, 2022 at 10:49 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> A number of build errors is seen when trying to build loongarch:allnoconfig
> or loongarch:tinyconfig. This patch series tries to fix the observed
> errors.
Thank you very much for your patches. From my point of view, the first
patch is good, but we usually include <linux/xxx> before <asm/yyy>;
the second patch is not so good, and I think the correct way is modify
the cflags for vdso [1]; and the third patch can be dropped at this
time, until our kernel is bootable.
[1] https://lore.kernel.org/loongarch/20220623044715.2072428-1-chenhuacai@loongson.cn/T/#u
Huacai
>
> ----------------------------------------------------------------
> Guenter Roeck (3):
> LoongArch: page.h: Add missing include file
> LoongArch: Do not include file from toolchain
> LoongArch: Always select EFI
>
> arch/loongarch/Kconfig | 6 ++----
> arch/loongarch/include/asm/loongarch.h | 23 +++++++++++------------
> arch/loongarch/include/asm/page.h | 1 +
> 3 files changed, 14 insertions(+), 16 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-02 3:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 14:49 [PATCH 0/3] LoongArch: Fix build errors Guenter Roeck
2022-07-01 14:49 ` [PATCH 1/3] LoongArch: page.h: Add missing include file Guenter Roeck
2022-07-01 14:49 ` [RFC PATCH 2/3] LoongArch: Do not include file from toolchain Guenter Roeck
2022-07-01 14:49 ` [PATCH 3/3] LoongArch: Always select EFI Guenter Roeck
2022-07-02 3:34 ` [PATCH 0/3] LoongArch: Fix build errors Huacai Chen
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®