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

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>

authored by

Huacai Chen and committed by
Thomas Bogendoerfer
4e43e5df 6fa573a3

+3 -1
+3 -1
arch/mips/include/asm/switch_to.h
··· 117 117 __restore_dsp(next); \ 118 118 } \ 119 119 if (cop2_present) { \ 120 + u32 status = read_c0_status(); \ 121 + \ 120 122 set_c0_status(ST0_CU2); \ 121 123 if ((KSTK_STATUS(prev) & ST0_CU2)) { \ 122 124 if (cop2_lazy_restore) \ ··· 129 127 !cop2_lazy_restore) { \ 130 128 cop2_restore(next); \ 131 129 } \ 132 - clear_c0_status(ST0_CU2); \ 130 + write_c0_status(status); \ 133 131 } \ 134 132 __clear_r5_hw_ll_bit(); \ 135 133 __clear_software_ll_bit(); \