U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] arm: provide noncached_set_region prototype to fix build
@ 2024-10-16 11:24 Jonas Jelonek
  2024-10-16 11:24 ` [PATCH 1/1] " Jonas Jelonek
  0 siblings, 1 reply; 3+ messages in thread
From: Jonas Jelonek @ 2024-10-16 11:24 UTC (permalink / raw)
  To: u-boot; +Cc: Jonas Jelonek, Tom Rini

In OpenWrt project, an issue recently occured after updating u-boot for
mediatek to v2024.10. When building with GCC-14 toolchain, it fails
with:
cmd/cache.c: In function 'do_dcache':
cmd/cache.c:57:25: error: implicit declaration of function
	'noncached_set_region' [-Wimplicit-function-declaration]

It is presumably caused by commit 7d6cee2cd0 ("cmd: cache: Remove weak
functions") which removes the prototypes. Arm architecture provides an
implementation for 'noncached_set_region', however it is not available
to 'cmd/cache.c'.

The issue was already discussed in
https://github.com/openwrt/openwrt/issues/16697
and temporarily fixed downstream in
https://github.com/openwrt/openwrt/commit/92ca322dd1f48158b8829fec59319a12e4ae4295.
Another user reported the issue in u-boot too, and confirmed the
solution working (https://source.denx.de/u-boot/u-boot/-/issues/42).

I'd like to discuss here if this is a proper solution to the issue or if
there is a better proposal. Since this is my first contribution, I have
barely an overview of the u-boot internals.
Please give also hints regarding any wording or explanations in the
commit message.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>

---
Jonas Jelonek (1):
  arm: provide noncached_set_region prototype to fix build

 arch/arm/include/asm/system.h | 1 +
 cmd/cache.c                   | 1 +
 2 files changed, 2 insertions(+)

-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] arm: provide noncached_set_region prototype to fix build
  2024-10-16 11:24 [PATCH 0/1] arm: provide noncached_set_region prototype to fix build Jonas Jelonek
@ 2024-10-16 11:24 ` Jonas Jelonek
  2024-10-16 17:44   ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Jonas Jelonek @ 2024-10-16 11:24 UTC (permalink / raw)
  To: u-boot; +Cc: Jonas Jelonek, Tom Rini

Due to the removal of weak functions in 7d6cee2cd0 ("cmd: cache: Remove
weak function"), uboot fails to compile after updating to v2024.10 for
mediatek target in OpenWrt with GCC-14 with error:
cmd/cache.c: In function 'do_dcache':
cmd/cache.c:57:25: error: implicit declaration of function
	'noncached_set_region' [-Wimplicit-function-declaration]

Thus, provide a prototype in arm's include/asm/system.h to fix a build
error in cmd/cache.c, since related prototypes are also located there.
Also add an include of asm/system.h in cmd/cache.c to have the function
available there.

The issue occured after the update of uboot-mediatek in OpenWrt to
v2024.10, in combination with GCC-14 toolchain. It was reported and
discussed in https://github.com/openwrt/openwrt/issues/16697, and
temporarily fixed with
https://github.com/openwrt/openwrt/commit/92ca322dd1f48158b8829fec59319a12e4ae4295.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
 arch/arm/include/asm/system.h | 1 +
 cmd/cache.c                   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 2237d7d006..0100096202 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -668,6 +668,7 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
  * Return: 0 if OK
  */
 int noncached_init(void);
+void noncached_set_region(void);
 
 phys_addr_t noncached_alloc(size_t size, size_t align);
 #endif /* CONFIG_SYS_NONCACHED_MEMORY */
diff --git a/cmd/cache.c b/cmd/cache.c
index 3049f5c305..f873f2c8fb 100644
--- a/cmd/cache.c
+++ b/cmd/cache.c
@@ -10,6 +10,7 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <linux/compiler.h>
+#include <asm/system.h>
 
 static int parse_argv(const char *);
 
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] arm: provide noncached_set_region prototype to fix build
  2024-10-16 11:24 ` [PATCH 1/1] " Jonas Jelonek
@ 2024-10-16 17:44   ` Tom Rini
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Rini @ 2024-10-16 17:44 UTC (permalink / raw)
  To: Jonas Jelonek; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

On Wed, Oct 16, 2024 at 01:24:55PM +0200, Jonas Jelonek wrote:

> Due to the removal of weak functions in 7d6cee2cd0 ("cmd: cache: Remove
> weak function"), uboot fails to compile after updating to v2024.10 for

Should be "U-Boot" but I can fix that on applying.

> mediatek target in OpenWrt with GCC-14 with error:
> cmd/cache.c: In function 'do_dcache':
> cmd/cache.c:57:25: error: implicit declaration of function
> 	'noncached_set_region' [-Wimplicit-function-declaration]
> 
> Thus, provide a prototype in arm's include/asm/system.h to fix a build
> error in cmd/cache.c, since related prototypes are also located there.
> Also add an include of asm/system.h in cmd/cache.c to have the function
> available there.
> 
> The issue occured after the update of uboot-mediatek in OpenWrt to
> v2024.10, in combination with GCC-14 toolchain. It was reported and
> discussed in https://github.com/openwrt/openwrt/issues/16697, and
> temporarily fixed with
> https://github.com/openwrt/openwrt/commit/92ca322dd1f48158b8829fec59319a12e4ae4295.
> 
> Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>

Thanks!

Reviewed-by: Tom Rini <trini@konsulko.com>
Link: https://github.com/openwrt/openwrt/issues/16697
Link: https://github.com/openwrt/openwrt/commit/92ca322dd1f48158b8829fec59319a12e4ae4295
Fixes: 7d6cee2cd0 ("cmd: cache: Remove weak function")

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-16 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-16 11:24 [PATCH 0/1] arm: provide noncached_set_region prototype to fix build Jonas Jelonek
2024-10-16 11:24 ` [PATCH 1/1] " Jonas Jelonek
2024-10-16 17:44   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox