[PATCH v2 4/4] arm: boards: protonic-imx8ml: Add ECC + scrubbing

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Mar 9 08:21:46 PDT 2026


On 3/9/26 8:46 AM, Steffen Trumtrar wrote:
> +ENTRY_FUNCTION(start_prt_prt8ml_ecc, r0, r1, r2)
> +{
> +	imx8mp_cpu_lowlevel_init();
> +
> +	relocate_to_current_adr();
> +	setup_c();
> +
> +	prt_prt8ml_start(&prt8ml_dram_ecc_timing);

Taking the address of a global variable in a function that calls
relocate_to_* is not a good idea, see commit f36c980fd6e5 ("ARM: cpu:
add compiler barrier around unrelocated access") for an example where
GCC miscompiled such a pattern.

I would suggest you pass an ecc = true/false here and move taking the
address into the noinline function. I expect that the compiler should
optimize the other struct away. If not, you will have to define two
noinline functions instead...

Sorry about that, I hope we will get rid of this error prone wart in the
coming months, so that the board entry point runs with relocations
applied right away.

Thanks,
Ahmad

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list