Skip to content

Commit e223258

Browse files
LeviYeoReumctmarinas
authored andcommitted
arm64: armv8_deprecated: Disable swp emulation when FEAT_LSUI present
The purpose of supporting LSUI is to eliminate PAN toggling. CPUs that support LSUI are unlikely to support a 32-bit runtime. Rather than emulating the SWP instruction using LSUI instructions in order to remove PAN toggling, simply disable SWP emulation. Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> [catalin.marinas@arm.com: some tweaks to the in-code comment] Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 377609a commit e223258

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

arch/arm64/kernel/armv8_deprecated.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,20 @@ static int __init armv8_deprecated_init(void)
610610
}
611611

612612
#endif
613+
614+
#ifdef CONFIG_SWP_EMULATION
615+
/*
616+
* The purpose of supporting LSUI is to eliminate PAN toggling. CPUs
617+
* that support LSUI are unlikely to support a 32-bit runtime. Rather
618+
* than emulating the SWP instruction using LSUI instructions, simply
619+
* disable SWP emulation.
620+
*/
621+
if (cpus_have_final_cap(ARM64_HAS_LSUI)) {
622+
insn_swp.status = INSN_UNAVAILABLE;
623+
pr_info("swp/swpb instruction emulation is not supported on this system\n");
624+
}
625+
#endif
626+
613627
for (int i = 0; i < ARRAY_SIZE(insn_emulations); i++) {
614628
struct insn_emulation *ie = insn_emulations[i];
615629

0 commit comments

Comments
 (0)