arm: mach-k3: common: Make sure firmware sections are loaded prior to armv8 startup
authorNishanth Menon <nm@ti.com>
Tue, 31 Aug 2021 18:20:48 +0000 (13:20 -0500)
committerTom Rini <trini@konsulko.com>
Fri, 17 Sep 2021 18:48:53 +0000 (14:48 -0400)
commitee91d465573637da5c386df3770a20cfb183d210
tree9316054131a73328a53d132450075345302a2e12
parent6887f8e00b821a3af02da207c85ba61c286dcc3c
arm: mach-k3: common: Make sure firmware sections are loaded prior to armv8 startup

With Device Manager firmware in an elf file form, we cannot load the FIT
image to the exact same address as any of the executable sections of the
elf file itself is located.

However, the device tree descriptions for the ARMV8 bootloader/OS
includes DDR regions only the final sections in DDR where the Device
Manager firmware is actually executing out of.

As the R5 uC is usually operating at a slower rate than an ARMv8 MPU,
by starting the Armv8 ahead of parsing the elf and copying the correct
sections to the required memories creates a race condition where the
ARMv8 could overwrite the elf image loaded from the FIT image prior to
the R5 completing parsing and putting the correct sections of elf in
the required memory locations. OR create rather obscure debug conditions
where data in the section is being modified by ARMV8 OS while the elf
copy is in progress.

To prevent all these conditions, lets make sure that the elf parse and
copy operations are completed ahead of ARMv8 being released to execute.

We will pay a penalty of elf copy time, but that is a valid tradeoff in
comparison to debug of alternate scenarios.

Signed-off-by: Nishanth Menon <nm@ti.com>
arch/arm/mach-k3/common.c