U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anshul Dalal <anshuld@ti.com>
To: <u-boot@lists.denx.de>
Cc: Anshul Dalal <anshuld@ti.com>, <vigneshr@ti.com>,
	<trini@konsulko.com>, <nm@ti.com>, <robertcnelson@gmail.com>,
	<w.egorov@phytec.de>, <francesco.dolcini@toradex.com>,
	<ggiordano@phytec.com>, <m-chawdhry@ti.com>, <a-nandan@ti.com>,
	<afd@ti.com>, <bb@ti.com>, <u-kumar1@ti.com>, <devarsht@ti.com>
Subject: [PATCH v5 1/4] mach-k3: use minimal MMU table for all k3
Date: Thu, 3 Jul 2025 19:05:26 +0530	[thread overview]
Message-ID: <20250703133533.104758-2-anshuld@ti.com> (raw)
In-Reply-To: <20250703133533.104758-1-anshuld@ti.com>

This patch replaces the existing MMU table with a minimal bootable table
(at least till SPL) that could be modified at runtime as per the
device-tree and the CONFIG_K3_*_LOAD_ADDR.

The 128MiB region starting from SPL_TEXT_BASE is mapped for use by the
A-core SPL. 128MiB provides enough space for future use cases such as
falcon boot from the A-Core SPL etc.

Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
 arch/arm/mach-k3/arm64/arm64-mmu.c | 38 ++++++++++++------------------
 1 file changed, 15 insertions(+), 23 deletions(-)

diff --git a/arch/arm/mach-k3/arm64/arm64-mmu.c b/arch/arm/mach-k3/arm64/arm64-mmu.c
index 0e07b1b7ce0..5c29df4fe6f 100644
--- a/arch/arm/mach-k3/arm64/arm64-mmu.c
+++ b/arch/arm/mach-k3/arm64/arm64-mmu.c
@@ -12,41 +12,33 @@
 #include <asm/system.h>
 #include <asm/armv8/mmu.h>
 
-struct mm_region k3_mem_map[] = {
-	{
+/* We need extra 5 entries for:
+ * SoC peripherals, flash, atf-carveout, tee-carveout and the sentinel value.
+ */
+#define K3_MMU_REGIONS_COUNT ((CONFIG_NR_DRAM_BANKS) + 5)
+
+struct mm_region k3_mem_map[K3_MMU_REGIONS_COUNT] = {
+	{ /* SoC Peripherals */
 		.virt = 0x0UL,
 		.phys = 0x0UL,
 		.size = 0x80000000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 			 PTE_BLOCK_NON_SHARE |
 			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
-	}, {
-		.virt = 0x80000000UL,
-		.phys = 0x80000000UL,
-		.size = 0x1e780000UL,
-		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
-			 PTE_BLOCK_INNER_SHARE
-	}, {
-		.virt = 0xa0000000UL,
-		.phys = 0xa0000000UL,
-		.size = 0x60000000UL,
-		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
-			 PTE_BLOCK_INNER_SHARE
-	}, {
-		.virt = 0x880000000UL,
-		.phys = 0x880000000UL,
-		.size = 0x80000000UL,
-		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
-			 PTE_BLOCK_INNER_SHARE
-	}, {
+	}, { /* Flash peripherals */
 		.virt = 0x500000000UL,
 		.phys = 0x500000000UL,
 		.size = 0x380000000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 			 PTE_BLOCK_NON_SHARE |
 			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
-	}, {
-		/* List terminator */
+	}, { /* Map SPL load region and the next 128MiB as cacheable */
+		.virt = CONFIG_SPL_TEXT_BASE,
+		.phys = CONFIG_SPL_TEXT_BASE,
+		.size = SZ_128M,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, { /* List terminator */
 		0,
 	}
 };
-- 
2.49.0


  reply	other threads:[~2025-07-03 13:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03 13:35 [PATCH v5 0/4] Add support for dynamic MMU configuration Anshul Dalal
2025-07-03 13:35 ` Anshul Dalal [this message]
2025-07-03 13:35 ` [PATCH v5 2/4] mach-k3: add runtime configuration of MMU table Anshul Dalal
2025-07-07 20:15   ` Ilias Apalodimas
2025-08-14 14:11     ` Anshul Dalal
2025-08-21  6:20       ` Ilias Apalodimas
2025-07-03 13:35 ` [PATCH v5 3/4] mach-k3: add dynamic mmu fixups for SPL stage Anshul Dalal
2025-07-07 20:09   ` Ilias Apalodimas
2025-08-14 14:51     ` Anshul Dalal
2025-08-21  6:17       ` Ilias Apalodimas
2025-07-03 13:35 ` [PATCH v5 4/4] board: add call to k3_mem_map_init for all k3 boards Anshul Dalal

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=20250703133533.104758-2-anshuld@ti.com \
    --to=anshuld@ti.com \
    --cc=a-nandan@ti.com \
    --cc=afd@ti.com \
    --cc=bb@ti.com \
    --cc=devarsht@ti.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=ggiordano@phytec.com \
    --cc=m-chawdhry@ti.com \
    --cc=nm@ti.com \
    --cc=robertcnelson@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=u-kumar1@ti.com \
    --cc=vigneshr@ti.com \
    --cc=w.egorov@phytec.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