[PATCH master 4/5] ARM: i.MX8M: silence warning accessing bootrom log in zero page

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Mar 7 02:14:45 PST 2023


We don't compile with --param=min-pagesize=0, so GCC will complain about
dereference of (void *)0x9e0, even if done through a volatile pointer.

We know this to be okay, because either we run in PBL before MMU is set
up or we run in barebox proper and zero_page_access() will be
temporarily disabling trapping by the null page. Thus hide the access
from the compiler to silence the warning.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/mach-imx/romapi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/romapi.c b/arch/arm/mach-imx/romapi.c
index 0936c855fd03..b241e633ea01 100644
--- a/arch/arm/mach-imx/romapi.c
+++ b/arch/arm/mach-imx/romapi.c
@@ -57,10 +57,13 @@ int imx8mn_bootrom_load_image(void)
 const u32 *imx8m_get_bootrom_log(void)
 {
 	if (current_el() == 3) {
+		ulong *rom_log_addr_offset = (void *)0x9e0;
 		ulong rom_log_addr;
 
+		OPTIMIZER_HIDE_VAR(rom_log_addr_offset);
+
 		zero_page_access();
-		rom_log_addr = readl(IOMEM(0x9e0));
+		rom_log_addr = *rom_log_addr_offset;
 		zero_page_faulting();
 
 		if (rom_log_addr < MX8M_OCRAM_BASE_ADDR ||
-- 
2.30.2




More information about the barebox mailing list