All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V7 1/3] MIPS: context switch: Use save/restore instead of set/clear for Status.CU2
@ 2020-09-21  9:12 Huacai Chen
  2020-09-21  9:12 ` [PATCH V7 2/3] MIPS: Loongson-3: Enable COP2 usage in kernel Huacai Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Huacai Chen @ 2020-09-21  9:12 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: linux-mips, Fuxin Zhang, Huacai Chen, Jiaxun Yang, Huacai Chen

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>
---
 arch/mips/include/asm/switch_to.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
index 0b0a93b..a4374b4 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();					\
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-24 13:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21  9:12 [PATCH V7 1/3] MIPS: context switch: Use save/restore instead of set/clear for Status.CU2 Huacai Chen
2020-09-21  9:12 ` [PATCH V7 2/3] MIPS: Loongson-3: Enable COP2 usage in kernel Huacai Chen
2020-09-21 12:15   ` Thomas Bogendoerfer
2020-09-23  9:44     ` Jiaxun Yang
2020-09-24 13:53       ` Thomas Bogendoerfer
2020-09-21  9:12 ` [PATCH V7 3/3] MIPS: Loongson-3: Calculate ra properly when unwinding the stack Huacai Chen
2020-09-21 20:24 ` [PATCH V7 1/3] MIPS: context switch: Use save/restore instead of set/clear for Status.CU2 Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.