[PATCH] imx: Fix usable memory ranges for imx8m SOCs

Mark Kettenis mark.kettenis at xs4all.nl
Wed Dec 18 23:53:05 CET 2024


> Date: Wed, 18 Dec 2024 10:17:54 +0100
> From: Frieder Schrempf <frieder.schrempf at kontron.de>

Hi,

> On 18.12.24 10:00 AM, Ilias Apalodimas wrote:
> > In the long run we should change all of the above and have 32b and 64b
> > platforms define ram_top identically.
> 
> Some more ideas for cleaning up the situation in the long run:
> 
> * Get rid of board_get_usable_ram_top() and fix the drivers that require
>   address space below SZ_4G.

Note that in many cases there are hardware limitations that restrict
access to memory above SZ_4G by these devices.  So the only way to
"fix" the drivers would be to add bounce buffer support to them.  That
typically isn't trivial and adds complexity, especially when dealing
with things like DMA rings.  And it will make things slower.

These boards all seem to have plenty of memory below SZ_4G, so I think
board_get_usable_ram_top() is actually a very reasonable solution for
the problem.

> * Parse the 'dma-ranges' property in the SoC node of the devicetree
>   which already tells us what address space is usable (at least for
>   i.MX8M).

We do this in OpenBSD to determine a memory range that is "DMA-safe".
It isn't entirely trivial though.  Not all boards have the relevant
'dma-ranges' property in the SoC node, and some boards have a
'dma-ranges' on nodes further down the tree that are very restrictive
and not really relevant for what U-Boot wants to do.  So you'd
probably need a Kconfig option to override this.

Cheers,

Mark


More information about the U-Boot mailing list