From: Anshul Dalal <anshuld@ti.com>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>, <u-boot@lists.denx.de>
Cc: <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: Re: [PATCH v5 2/4] mach-k3: add runtime configuration of MMU table
Date: Thu, 14 Aug 2025 19:41:03 +0530 [thread overview]
Message-ID: <DC27M9DO6JP0.2ZG4RG8ZUIRMP@ti.com> (raw)
In-Reply-To: <DB63KZ89ZWMY.3KGIHVA42RGM4@linaro.org>
On Tue Jul 8, 2025 at 1:45 AM IST, Ilias Apalodimas wrote:
> Hi Anshul,
>
> On Thu Jul 3, 2025 at 4:35 PM EEST, Anshul Dalal wrote:
>> k3_mem_map is used by u-boot to configure the MMU on k3 devices but
>> currently it's a static array which does not scale for platforms with
>> non-standard load addresses for ATF and OP-TEE. Additionally on systems
>> with limited DRAM, more space is mapped than is available on the device.
>>
>> Therefore this patch adds a new k3_mem_map_init function which can
>> be called from dram_init to configure the table at runtime where we
>> can query the required DDR information and reserved regions from the
>> device-tree.
>
> Is this a problem for k3 only? This kind of code should be aimed at the mmu
> support and improving armv8 overall, not specific platforms
>
In K3 we try to support a wide array of SoCs with a single memory map.
Since the requirements are similar across all K3 devices i.e:
1. Map all DDR banks
2. Create carveouts for ATF and OPTEE
3. At SPL stage, map framebuffer region for VIDEO enabled devices
Of the 3 here, #1 and #3 could be useful for ARMv8 overall but #2 is
quite specific to the platform's boot flow.
As I see it, since most of the existing platforms are using a static map
and thus won't benefit from a generic way to handle #1 and #3. The few
that do have runtime fixups for the memory map, only seem to have #1 in
common (imx and renesas).
>>
>> A dummy implementation is also added in r5/common.c to allow the build
>> to pass without masking each call to k3_mem_map_init behind an ifdef
>> CONFIG_ARM64.
>>
>> Signed-off-by: Anshul Dalal <anshuld@ti.com>
>
> [...]
>
>> +
>> +static void k3_mmu_add_cachable_entry(u64 start, u64 end, unsigned int *map_idx)
>> +{
>> + if (start >= end)
>> + return;
>> +
>> + k3_mem_map[*map_idx].virt = start,
>> + k3_mem_map[*map_idx].phys = start,
>> + k3_mem_map[*map_idx].size = end - start,
>> + k3_mem_map[*map_idx].attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
>> + PTE_BLOCK_INNER_SHARE;
>> + (*map_idx)++;
>> +}
>
> Doesn't this need a break-before-make?
> Also why does it have to be a board specific function? Is there something mmu_change_region_attr()
> doesn't do ?
>
Oh, I wasn't aware of that API, I'll update in my next revision.
Thanks for the review,
Anshul
next prev parent reply other threads:[~2025-08-14 14:12 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 ` [PATCH v5 1/4] mach-k3: use minimal MMU table for all k3 Anshul Dalal
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 [this message]
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=DC27M9DO6JP0.2ZG4RG8ZUIRMP@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=ilias.apalodimas@linaro.org \
--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