summaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorHuacai Chen <chenhc@lemote.com>2020-09-21 11:12:26 +0200
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2020-09-21 22:14:47 +0200
commit4e43e5df5850ca8300180f422727e42a5065aaaa (patch)
treebfede98a2cccf4cfb275519cbb321b946005f668 /arch/mips/include
parentMIPS: kernel: include probes-common.h header in branch.c (diff)
downloadlinux-4e43e5df5850ca8300180f422727e42a5065aaaa.tar.xz
linux-4e43e5df5850ca8300180f422727e42a5065aaaa.zip
MIPS: context switch: Use save/restore instead of set/clear for Status.CU2
Some processors (such as Loongson-3) need to enable CU2 in kernel mode, current set/clear method will lose Status.CU2 during context switching, so use save/restore method instead. Signed-off-by: Huacai Chen <chenhc@lemote.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/switch_to.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
index 0b0a93bf83cd..a4374b4cb88f 100644
--- a/arch/mips/include/asm/switch_to.h
+++ b/arch/mips/include/asm/switch_to.h
@@ -117,6 +117,8 @@ do { \
__restore_dsp(next); \
} \
if (cop2_present) { \
+ u32 status = read_c0_status(); \
+ \
set_c0_status(ST0_CU2); \
if ((KSTK_STATUS(prev) & ST0_CU2)) { \
if (cop2_lazy_restore) \
@@ -127,7 +129,7 @@ do { \
!cop2_lazy_restore) { \
cop2_restore(next); \
} \
- clear_c0_status(ST0_CU2); \
+ write_c0_status(status); \
} \
__clear_r5_hw_ll_bit(); \
__clear_software_ll_bit(); \