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

ARM: 8847/1: pm: fix HYP/SVC mode mismatch when MCPM is used

MCPM does a soft reset of the CPUs and uses common cpu_resume() routine to
perform low-level platform initialization. This results in a try to install
HYP stubs for the second time for each CPU and results in false HYP/SVC
mode mismatch detection. The HYP stubs are already installed at the
beginning of the kernel initialization on the boot CPU (head.S) or in the
secondary_startup() for other CPUs. To fix this issue MCPM code should use
a cpu_resume() routine without HYP stubs installation.

This change fixes HYP/SVC mode mismatch on Samsung Exynos5422-based Odroid
XU3/XU4/HC1 boards.

Fixes: 3721924c8154 ("ARM: 8081/1: MCPM: provide infrastructure to allow for MCPM loopback")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

authored by

Marek Szyprowski and committed by
Russell King
ca70ea43 74ffe79a

+14 -1
+1 -1
arch/arm/common/mcpm_entry.c
··· 381 381 unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); 382 382 phys_reset_t phys_reset; 383 383 384 - mcpm_set_entry_vector(cpu, cluster, cpu_resume); 384 + mcpm_set_entry_vector(cpu, cluster, cpu_resume_no_hyp); 385 385 setup_mm_for_reboot(); 386 386 387 387 __mcpm_cpu_going_down(cpu, cluster);
+1
arch/arm/include/asm/suspend.h
··· 10 10 }; 11 11 12 12 extern void cpu_resume(void); 13 + extern void cpu_resume_no_hyp(void); 13 14 extern void cpu_resume_arm(void); 14 15 extern int cpu_suspend(unsigned long, int (*)(unsigned long)); 15 16
+12
arch/arm/kernel/sleep.S
··· 120 120 .text 121 121 .align 122 122 123 + #ifdef CONFIG_MCPM 124 + .arm 125 + THUMB( .thumb ) 126 + ENTRY(cpu_resume_no_hyp) 127 + ARM_BE8(setend be) @ ensure we are in BE mode 128 + b no_hyp 129 + #endif 130 + 123 131 #ifdef CONFIG_MMU 124 132 .arm 125 133 ENTRY(cpu_resume_arm) ··· 143 135 bl __hyp_stub_install_secondary 144 136 #endif 145 137 safe_svcmode_maskall r1 138 + no_hyp: 146 139 mov r1, #0 147 140 ALT_SMP(mrc p15, 0, r0, c0, c0, 5) 148 141 ALT_UP_B(1f) ··· 172 163 173 164 #ifdef CONFIG_MMU 174 165 ENDPROC(cpu_resume_arm) 166 + #endif 167 + #ifdef CONFIG_MCPM 168 + ENDPROC(cpu_resume_no_hyp) 175 169 #endif 176 170 177 171 .align 2