diff mbox series

[114/120] MIPS: PS2: Workaround for unexpected uLaunchELF CP0 Status user mode

Message ID 05de0a34e2f6e28a611838c615c562bb12e3f680.1567326213.git.noring@nocrew.org (mailing list archive)
State RFC
Headers show
Series Linux for the PlayStation 2 | expand

Commit Message

Fredrik Noring Sept. 1, 2019, 4:35 p.m. UTC
The PlayStation 2 uLaunchELF program, used as a kernel boot loader,
starts in user mode with CP0 access enabled (CP0 Status 0x70030c11).
This is unexpected and causes a boot freeze.

Signed-off-by: Fredrik Noring <noring@nocrew.org>
---
 arch/mips/boot/compressed/head.S | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
index e3dc831e2616..6dc728d6ebea 100644
--- a/arch/mips/boot/compressed/head.S
+++ b/arch/mips/boot/compressed/head.S
@@ -24,6 +24,15 @@  start:
 	move	s2, a2
 	move	s3, a3
 
+#ifdef CONFIG_CPU_R5900
+	# The PlayStation 2 uLaunchELF starts in user mode with
+	# CP0 access enabled (CP0 Status 0x70030c11), which is
+	# unexpected. This is corrected here:
+	li	k0, 0x30010000
+	mtc0	k0, $12
+	sync.p
+#endif /* CONFIG_CPU_R5900 */
+
 	/* Clear BSS */
 	PTR_LA	a0, _edata - 4
 	PTR_LA	a2, _end