[PATCH 12/17] MIPS: enable 64-bit kernel segment addressing on CONFIG_64BIT

Denis Orlov denorl2009 at gmail.com
Mon Jun 5 13:10:43 PDT 2023


This allows using addresses from XKPHYS segment. This is needed as we
access hardware registers through this segment in 64BIT configuration,
but this also lets us peek/poke bigger memory address space using
commands that work with memory on 64BIT.

With this commit, malta with 64-bit CPU finally boots into 64BIT barebox
in QEMU.

Signed-off-by: Denis Orlov <denorl2009 at gmail.com>
---
 arch/mips/boot/start.S             |  2 ++
 arch/mips/include/asm/pbl_macros.h | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S
index 5f134f9ae9..30828ad9ef 100644
--- a/arch/mips/boot/start.S
+++ b/arch/mips/boot/start.S
@@ -26,6 +26,8 @@ EXPORT(_start)
 
 	mips_disable_interrupts
 
+	mips64_enable_64bit_addressing
+
 	copy_to_link_location _start
 
 	stack_setup
diff --git a/arch/mips/include/asm/pbl_macros.h b/arch/mips/include/asm/pbl_macros.h
index 1fba690c8c..ce169a1554 100644
--- a/arch/mips/include/asm/pbl_macros.h
+++ b/arch/mips/include/asm/pbl_macros.h
@@ -152,6 +152,17 @@
 	.set	pop
 	.endm
 
+	.macro	mips64_enable_64bit_addressing
+#ifdef CONFIG_64BIT
+	.set	push
+	.set	noreorder
+	mfc0	k0, CP0_STATUS
+	or	k0, ST0_KX
+	mtc0	k0, CP0_STATUS
+	.set	pop
+#endif
+	.endm
+
 	.macro	mips_barebox_10h
 	.set	push
 	.set	noreorder
-- 
2.41.0




More information about the barebox mailing list