Skip to contentSkip to conversation

csky: Support vmlinux bootup with MMU off

PATCH New [email protected] 1 participant 1 message Apr 13, 2019

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 csky: Support vmlinux bootup with MMU off

From: Guo Ren <[email protected]>

Modify SETUP_MMU macro to fit on both MMU-on or MMU-off enviornment and vmlinux could bootup from MMU off enviornment for some cases.

Unify the style of _start and _start_smp_secondary in head.S to make head.S looks more concise and easy to understand.

Cc Arnd Bergmann <[email protected]>
---
 arch/csky/abiv1/inc/abi/entry.h | 29 ++++++++-------
 arch/csky/abiv2/inc/abi/entry.h | 79 ++++++++++++++++++++++++++++++++---------
 arch/csky/kernel/head.S         | 60 ++++---------------------------
 arch/csky/kernel/setup.c        |  7 ++--
 4 files changed, 90 insertions(+), 85 deletions(-)
arch/csky/abiv1/inc/abi/entry.h +17 -12
index 18e2023..7ab78bd 100644
@@ -143,7 +143,12 @@
 	cpwcr   \rx, cpcr8
 .endm
 
-.macro SETUP_MMU rx
+.macro SETUP_MMU
+	/* Init psr and enable ee */
+	lrw	r6, DEFAULT_PSR_VALUE
+	mtcr    r6, psr
+	psrset  ee
+
 	/* Select MMU as co-processor */
 	cpseti	cp15
 
@@ -152,17 +157,17 @@
 	 * 31 - 29 | 28 - 4 | 3 | 2 | 1 | 0
 	 *   BA     Reserved  C   D   V
 	 */
-	cprcr	\rx, cpcr30
-	lsri	\rx, 28
-	lsli	\rx, 28
-	addi	\rx, 0xe
-	cpwcr	\rx, cpcr30
-
-	lsri	\rx, 28
-	addi	\rx, 2
-	lsli	\rx, 28
-	addi	\rx, 0xe
-	cpwcr	\rx, cpcr31
+	cprcr	r6, cpcr30
+	lsri	r6, 28
+	lsli	r6, 28
+	addi	r6, 0xe
+	cpwcr	r6, cpcr30
+
+	lsri	r6, 28
+	addi	r6, 2
+	lsli	r6, 28
+	addi	r6, 0xe
+	cpwcr	r6, cpcr31
 .endm
 
 .macro ANDI_R3 rx, imm
arch/csky/abiv2/inc/abi/entry.h +62 -17

93 lines not on this page · raw message

arch/csky/kernel/head.S +7 -53

76 lines not on this page · raw message

arch/csky/kernel/setup.c +4 -3
index c377194..36fc04b 100644
@@ -145,7 +145,8 @@ void __init setup_arch(char **cmdline_p)
 unsigned long phys_offset;
 EXPORT_SYMBOL(phys_offset);
 
-asmlinkage __visible void __init csky_start(unsigned int unused, void *param)
+asmlinkage __visible void __init csky_start(unsigned int unused,
+					    void *dtb_start)
 {
 	/* Clean up bss section */
 	memset(__bss_start, 0, __bss_stop - __bss_start);
@@ -155,10 +156,10 @@ asmlinkage __visible void __init csky_start(unsigned int unused, void *param)
 	pre_trap_init();
 	pre_mmu_init();
 
-	if (param == NULL)
+	if (dtb_start == NULL)
 		early_init_dt_scan(__dtb_start);
 	else
-		early_init_dt_scan(param);
+		early_init_dt_scan(dtb_start);
 
 	start_kernel();
 
Signature · 1 line
2.7.4