sunxi: armv8: fel: move fel_stash variable to the front
authorAndre Przywara <andre.przywara@arm.com>
Sun, 23 Mar 2025 11:35:34 +0000 (11:35 +0000)
committerAndre Przywara <andre.przywara@arm.com>
Thu, 27 Mar 2025 00:26:35 +0000 (00:26 +0000)
commitabb086efd5d08fcb2759d325d39630a576c3dfbc
tree38b7d74ef861d8294b1ac38d690a8b2b7bff4f44
parent3e78f8f407a0a0e7b50aa7eaa6f2f579f35e9837
sunxi: armv8: fel: move fel_stash variable to the front

To return a 64-bit Allwinner chip back to the 32-bit BootROM code, we
have some embedded AArch32 code that restores the CPU state, before
branching back to the BootROM. At the moment the pointer to the buffer
with that state is located *after* the code, which makes the PC relative
code fragile: adding or removing instructions will change the distance
to that pointer variable.
The "new" Allwinner A523 SoC requires more state to be restored (GICv3
system registers), but we must do that *only* on that SoC. Conditional
compilation sounds like the easiest solution, but would mean that the
distance to that pointer would change.

Solve this rather easily by moving the pointer to the *front* of the
code: we load that pointer in the first instruction, so the distance
would always stay the same. Later in the code we won't need PC relative
addressing anymore, so this code can grow or shrink easily, for instance
due to conditional compilation.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
arch/arm/cpu/armv8/fel_utils.S