From: Anshul Dalal <anshuld@ti.com>
To: Emanuele Ghidoli <ghidoliemanuele@gmail.com>,
Anshul Dalal <anshuld@ti.com>,
Francesco Dolcini <francesco@dolcini.it>, <trini@konsulko.com>,
Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Cc: <u-boot@lists.denx.de>, <d-gole@ti.com>, <b-padhi@ti.com>,
<vigneshr@ti.com>, <nm@ti.com>, <robertcnelson@gmail.com>,
<w.egorov@phytec.de>, <francesco.dolcini@toradex.com>,
<ggiordano@phytec.com>, <m-chawdhry@ti.com>, <afd@ti.com>,
<bb@ti.com>, <u-kumar1@ti.com>, <devarsht@ti.com>,
<ilias.apalodimas@linaro.org>, <xypron.glpk@gmx.de>
Subject: Re: [REGRESSION] Re: [PATCH v11 00/11] Add support for dynamic MMU configuration
Date: Fri, 31 Oct 2025 17:13:21 +0530 [thread overview]
Message-ID: <DDWHBO3NYVG1.2GFO0LYSSGZYF@ti.com> (raw)
In-Reply-To: <071bbf2d-0cbd-4359-abfa-b020b5d32ef5@gmail.com>
On Fri Oct 31, 2025 at 4:30 PM IST, Emanuele Ghidoli wrote:
>
>
> On 29/10/2025 09:58, Anshul Dalal wrote:
>> On Tue Oct 28, 2025 at 10:26 PM IST, Emanuele Ghidoli wrote:
>>> On 28/10/2025 05:38, Anshul Dalal wrote:
>>>> Hi Francesco,
>>>>
>>>> On Mon Oct 27, 2025 at 10:22 PM IST, Francesco Dolcini wrote:
>>>>> Hello Anshul,
>>>>>
>>>>> On Fri, Oct 17, 2025 at 06:45:22PM +0530, Anshul Dalal wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> In U-Boot, TI only provides a single memory map for all k3 platforms, this
>>>>>> does not scale for devices where atf and optee lie outside the range 0x80000000
>>>>>> - 0x80080000 and 0x9e780000 - 0xa0000000 respectively.
>>>>>>
>>>>>> There are also issues for devices with < 2GiB of memory (eg am62SiP with 512MiB
>>>>>> of RAM) as the maximum size for the first DRAM bank is hardcoded to 2GiB in the
>>>>>> current memory map. Furthermore the second DRAM bank is mapped even for devices
>>>>>> that only have a single bank.
>>>>>>
>>>>>> Therefore this patch set adds the required functionality to create the MMU table
>>>>>> at runtime based on the device-tree.
>>>>>>
>>>>>> The patch set has been build tested on all effected platforms but boot-tested
>>>>>> only on TI's K3 EVMs, the beagleplay and phytec's phycore-am6* platforms.
>>>>>>
>>>>>> The following effected boards have not been boot tested:
>>>>>> - verdin-am62
>>>>>
>>>>> it seems that this series introduce a regression on verdin-am62, I have
>>>>> not done a bi-sect yet, but we run daily build of U-Boot master and the
>>>>> regressions seems to have started when this patch series was
>>>>> merged.
>>>>>
>>>>> On verdin-am62 we detect the RAM size at run-time, see
>>>>> board/toradex/verdin-am62/verdin-am62.c:dram_init(), and now we always
>>>>> get 2GiB even for modules with only 512MB or 1024MB of memory.
>>>>>
>>>>
>>>> This patch series modified the behavior of enable_caches to configure the
>>>> memory map of the device as per the device-tree instead of using a
>>>> static map for all of K3.
>>>>
>>>> The issue with verdin-am62 seems to be that while you do properly
>>>> configure gd->ram_size in your dram_init, the '/memory' node of the
>>>> device-tree remains unchanged with the outdated 2GiB size.
>>>>
>>>> You could try updating the fdt's memory size to the correct value in
>>>> dram_init and see if that fixes the problem.
>>>>
>>>> Regards,
>>>> Anshul
>>> Hello Anshul,
>>>
>>> I was bisecting the series, and I can confirm that the commit "mach-k3: map
>>> all banks using mem_map_from_dram_banks" introduces the regression.
>>>
>>> Given that initcall_run_f() calls dram_init_banksize(), and after relocation
>>> board_init_r() calls enable_caches() (call stack: board_init_r() ->
>>> initcall_run_r() -> initr_caches() -> enable_caches()), I would expect that
>>> enable_caches() should not override the bank sizes previously configured.
>>> Currently, however, enable_caches() introduces this side effect.
>>>
>>> Wouldn’t it make more sense to call fdtdec_setup_memory_banksize() in the
>>> default dram_init_banksize() (in arch/arm/mach-k3/k3-ddr.c) and avoid calling
>>> it again in mem_map_from_dram_banks()?
>>>
>>
>> We could follow that order too but that would makes a call to
>> mem_map_from_dram_banks dependent on gd->bd->di_dram being correctly
>> populated. I had assumed whoever calls mem_map_from_dram_banks had made
>> sure to properly fixup the memory node of the fdt.
>>
>> Given that it seems like the root cause of the problem is with the
>> U-Boot's device-tree not having the correct memory node, we could add a
>> call to fixup_memory_node (arch/arm/mach-k3/k3-ddr.c) from A53 SPL to
>> ensure the memory can be queried stright from the device-tree once we do
>> get to U-Boot proper.
>>
>> --- a/board/toradex/verdin-am62/verdin-am62.c
>> +++ b/board/toradex/verdin-am62/verdin-am62.c
>> @@ -46,6 +46,13 @@ int dram_init_banksize(void)
>> return ret;
>> }
>>
>> +#ifdef CONFIG_XPL_BUILD
>> +void spl_perform_board_fiups(struct spl_image_info *spl_image)
>> +{
>> + fixup_memory_node(spl_image);
>> +}
>> +#endif
>> +
>> /*
>> * Avoid relocated U-Boot clash with Linux reserved-memory on 512 MB SoM
>> */
>>
>>
>> If you could get to U-Boot prompt with the above diff, could you
>> share the output of the 'meminfo' command with the following configs
>> added:
>> CONFIG_CMD_MEMINFO=y
>> CONFIG_CMD_MEMINFO_MAP=y
>>
>> Though so far, I have been unsuccessful in my attempts to reproduce a
>> boot failure on our own 512MiB platforms (AM62x SiP). Could you share
>> the boot logs with '#define DEBUG' in common/board_r.c, common/board_f.c
>> and mach-k3/common.c to help further narrow down the issue.
>>
>> Regards,
>> Anshul
>
> Hello Anshul,
> let me try to rephrase.
>
> The enable_caches() function is not only enabling caches, but also updating
> the memory map.
> It is not expected from the point of view of the caller and this side effect
> introduces a regression on our U-Boot, since the memory banks are already
> configured in dram_init().
Hi Emanuele,
Ah, I see your point. In that case mem_map_from_dram_banks should only
rely on the gd with dram_init and dram_init_banksize taking care of
configuring gd properly.
I'll send a fix as per your suggestion (moving
fdtdec_setup_memory_banksize to the default dram_init_banksize) shortly.
Regards,
Anshul
>
> I understand that updating the device tree, as you proposed, could work around
> the issue, but that does not really fix the root cause.
> Having a function perform unexpected operations is the best way to introduce
> regressions now and bugs in the future.
>
> We should either revert the patch or properly fix the issue.
>
> Regards,
> Emanuele
prev parent reply other threads:[~2025-10-31 11:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 13:15 [PATCH v11 00/11] Add support for dynamic MMU configuration Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 01/11] mach-k3: use minimal memory map for all K3 Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 02/11] mach-k3: use custom enable_cache Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 03/11] arm: armv8: mmu: export mmu_setup Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 04/11] arm: armv8: invalidate dcache entries on dcache_enable Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 05/11] arm: armv8: mmu: add mem_map_from_dram_banks Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 06/11] mach-k3: map all banks using mem_map_from_dram_banks Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 07/11] arm: armv8: mmu: add mmu_unmap_reserved_mem Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 08/11] spl: split spl_board_fixups to arch/board specific Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 09/11] mach-k3: add reserved memory fixups for next boot stage Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 10/11] mach-k3: add carveouts for TFA and optee Anshul Dalal
2025-10-17 13:15 ` [PATCH v11 11/11] arm: mach-k3: reserve space for page table entries Anshul Dalal
2025-10-22 20:14 ` [PATCH v11 00/11] Add support for dynamic MMU configuration Tom Rini
2025-10-27 16:52 ` [REGRESSION] " Francesco Dolcini
2025-10-28 4:38 ` Anshul Dalal
2025-10-28 16:56 ` Emanuele Ghidoli
2025-10-29 8:58 ` Anshul Dalal
2025-10-31 11:00 ` Emanuele Ghidoli
2025-10-31 11:43 ` Anshul Dalal [this message]
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=DDWHBO3NYVG1.2GFO0LYSSGZYF@ti.com \
--to=anshuld@ti.com \
--cc=afd@ti.com \
--cc=b-padhi@ti.com \
--cc=bb@ti.com \
--cc=d-gole@ti.com \
--cc=devarsht@ti.com \
--cc=emanuele.ghidoli@toradex.com \
--cc=francesco.dolcini@toradex.com \
--cc=francesco@dolcini.it \
--cc=ggiordano@phytec.com \
--cc=ghidoliemanuele@gmail.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 \
--cc=xypron.glpk@gmx.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