Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

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@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Will Deacon and committed by
Catalin Marinas
3ce8f586 6712fcde

+9 -3
+8
arch/arm64/include/asm/scs.h
··· 10 10 #ifdef CONFIG_SHADOW_CALL_STACK 11 11 scs_sp .req x18 12 12 13 + .macro scs_load_current_base 14 + get_current_task scs_sp 15 + ldr scs_sp, [scs_sp, #TSK_TI_SCS_BASE] 16 + .endm 17 + 13 18 .macro scs_load_current 14 19 get_current_task scs_sp 15 20 ldr scs_sp, [scs_sp, #TSK_TI_SCS_SP] ··· 24 19 str scs_sp, [\tsk, #TSK_TI_SCS_SP] 25 20 .endm 26 21 #else 22 + .macro scs_load_current_base 23 + .endm 24 + 27 25 .macro scs_load_current 28 26 .endm 29 27
+1 -3
arch/arm64/kernel/entry.S
··· 273 273 alternative_else_nop_endif 274 274 1: 275 275 276 - scs_load_current 276 + scs_load_current_base 277 277 .else 278 278 add x21, sp, #PT_REGS_SIZE 279 279 get_current_task tsk ··· 378 378 alternative_else_nop_endif 379 379 #endif 380 380 3: 381 - scs_save tsk 382 - 383 381 /* Ignore asynchronous tag check faults in the uaccess routines */ 384 382 ldr x0, [tsk, THREAD_SCTLR_USER] 385 383 clear_mte_async_tcf x0