mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 1/4] ARM: mmu64: request TTB region
Date: Fri, 26 May 2023 08:33:51 +0200	[thread overview]
Message-ID: <20230526063354.1145474-1-a.fatoum@pengutronix.de> (raw)

ARM64 MMU code used to disable early MMU, reallocate TTB from malloc
area and then reenable it. This has recently been changed, so MMU is
left enabled like on ARM32, but unlike ARM32, the SDRAM region used in
PBL is not requested in barebox proper. Do that now.

Fixes: b53744ffe333 ("ARM: mmu64: Use two level pagetables in early code")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/mmu_64.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index cdc482542202..1d5a5355c6be 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -192,8 +192,20 @@ static void mmu_enable(void)
  */
 void __mmu_init(bool mmu_on)
 {
+	uint64_t *ttb = get_ttb();
 	struct memory_bank *bank;
 
+	if (!request_sdram_region("ttb", (unsigned long)ttb,
+				  ARM_EARLY_PAGETABLE_SIZE))
+		/*
+		 * This can mean that:
+		 * - the early MMU code has put the ttb into a place
+		 *   which we don't have inside our available memory
+		 * - Somebody else has occupied the ttb region which means
+		 *   the ttb will get corrupted.
+		 */
+		pr_crit("Can't request SDRAM region for ttb at %p\n", ttb);
+
 	for_each_memory_bank(bank) {
 		struct resource *rsv;
 		resource_size_t pos;
-- 
2.39.2




             reply	other threads:[~2023-05-26  6:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26  6:33 Ahmad Fatoum [this message]
2023-05-26  6:33 ` [PATCH master 2/4] ARM: mmu64: define early_remap_range for mmu_early_enable usage Ahmad Fatoum
2023-05-26  6:33 ` [PATCH master 3/4] ARM: mmu32: " Ahmad Fatoum
2023-05-26  6:33 ` [PATCH master 4/4] ARM: mmu: invalidate when mapping range uncached Ahmad Fatoum
2023-05-26 12:49   ` Ahmad Fatoum
2023-05-30 10:26 ` [PATCH master 1/4] ARM: mmu64: request TTB region 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=20230526063354.1145474-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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