[PATCH] arm64: scs: Remove redundant save/restore of SCS SP on entry to/from EL0

Sami Tolvanen samitolvanen at google.com
Fri Mar 13 09:13:08 PDT 2026


On Fri, Mar 13, 2026 at 12:32:19PM +0000, Will Deacon wrote:
> When returning to userspace, the SCS is empty and so the SCS SP just
> points to the base address of the SCS page.
> 
> Rather than saving and restoring this address in the current task, we
> can simply restore the SCS SP to point at the base of the stack on entry
> to EL1 from EL0.
> 
> Cc: Ard Biesheuvel <ardb at kernel.org>
> Cc: Mark Rutland <mark.rutland at arm.com>
> Cc: Sami Tolvanen <samitolvanen at google.com>
> Signed-off-by: Will Deacon <will at kernel.org>
> ---
>  arch/arm64/include/asm/scs.h | 8 ++++++++
>  arch/arm64/kernel/entry.S    | 4 +---
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> I just spotted this by inspection when I was hacking on our exception
> entry code.

Reviewed-by: Sami Tolvanen <samitolvanen at google.com>

Sami



More information about the linux-arm-kernel mailing list