[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172384248618.2197825.13104717668175387439.robh@kernel.org>
Date: Fri, 16 Aug 2024 15:08:08 -0600
From: "Rob Herring (Arm)" <robh@...nel.org>
To: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
Cc: kernel@...cinc.com, klarasmodin@...il.com, saravanak@...gle.com,
robin.murphy@....com, m.szyprowski@...sung.com,
aisheng.dong@....com, hch@....de, devicetree@...r.kernel.org,
will@...nel.org, iommu@...ts.linux.dev, catalin.marinas@....com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 2/2] of: reserved_mem: Add code to dynamically
allocate reserved_mem array
On Fri, 09 Aug 2024 11:48:14 -0700, Oreoluwa Babatunde wrote:
> The reserved_mem array is statically allocated with a size of
> MAX_RESERVED_REGIONS(64). Therefore, if the number of reserved_mem
> regions exceeds this size, there will not be enough space to store
> all the data.
>
> Hence, extend the use of the static array by introducing a
> dynamically allocated array based on the number of reserved memory
> regions specified in the DT.
>
> On architectures such as arm64, memblock allocated memory is not
> writable until after the page tables have been setup. Hence, the
> dynamic allocation of the reserved_mem array will need to be done only
> after the page tables have been setup.
>
> As a result, a temporary static array is still needed in the initial
> stages to store the information of the dynamically-placed reserved
> memory regions because the start address is selected only at run-time
> and is not stored anywhere else.
> It is not possible to wait until the reserved_mem array is allocated
> because this is done after the page tables are setup and the reserved
> memory regions need to be initialized before then.
>
> After the reserved_mem array is allocated, all entries from the static
> array is copied over to the new array, and the rest of the information
> for the statically-placed reserved memory regions are read in from the
> DT and stored in the new array as well.
>
> Once the init process is completed, the temporary static array is
> released back to the system because it is no longer needed. This is
> achieved by marking it as __initdata.
>
> Signed-off-by: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
> ---
> drivers/of/of_reserved_mem.c | 68 +++++++++++++++++++++++++++++++++---
> 1 file changed, 64 insertions(+), 4 deletions(-)
>
Applied, thanks!
Powered by blists - more mailing lists