[PATCH v2 3/6] armv8: Force SP_ELx stack pointer usage
Tom Rini
trini at konsulko.com
Wed Mar 2 23:41:20 CET 2022
On Fri, Feb 11, 2022 at 11:29:36AM +0000, Andre Przywara wrote:
> In ARMv8 we have the choice between two stack pointers to use: SP_EL0 or
> SP_ELx, which is banked per exception level. This choice is stored in
> the SP field of PState, and can be read and set via the SPSel special
> register. When the CPU takes an exception, it automatically switches to
> the SP_ELx stack pointer.
>
> Trusted Firmware enters U-Boot typically with SPSel set to 1, so we use
> SP_ELx all along as our sole stack pointer, both for normal operation and
> for exceptions.
>
> But if we now for some reason enter U-Boot with SPSel cleared, we will
> setup and use SP_EL0, which is fine, but leaves SP_ELx uninitialised.
> When we now take an exception, we try to save the GPRs to some undefined
> location, which will usually end badly.
>
> To make sure we always have SP_ELx pointing to some memory, set SPSel
> to 1 in the early boot code, to ensure safe operation at all times.
>
> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
Applied to u-boot/next, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220302/9c1a3dcb/attachment.sig>
More information about the U-Boot
mailing list