mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH] MIPS: correctly work with disabled CONFIG_MMU
Date: Wed,  3 Jun 2020 09:20:32 +0300	[thread overview]
Message-ID: <20200603062032.15288-1-antonynpavlov@gmail.com> (raw)

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.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/include/asm/io.h | 6 +++++-
 arch/mips/lib/reloc.c      | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index c155199430..4df9853680 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -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
diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index 4b0e252352..b084a88be7 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -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;
 
 	/*
-- 
2.26.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2020-06-03  6:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  6:20 Antony Pavlov [this message]
2020-06-08  4:56 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200603062032.15288-1-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox