Skip to contentSkip to conversation

MIPS: correctly work with disabled CONFIG_MMU

PATCH Applied Antony Pavlov 2 participants 2 messages Jun 3, 2020 – Jun 8, 2020 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: correctly work with disabled CONFIG_MMU

There are some issues with CONFIG_MMU=n in MIPS configuration (e.g. qemu-malta_defconfig):

* "Cannot request SDRAM region for stack" error message on start;
* empty kseg1_ram0 region in the iomem command output.

The patch fixes the problems by forcing KSEG1 memory region usage for CONFIG_MMU=n MIPS configurations.

---
 arch/mips/include/asm/io.h | 6 +++++-
 arch/mips/lib/reloc.c      | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/mips/include/asm/io.h +5 -1
index c155199430..4df9853680 100644
@@ -39,7 +39,11 @@ static inline unsigned long virt_to_phys(const void *address)
  */
 static inline void *phys_to_virt(unsigned long address)
 {
-	return (void *)CKSEG0ADDR(address);
+	if (IS_ENABLED(CONFIG_MMU)) {
+		return (void *)CKSEG0ADDR(address);
+	}
+
+	return (void *)CKSEG1ADDR(address);
 }
 
 #define	IO_SPACE_LIMIT	0
arch/mips/lib/reloc.c +5 -1
index 4b0e252352..b084a88be7 100644
@@ -120,7 +120,11 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
 
 	length = __bss_stop - __image_start;
 	relocaddr = ALIGN_DOWN(ram_size - length, SZ_64K);
-	relocaddr = KSEG0ADDR(relocaddr);
+	if (IS_ENABLED(CONFIG_MMU)) {
+		relocaddr = KSEG0ADDR(relocaddr);
+	} else {
+		relocaddr = KSEG1ADDR(relocaddr);
+	}
 	new_stack = relocaddr - MALLOC_SIZE - 16;
 
 	/*
Signature · 7 lines
2.26.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 6 lines · Antony Pavlov

There are some issues with CONFIG_MMU=n in MIPS configuration (e.g. qemu-malta_defconfig):

* "Cannot request SDRAM region for stack" error message on start;
* empty kseg1_ram0 region in the iomem command output.

Quoted 8 lines

The patch fixes the problems by forcing KSEG1 memory region usage for CONFIG_MMU=n MIPS configurations.

---
 arch/mips/include/asm/io.h | 6 +++++-
 arch/mips/lib/reloc.c      | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox