summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm64/Kconfig7
-rw-r--r--arch/arm64/kernel/entry.S27
2 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 579ab688312d..beea70ba7995 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -559,6 +559,13 @@ config HW_PERF_EVENTS
def_bool y
depends on ARM_PMU
+config ARM64_REG_REBALANCE_ON_CTX_SW
+ bool "Rebalance registers during context switches."
+ def_bool ARCH_MSM8996
+ help
+ Forcefully re-balance register rename pools on context switches for
+ improved performance on some devices.
+
config SYS_SUPPORTS_HUGETLBFS
def_bool y
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 7ed3d75f6304..77827e89ea80 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -598,6 +598,33 @@ ENTRY(cpu_switch_to)
ldp x27, x28, [x8], #16
ldp x29, x9, [x8], #16
ldr lr, [x8]
+#ifdef CONFIG_ARM64_REG_REBALANCE_ON_CTX_SW
+ ORR x13, x13, x13
+ ORR x14, x14, x14
+ ORR x15, x15, x15
+ ORR x16, x16, x16
+ ORR x17, x17, x17
+ ORR x18, x18, x18
+ ORR x19, x19, x19
+ ORR x20, x20, x20
+ ORR x21, x21, x21
+ MOV V0.16B, V0.16B
+ MOV V1.16B, V1.16B
+ MOV V2.16B, V2.16B
+ MOV V3.16B, V3.16B
+ MOV V4.16B, V4.16B
+ MOV V5.16B, V5.16B
+ MOV V6.16B, V6.16B
+ MOV V7.16B, V7.16B
+ MOV V8.16B, V8.16B
+ MOV V9.16B, V9.16B
+ MOV V10.16B, V10.16B
+ MOV V11.16B, V11.16B
+ MOV V12.16B, V12.16B
+ MOV V13.16B, V13.16B
+ MOV V14.16B, V14.16B
+ MOV V15.16B, V15.16B
+#endif
mov sp, x9
ret
ENDPROC(cpu_switch_to)