Re: [PATCH v3 0/2] of: reserved_mem: use dynamically allocated reserved_mem array

From: Marek Szyprowski

Date: Fri Oct 23 2026 - 05:11:26 EST


On 23.10.2026 03:46, Wandun wrote:
> On 10/22/26 17:59, Marek Szyprowski wrote:
>> On 21.10.2026 15:41, Rob Herring wrote:
>>> On Thu, Oct 15, 2026 at 10:23:10AM +0200, Marek Szyprowski wrote:
>>>> Mike Rapoport suggested [1] how to properly use dynamically allocated
>>>> arrays during early boot.
>>>>
>>>> Use this approach for reserved_mem array during early scan of the
>>>> reserved regions. Having all the reserved regions in a single array
>>>> removes the need of the two pass initialization introduced by commit
>>>> 8a6e02d0c00e ("of: reserved_mem: Restructure how the reserved memory
>>>> regions are processed"), so implement it to make the code simpler,
>>>> easier to understand and ready for adding proper error checking.
>>>>
>>>> Tested on ARM32, ARM64 and RiscV64 based boards. Arch specific issues
>>>> with early mappings were discovered by LLM.
>>>>
>>>> [1] https://lore.kernel.org/all/asc6brs_g0ky0wOM@xxxxxxxxxx/
>>>>
>>>>
>>>> Best regards
>>>> Marek Szyprowski, PhD
>>>> Samsung R&D Institute Poland
>>>>
>>>>
>>>> Changelog:
>>>>
>>>> v3:
>>>> - allocate the reserved_mem array only after all static regions are
>>>> reserved or marked as no-map, so it cannot be placed inside any of
>>>> them
>>>> - record failures of the early static reservations and print a single
>>>> message asking to fix the device-tree
>>>> - restore conditional compilation of the early mapping code, because
>>>> some architectures lack support for it (C-SKY & Sparc64 as reported
>>>> by kbuild robot)
>>>> - allocate the array bottom-up, to avoid allocating from highmem, what
>>>> might be an issue on Xtensa, C-SKY and MIPS32
>>>> - don't use the early mapping on PPC64, where the scan is done before
>>>> early_ioremap_setup()
>>>>
>>>> v2: https://lore.kernel.org/all/20261008152403.766439-1-m.szyprowski@xxxxxxxxxxx/
>>>> - removed superfluous ifdefs
>>>>
>>>> v1: https://lore.kernel.org/all/20261008094125.3197971-1-m.szyprowski@xxxxxxxxxxx/
>>>> - initial version
>>>>
>>>>
>>>> Patch summary:
>>>>
>>>> Marek Szyprowski (2):
>>>> of: reserved_mem: group allocation helpers together
>>>> of: reserved_mem: allocate and map the reserved_mem array early
>>> Can you confirm the sashiko issues are not issues?
>>
>> I've replied sashiko review. That are again the preexisting issues initially
>> targeted by Wandun's patchset:
>>
>> https://lore.kernel.org/all/20260920092852.614973-1-chenwandun1@xxxxxxxxx/
> Hi Marek, Rob,
>
> Since this restructuring and my series touch the same code paths, my
> plan is to rebase my series on top of this series once it lands, and
> send a v4 then. Is that OK?

I think that this will be the best plan.

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland