* [PATCH 0/1] MIPS: fix compilation error
@ 2021-03-26 13:41 Mauri Sandberg
2021-03-26 13:41 ` [PATCH 1/1] MIPS: kernel: setup.c: " Mauri Sandberg
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Mauri Sandberg @ 2021-03-26 13:41 UTC (permalink / raw)
To: linux-mips; +Cc: tsbogend, f.fainelli, Mauri Sandberg
Hello!
I hit into a compilation error while making a build for ath79
It apparently seems to have a trivial fix but I cannot say for sure with
superficial investigation. Adding into CC: the author and reviewer of the
commit that appears to be the root cause. You might have a better
understanding of the causes and consequences.
Root cause:
commit b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
When reproducing the error my diff of the default ath79_defconfig is:
-# CONFIG_RD_GZIP is not set
+CONFIG_INITRAMFS_SOURCE="initramfs.txt"
-CONFIG_MIPS_CMDLINE_FROM_DTB=y
+CONFIG_PRINTK_TIME=y
-CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
+CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=ramfs"
+CONFIG_CMDLINE_OVERRIDE=y
Cheers,
Mauri
Mauri Sandberg (1):
MIPS: kernel: setup.c: fix compilation error
arch/mips/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
base-commit: 509d36a941a3466b78d4377913623d210b162458
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/1] MIPS: kernel: setup.c: fix compilation error
2021-03-26 13:41 [PATCH 0/1] MIPS: fix compilation error Mauri Sandberg
@ 2021-03-26 13:41 ` Mauri Sandberg
2021-03-26 16:46 ` [PATCH v2 0/1] MIPS: " Mauri Sandberg
2021-03-29 12:31 ` [PATCH v3 " Mauri Sandberg
2 siblings, 0 replies; 12+ messages in thread
From: Mauri Sandberg @ 2021-03-26 13:41 UTC (permalink / raw)
To: linux-mips; +Cc: tsbogend, f.fainelli, Mauri Sandberg
Developing against mips/mips-next I get a compilation error.
With the attached patch compilation succeeds.
Build log:
...
CC kernel/locking/percpu-rwsem.o
../arch/mips/kernel/setup.c:46:39: error: conflicting types for
'__appended_dtb'
const char __section(".appended_dtb") __appended_dtb[0x100000];
^~~~~~~~~~~~~~
In file included from ../arch/mips/kernel/setup.c:34:
../arch/mips/include/asm/bootinfo.h:118:13: note: previous declaration
of '__appended_dtb' was here
extern char __appended_dtb[];
^~~~~~~~~~~~~~
CC fs/attr.o
make[4]: *** [../scripts/Makefile.build:271: arch/mips/kernel/setup.o]
Error 1
make[3]: *** [../scripts/Makefile.build:514: arch/mips/kernel] Error 2
make[2]: *** [/home/ubuntu/git/linux/Makefile:1849: arch/mips] Error 2
make[2]: *** Waiting for unfinished jobs....
...
Root cause seems to be:
commit b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
---
arch/mips/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 279be0153f8b..23a140327a0b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -43,7 +43,7 @@
#include <asm/prom.h>
#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
-const char __section(".appended_dtb") __appended_dtb[0x100000];
+char __section(".appended_dtb") __appended_dtb[0x100000];
#endif /* CONFIG_MIPS_ELF_APPENDED_DTB */
struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
--
2.25.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 0/1] MIPS: fix compilation error
2021-03-26 13:41 [PATCH 0/1] MIPS: fix compilation error Mauri Sandberg
2021-03-26 13:41 ` [PATCH 1/1] MIPS: kernel: setup.c: " Mauri Sandberg
@ 2021-03-26 16:46 ` Mauri Sandberg
2021-03-26 16:46 ` [PATCH v2 1/1] Revert "MIPS: of: Introduce helper function to get DTB" Mauri Sandberg
2021-03-27 9:40 ` [PATCH v2 0/1] MIPS: fix compilation error Thomas Bogendoerfer
2021-03-29 12:31 ` [PATCH v3 " Mauri Sandberg
2 siblings, 2 replies; 12+ messages in thread
From: Mauri Sandberg @ 2021-03-26 16:46 UTC (permalink / raw)
To: sandberg; +Cc: f.fainelli, linux-mips, tsbogend
Earlier I had some confusion with my configuration as compared to
ath79_defconfig but now it looks like that enabling
CONFIG_MIPS_ELF_APPENDED_DTB alone will break compilation.
Simple fix of removing 'const' did not work and something more is needed.
At this point I would suggest reverting the patch until it's properly
fixed.
I am willing to help with testing if that is needed.
Thanks,
Mauri
Mauri Sandberg (1):
Revert "MIPS: of: Introduce helper function to get DTB"
arch/mips/ath79/setup.c | 13 ++++++-----
arch/mips/bmips/setup.c | 7 +++---
arch/mips/generic/init.c | 5 +++--
arch/mips/include/asm/bootinfo.h | 22 +------------------
arch/mips/include/asm/octeon/octeon.h | 1 +
arch/mips/kernel/head.S | 31 +++++++++++++++++++++++++++
arch/mips/kernel/setup.c | 4 ++++
arch/mips/lantiq/prom.c | 7 ++++--
arch/mips/pic32/pic32mzda/init.c | 15 ++++++++++++-
arch/mips/ralink/of.c | 11 +++++++---
10 files changed, 77 insertions(+), 39 deletions(-)
base-commit: 509d36a941a3466b78d4377913623d210b162458
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/1] Revert "MIPS: of: Introduce helper function to get DTB"
2021-03-26 16:46 ` [PATCH v2 0/1] MIPS: " Mauri Sandberg
@ 2021-03-26 16:46 ` Mauri Sandberg
2021-03-27 9:40 ` [PATCH v2 0/1] MIPS: fix compilation error Thomas Bogendoerfer
1 sibling, 0 replies; 12+ messages in thread
From: Mauri Sandberg @ 2021-03-26 16:46 UTC (permalink / raw)
To: sandberg; +Cc: f.fainelli, linux-mips, tsbogend
Ath79 does not compile if CONFIG_MIPS_ELF_APPENDED_DTB is enabled. Simple
removal of 'const' fixes compilation but booting a device is stopped
short.
This reverts commit b83ba0b9df56f8404ccc6ebcc7050fb8294f0f20.
Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
---
arch/mips/ath79/setup.c | 13 ++++++-----
arch/mips/bmips/setup.c | 7 +++---
arch/mips/generic/init.c | 5 +++--
arch/mips/include/asm/bootinfo.h | 22 +------------------
arch/mips/include/asm/octeon/octeon.h | 1 +
arch/mips/kernel/head.S | 31 +++++++++++++++++++++++++++
arch/mips/kernel/setup.c | 4 ++++
arch/mips/lantiq/prom.c | 7 ++++--
arch/mips/pic32/pic32mzda/init.c | 15 ++++++++++++-
arch/mips/ralink/of.c | 11 +++++++---
10 files changed, 77 insertions(+), 39 deletions(-)
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
index 891f495c4c3c..7e7bf9c2ad26 100644
--- a/arch/mips/ath79/setup.c
+++ b/arch/mips/ath79/setup.c
@@ -213,17 +213,16 @@ unsigned int get_c0_compare_int(void)
void __init plat_mem_setup(void)
{
- void *dtb;
+ unsigned long fdt_start;
set_io_port_base(KSEG1);
/* Get the position of the FDT passed by the bootloader */
- dtb = (void *)fw_getenvl("fdt_start");
- if (dtb == NULL)
- dtb = get_fdt();
-
- if (dtb)
- __dt_setup_arch((void *)KSEG0ADDR(dtb));
+ fdt_start = fw_getenvl("fdt_start");
+ if (fdt_start)
+ __dt_setup_arch((void *)KSEG0ADDR(fdt_start));
+ else if (fw_passed_dtb)
+ __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb));
ath79_reset_base = ioremap(AR71XX_RESET_BASE,
AR71XX_RESET_SIZE);
diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
index 31bcfa4e08b9..7392edbd19e7 100644
--- a/arch/mips/bmips/setup.c
+++ b/arch/mips/bmips/setup.c
@@ -161,10 +161,11 @@ void __init plat_mem_setup(void)
/* intended to somewhat resemble ARM; see Documentation/arm/booting.rst */
if (fw_arg0 == 0 && fw_arg1 == 0xffffffff)
dtb = phys_to_virt(fw_arg2);
+ else if (fw_passed_dtb) /* UHI interface or appended dtb */
+ dtb = (void *)fw_passed_dtb;
+ else if (&__dtb_start != &__dtb_end)
+ dtb = (void *)__dtb_start;
else
- dtb = get_fdt();
-
- if (!dtb)
panic("no dtb found");
__dt_setup_arch(dtb);
diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
index 1842cddd8356..68763fcde1d0 100644
--- a/arch/mips/generic/init.c
+++ b/arch/mips/generic/init.c
@@ -39,13 +39,14 @@ void __init *plat_get_fdt(void)
/* Already set up */
return (void *)fdt;
- fdt = (void *)get_fdt();
- if (fdt && !fdt_check_header(fdt)) {
+ if (fw_passed_dtb && !fdt_check_header((void *)fw_passed_dtb)) {
/*
* We have been provided with the appropriate device tree for
* the board. Make use of it & search for any machine struct
* based upon the root compatible string.
*/
+ fdt = (void *)fw_passed_dtb;
+
for_each_mips_machine(check_mach) {
match = mips_machine_is_compatible(check_mach, fdt);
if (match) {
diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index 5be10ece3ef0..aa03b1237155 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -112,27 +112,7 @@ extern char arcs_cmdline[COMMAND_LINE_SIZE];
extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
#ifdef CONFIG_USE_OF
-#include <linux/libfdt.h>
-#include <linux/of_fdt.h>
-
-extern char __appended_dtb[];
-
-static inline void *get_fdt(void)
-{
- if (IS_ENABLED(CONFIG_MIPS_RAW_APPENDED_DTB) ||
- IS_ENABLED(CONFIG_MIPS_ELF_APPENDED_DTB))
- if (fdt_magic(&__appended_dtb) == FDT_MAGIC)
- return &__appended_dtb;
-
- if (fw_arg0 == -2) /* UHI interface */
- return (void *)fw_arg1;
-
- if (IS_ENABLED(CONFIG_BUILTIN_DTB))
- if (&__dtb_start != &__dtb_end)
- return &__dtb_start;
-
- return NULL;
-}
+extern unsigned long fw_passed_dtb;
#endif
/*
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h
index 7e714aefc76d..08d48f37c046 100644
--- a/arch/mips/include/asm/octeon/octeon.h
+++ b/arch/mips/include/asm/octeon/octeon.h
@@ -282,6 +282,7 @@ union octeon_cvmemctl {
extern void octeon_check_cpu_bist(void);
int octeon_prune_device_tree(void);
+extern const char __appended_dtb;
extern const char __dtb_octeon_3xxx_begin;
extern const char __dtb_octeon_68xx_begin;
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index b825ed4476c7..61b73580b877 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -93,6 +93,33 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
jr t0
0:
+#ifdef CONFIG_USE_OF
+#if defined(CONFIG_MIPS_RAW_APPENDED_DTB) || \
+ defined(CONFIG_MIPS_ELF_APPENDED_DTB)
+
+ PTR_LA t2, __appended_dtb
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ li t1, 0xd00dfeed
+#else /* !CONFIG_CPU_BIG_ENDIAN */
+ li t1, 0xedfe0dd0
+#endif /* !CONFIG_CPU_BIG_ENDIAN */
+ lw t0, (t2)
+ beq t0, t1, dtb_found
+#endif /* CONFIG_MIPS_RAW_APPENDED_DTB || CONFIG_MIPS_ELF_APPENDED_DTB */
+ li t1, -2
+ move t2, a1
+ beq a0, t1, dtb_found
+
+#ifdef CONFIG_BUILTIN_DTB
+ PTR_LA t2, __dtb_start
+ PTR_LA t1, __dtb_end
+ bne t1, t2, dtb_found
+#endif /* CONFIG_BUILTIN_DTB */
+
+ li t2, 0
+dtb_found:
+#endif /* CONFIG_USE_OF */
PTR_LA t0, __bss_start # clear .bss
LONG_S zero, (t0)
PTR_LA t1, __bss_stop - LONGSIZE
@@ -106,6 +133,10 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
LONG_S a2, fw_arg2
LONG_S a3, fw_arg3
+#ifdef CONFIG_USE_OF
+ LONG_S t2, fw_passed_dtb
+#endif
+
MTC0 zero, CP0_CONTEXT # clear context register
#ifdef CONFIG_64BIT
MTC0 zero, CP0_XCONTEXT
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 279be0153f8b..2546f2fd2eb6 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -784,6 +784,10 @@ void __init setup_arch(char **cmdline_p)
unsigned long kernelsp[NR_CPUS];
unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
+#ifdef CONFIG_USE_OF
+unsigned long fw_passed_dtb;
+#endif
+
#ifdef CONFIG_DEBUG_FS
struct dentry *mips_debugfs_dir;
static int __init debugfs_mips(void)
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index bc9f58fcbdf9..363937121617 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -73,8 +73,11 @@ void __init plat_mem_setup(void)
set_io_port_base((unsigned long) KSEG1);
- dtb = get_fdt();
- if (dtb == NULL)
+ if (fw_passed_dtb) /* UHI interface */
+ dtb = (void *)fw_passed_dtb;
+ else if (&__dtb_start != &__dtb_end)
+ dtb = (void *)__dtb_start;
+ else
panic("no dtb found");
/*
diff --git a/arch/mips/pic32/pic32mzda/init.c b/arch/mips/pic32/pic32mzda/init.c
index 764f2d022fae..1897aa863573 100644
--- a/arch/mips/pic32/pic32mzda/init.c
+++ b/arch/mips/pic32/pic32mzda/init.c
@@ -21,11 +21,24 @@ const char *get_system_type(void)
return "PIC32MZDA";
}
+static ulong get_fdtaddr(void)
+{
+ ulong ftaddr = 0;
+
+ if (fw_passed_dtb && !fw_arg2 && !fw_arg3)
+ return (ulong)fw_passed_dtb;
+
+ if (&__dtb_start < &__dtb_end)
+ ftaddr = (ulong)__dtb_start;
+
+ return ftaddr;
+}
+
void __init plat_mem_setup(void)
{
void *dtb;
- dtb = get_fdt();
+ dtb = (void *)get_fdtaddr();
if (!dtb) {
pr_err("pic32: no DTB found.\n");
return;
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 8286c3521476..2c9af61efc20 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -64,15 +64,20 @@ static int __init early_init_dt_find_memory(unsigned long node,
void __init plat_mem_setup(void)
{
- void *dtb;
+ void *dtb = NULL;
set_io_port_base(KSEG1);
/*
* Load the builtin devicetree. This causes the chosen node to be
- * parsed resulting in our memory appearing.
+ * parsed resulting in our memory appearing. fw_passed_dtb is used
+ * by CONFIG_MIPS_APPENDED_RAW_DTB as well.
*/
- dtb = get_fdt();
+ if (fw_passed_dtb)
+ dtb = (void *)fw_passed_dtb;
+ else if (&__dtb_start != &__dtb_end)
+ dtb = (void *)__dtb_start;
+
__dt_setup_arch(dtb);
of_scan_flat_dt(early_init_dt_find_memory, NULL);
--
2.25.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 0/1] MIPS: fix compilation error
2021-03-26 16:46 ` [PATCH v2 0/1] MIPS: " Mauri Sandberg
2021-03-26 16:46 ` [PATCH v2 1/1] Revert "MIPS: of: Introduce helper function to get DTB" Mauri Sandberg
@ 2021-03-27 9:40 ` Thomas Bogendoerfer
2021-03-27 13:39 ` Mauri Sandberg
1 sibling, 1 reply; 12+ messages in thread
From: Thomas Bogendoerfer @ 2021-03-27 9:40 UTC (permalink / raw)
To: Mauri Sandberg; +Cc: f.fainelli, linux-mips
On Fri, Mar 26, 2021 at 06:46:44PM +0200, Mauri Sandberg wrote:
> Earlier I had some confusion with my configuration as compared to
> ath79_defconfig but now it looks like that enabling
> CONFIG_MIPS_ELF_APPENDED_DTB alone will break compilation.
>
> Simple fix of removing 'const' did not work and something more is needed.
your first fix works perfect for me. Could please describe what the error
is ?
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 0/1] MIPS: fix compilation error
2021-03-27 9:40 ` [PATCH v2 0/1] MIPS: fix compilation error Thomas Bogendoerfer
@ 2021-03-27 13:39 ` Mauri Sandberg
0 siblings, 0 replies; 12+ messages in thread
From: Mauri Sandberg @ 2021-03-27 13:39 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: f.fainelli, linux-mips
> ----------------------------------------
> From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> On Fri, Mar 26, 2021 at 06:46:44PM +0200, Mauri Sandberg wrote:
> > Earlier I had some confusion with my configuration as compared to
> > ath79_defconfig but now it looks like that enabling
> > CONFIG_MIPS_ELF_APPENDED_DTB alone will break compilation.
> >
> > Simple fix of removing 'const' did not work and something more is needed.
>
> your first fix works perfect for me. Could please describe what the error
> is ?
With fresh pair of eyes I must agree and it really does work. The freeze during boot must
have been related to something else and the v2 can be forgotten.
-- Mauri
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 0/1] MIPS: fix compilation error
2021-03-26 13:41 [PATCH 0/1] MIPS: fix compilation error Mauri Sandberg
2021-03-26 13:41 ` [PATCH 1/1] MIPS: kernel: setup.c: " Mauri Sandberg
2021-03-26 16:46 ` [PATCH v2 0/1] MIPS: " Mauri Sandberg
@ 2021-03-29 12:31 ` Mauri Sandberg
2021-03-29 12:31 ` [PATCH v3 1/1] MIPS: kernel: setup.c: " Mauri Sandberg
2 siblings, 1 reply; 12+ messages in thread
From: Mauri Sandberg @ 2021-03-29 12:31 UTC (permalink / raw)
To: sandberg; +Cc: f.fainelli, linux-mips, tsbogend
Hello,
Cleaned up the commit message and added reviewed-by, tested-by and Cc: tags.
Cheers,
Mauri
--
Notes
v2:
- errorneous proposal to revert whole commit. withdrawn.
v3:
- as v1.
- Added Reviewed-by: and Tested-By for Thomas Bogendoerfer
- reworded commit message
- added Cc: trivial@kernel.org
rangediff v1...v3
1: cff3565c8f48 ! 1: e4e83543be07 MIPS: kernel: setup.c: fix compilation error
@@ Metadata
## Commit message ##
MIPS: kernel: setup.c: fix compilation error
- Developing against mips/mips-next I get a compilation error.
- With the attached patch compilation succeeds.
+ With ath79_defconfig enabling CONFIG_MIPS_ELF_APPENDED_DTB gives a
+ compilation error. This patch fixes it.
Build log:
...
@@ Commit message
CC fs/attr.o
make[4]: *** [../scripts/Makefile.build:271: arch/mips/kernel/setup.o]
Error 1
- make[3]: *** [../scripts/Makefile.build:514: arch/mips/kernel] Error 2
- make[2]: *** [/home/ubuntu/git/linux/Makefile:1849: arch/mips] Error 2
- make[2]: *** Waiting for unfinished jobs....
...
Root cause seems to be:
- commit b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
+ Fixes: b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
+ Reviewed-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+ Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+ Cc: trivial@kernel.org
## arch/mips/kernel/setup.c ##
@@
Mauri Sandberg (1):
MIPS: kernel: setup.c: fix compilation error
arch/mips/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
base-commit: 19f0e8cddf0f136112acaaf02dab2cee35b56439
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 1/1] MIPS: kernel: setup.c: fix compilation error
2021-03-29 12:31 ` [PATCH v3 " Mauri Sandberg
@ 2021-03-29 12:31 ` Mauri Sandberg
2021-03-30 12:53 ` Thomas Bogendoerfer
0 siblings, 1 reply; 12+ messages in thread
From: Mauri Sandberg @ 2021-03-29 12:31 UTC (permalink / raw)
To: sandberg; +Cc: f.fainelli, linux-mips, tsbogend, trivial
With ath79_defconfig enabling CONFIG_MIPS_ELF_APPENDED_DTB gives a
compilation error. This patch fixes it.
Build log:
...
CC kernel/locking/percpu-rwsem.o
../arch/mips/kernel/setup.c:46:39: error: conflicting types for
'__appended_dtb'
const char __section(".appended_dtb") __appended_dtb[0x100000];
^~~~~~~~~~~~~~
In file included from ../arch/mips/kernel/setup.c:34:
../arch/mips/include/asm/bootinfo.h:118:13: note: previous declaration
of '__appended_dtb' was here
extern char __appended_dtb[];
^~~~~~~~~~~~~~
CC fs/attr.o
make[4]: *** [../scripts/Makefile.build:271: arch/mips/kernel/setup.o]
Error 1
...
Root cause seems to be:
Fixes: b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
Reviewed-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: trivial@kernel.org
---
arch/mips/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 279be0153f8b..23a140327a0b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -43,7 +43,7 @@
#include <asm/prom.h>
#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
-const char __section(".appended_dtb") __appended_dtb[0x100000];
+char __section(".appended_dtb") __appended_dtb[0x100000];
#endif /* CONFIG_MIPS_ELF_APPENDED_DTB */
struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
--
2.25.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/1] MIPS: kernel: setup.c: fix compilation error
2021-03-29 12:31 ` [PATCH v3 1/1] MIPS: kernel: setup.c: " Mauri Sandberg
@ 2021-03-30 12:53 ` Thomas Bogendoerfer
2021-03-31 22:55 ` Maciej W. Rozycki
0 siblings, 1 reply; 12+ messages in thread
From: Thomas Bogendoerfer @ 2021-03-30 12:53 UTC (permalink / raw)
To: Mauri Sandberg; +Cc: f.fainelli, linux-mips, trivial
On Mon, Mar 29, 2021 at 03:31:36PM +0300, Mauri Sandberg wrote:
> With ath79_defconfig enabling CONFIG_MIPS_ELF_APPENDED_DTB gives a
> compilation error. This patch fixes it.
>
> Build log:
> ...
> CC kernel/locking/percpu-rwsem.o
> ../arch/mips/kernel/setup.c:46:39: error: conflicting types for
> '__appended_dtb'
> const char __section(".appended_dtb") __appended_dtb[0x100000];
> ^~~~~~~~~~~~~~
> In file included from ../arch/mips/kernel/setup.c:34:
> ../arch/mips/include/asm/bootinfo.h:118:13: note: previous declaration
> of '__appended_dtb' was here
> extern char __appended_dtb[];
> ^~~~~~~~~~~~~~
> CC fs/attr.o
> make[4]: *** [../scripts/Makefile.build:271: arch/mips/kernel/setup.o]
> Error 1
> ...
>
> Root cause seems to be:
> Fixes: b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
>
> Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
> Reviewed-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: trivial@kernel.org
> ---
> arch/mips/kernel/setup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied to mips-fixes. I dropped the Tested-by as this would imply
for me booting that kernel, which I didn't.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/1] MIPS: kernel: setup.c: fix compilation error
2021-03-30 12:53 ` Thomas Bogendoerfer
@ 2021-03-31 22:55 ` Maciej W. Rozycki
2021-04-01 3:02 ` Florian Fainelli
2021-04-01 5:13 ` Mauri Sandberg
0 siblings, 2 replies; 12+ messages in thread
From: Maciej W. Rozycki @ 2021-03-31 22:55 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: Mauri Sandberg, f.fainelli, linux-mips, trivial
On Tue, 30 Mar 2021, Thomas Bogendoerfer wrote:
> > With ath79_defconfig enabling CONFIG_MIPS_ELF_APPENDED_DTB gives a
> > compilation error. This patch fixes it.
> >
> > Build log:
> > ...
> > CC kernel/locking/percpu-rwsem.o
> > ../arch/mips/kernel/setup.c:46:39: error: conflicting types for
> > '__appended_dtb'
> > const char __section(".appended_dtb") __appended_dtb[0x100000];
> > ^~~~~~~~~~~~~~
> > In file included from ../arch/mips/kernel/setup.c:34:
> > ../arch/mips/include/asm/bootinfo.h:118:13: note: previous declaration
> > of '__appended_dtb' was here
> > extern char __appended_dtb[];
> > ^~~~~~~~~~~~~~
> > CC fs/attr.o
> > make[4]: *** [../scripts/Makefile.build:271: arch/mips/kernel/setup.o]
> > Error 1
> > ...
> >
> > Root cause seems to be:
> > Fixes: b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
> >
> > Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
> > Reviewed-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > Cc: trivial@kernel.org
> > ---
> > arch/mips/kernel/setup.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> applied to mips-fixes. I dropped the Tested-by as this would imply
> for me booting that kernel, which I didn't.
Why removing the `const' qualifier rather than adding it to the
declaration? Is the DTB supposed to be r/w for the kernel?
Maciej
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/1] MIPS: kernel: setup.c: fix compilation error
2021-03-31 22:55 ` Maciej W. Rozycki
@ 2021-04-01 3:02 ` Florian Fainelli
2021-04-01 5:13 ` Mauri Sandberg
1 sibling, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2021-04-01 3:02 UTC (permalink / raw)
To: Maciej W. Rozycki, Thomas Bogendoerfer
Cc: Mauri Sandberg, linux-mips, trivial
On 3/31/2021 3:55 PM, Maciej W. Rozycki wrote:
> On Tue, 30 Mar 2021, Thomas Bogendoerfer wrote:
>
>>> With ath79_defconfig enabling CONFIG_MIPS_ELF_APPENDED_DTB gives a
>>> compilation error. This patch fixes it.
>>>
>>> Build log:
>>> ...
>>> CC kernel/locking/percpu-rwsem.o
>>> ../arch/mips/kernel/setup.c:46:39: error: conflicting types for
>>> '__appended_dtb'
>>> const char __section(".appended_dtb") __appended_dtb[0x100000];
>>> ^~~~~~~~~~~~~~
>>> In file included from ../arch/mips/kernel/setup.c:34:
>>> ../arch/mips/include/asm/bootinfo.h:118:13: note: previous declaration
>>> of '__appended_dtb' was here
>>> extern char __appended_dtb[];
>>> ^~~~~~~~~~~~~~
>>> CC fs/attr.o
>>> make[4]: *** [../scripts/Makefile.build:271: arch/mips/kernel/setup.o]
>>> Error 1
>>> ...
>>>
>>> Root cause seems to be:
>>> Fixes: b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
>>>
>>> Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
>>> Reviewed-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>>> Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>>> Cc: trivial@kernel.org
>>> ---
>>> arch/mips/kernel/setup.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> applied to mips-fixes. I dropped the Tested-by as this would imply
>> for me booting that kernel, which I didn't.
>
> Why removing the `const' qualifier rather than adding it to the
> declaration? Is the DTB supposed to be r/w for the kernel?
In premise the appended dtb could be modified by the kernel early on if
needed even before being handed over to __dt_setup_arch(), so keeping it
read/write for the kernel sort of makes sense. No upstream platform
seems to do that though. If we were to re-instate the const qualifier
(only build tested) the path of least resistance appears to be this:
diff --git a/arch/mips/include/asm/bootinfo.h
b/arch/mips/include/asm/bootinfo.h
index 5be10ece3ef0..31919e1e2dc7 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -115,14 +115,14 @@ extern unsigned long fw_arg0, fw_arg1, fw_arg2,
fw_arg3;
#include <linux/libfdt.h>
#include <linux/of_fdt.h>
-extern char __appended_dtb[];
+extern const char __appended_dtb[];
static inline void *get_fdt(void)
{
if (IS_ENABLED(CONFIG_MIPS_RAW_APPENDED_DTB) ||
IS_ENABLED(CONFIG_MIPS_ELF_APPENDED_DTB))
if (fdt_magic(&__appended_dtb) == FDT_MAGIC)
- return &__appended_dtb;
+ return (void *)&__appended_dtb;
if (fw_arg0 == -2) /* UHI interface */
return (void *)fw_arg1;
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 23a140327a0b..279be0153f8b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -43,7 +43,7 @@
#include <asm/prom.h>
#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
-char __section(".appended_dtb") __appended_dtb[0x100000];
+const char __section(".appended_dtb") __appended_dtb[0x100000];
#endif /* CONFIG_MIPS_ELF_APPENDED_DTB */
struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
--
Florian
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/1] MIPS: kernel: setup.c: fix compilation error
2021-03-31 22:55 ` Maciej W. Rozycki
2021-04-01 3:02 ` Florian Fainelli
@ 2021-04-01 5:13 ` Mauri Sandberg
1 sibling, 0 replies; 12+ messages in thread
From: Mauri Sandberg @ 2021-04-01 5:13 UTC (permalink / raw)
To: Maciej W. Rozycki, Thomas Bogendoerfer; +Cc: f.fainelli, linux-mips, trivial
> ----------------------------------------
> From: Maciej W. Rozycki <macro@orcam.me.uk>
> On Tue, 30 Mar 2021, Thomas Bogendoerfer wrote:
> > > With ath79_defconfig enabling CONFIG_MIPS_ELF_APPENDED_DTB gives a
> > > compilation error. This patch fixes it.
> > >
> > > Build log:
> > > ...
> > > CC kernel/locking/percpu-rwsem.o
> > > ../arch/mips/kernel/setup.c:46:39: error: conflicting types for
> > > '__appended_dtb'
> > > const char __section(".appended_dtb") __appended_dtb[0x100000];
> > > ^~~~~~~~~~~~~~
> > > In file included from ../arch/mips/kernel/setup.c:34:
> > > ../arch/mips/include/asm/bootinfo.h:118:13: note: previous declaration
> > > of '__appended_dtb' was here
> > > extern char __appended_dtb[];
> > > ^~~~~~~~~~~~~~
> > > CC fs/attr.o
> > > make[4]: *** [../scripts/Makefile.build:271: arch/mips/kernel/setup.o]
> > > Error 1
> > > ...
> > >
> > > Root cause seems to be:
> > > Fixes: b83ba0b9df56 ("MIPS: of: Introduce helper function to get DTB")
> > >
> > > Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
> > > Reviewed-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > > Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > > Cc: trivial@kernel.org
> > > ---
> > > arch/mips/kernel/setup.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > applied to mips-fixes. I dropped the Tested-by as this would imply
> > for me booting that kernel, which I didn't.
>
> Why removing the `const' qualifier rather than adding it to the
> declaration? Is the DTB supposed to be r/w for the kernel?
That is a good point. I tried it too but to my untrained eye it seemed to break up things
more and I didn't have enough in-depth knowledge to touch things elsewhere.
-- Mauri
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-04-01 5:15 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 13:41 [PATCH 0/1] MIPS: fix compilation error Mauri Sandberg
2021-03-26 13:41 ` [PATCH 1/1] MIPS: kernel: setup.c: " Mauri Sandberg
2021-03-26 16:46 ` [PATCH v2 0/1] MIPS: " Mauri Sandberg
2021-03-26 16:46 ` [PATCH v2 1/1] Revert "MIPS: of: Introduce helper function to get DTB" Mauri Sandberg
2021-03-27 9:40 ` [PATCH v2 0/1] MIPS: fix compilation error Thomas Bogendoerfer
2021-03-27 13:39 ` Mauri Sandberg
2021-03-29 12:31 ` [PATCH v3 " Mauri Sandberg
2021-03-29 12:31 ` [PATCH v3 1/1] MIPS: kernel: setup.c: " Mauri Sandberg
2021-03-30 12:53 ` Thomas Bogendoerfer
2021-03-31 22:55 ` Maciej W. Rozycki
2021-04-01 3:02 ` Florian Fainelli
2021-04-01 5:13 ` Mauri Sandberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.