Re: [PATCH 2/2] of: reserved_mem: add config to extend dynamic reserved memory regions

From: Wandun

Date: Thu Jun 04 2026 - 22:24:13 EST




On 6/5/26 03:33, Rob Herring wrote:
On Thu, Jun 04, 2026 at 03:36:11PM +0800, Wandun Chen wrote:
From: Wandun Chen <chenwandun@xxxxxxxxxxx>

Nowadays, the dynamic reserved memory regions is 64 by default, If
the count of reserved memory regions defined in DTS bigger than 64,
only 64 reserved memory can be handled properly.

So add a config to configure the actual dynamic reserved memory
regions count instead of modify the code.

Signed-off-by: Wandun Chen <chenwandun@xxxxxxxxxxx>
---
drivers/of/Kconfig | 11 +++++++++++
drivers/of/of_private.h | 2 +-
drivers/of/of_reserved_mem.c | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 50697cc3b07e..d6496ec3765c 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -99,6 +99,17 @@ config OF_IRQ
config OF_RESERVED_MEM
def_bool OF_EARLY_FLATTREE
+config OF_RESERVED_MEM_DYNAMIC_REGIONS
+ int "Maximum count of the dynamic reserved memory regions"
+ depends on OF_RESERVED_MEM
+ default 64
+ range 1 256
My opinion on making this a config option is well documented. That's the
primary reason we split dynamic regions.
Get it.

How many do you need and why do you need so many regions? Seems like an
abuse of reserved memory.
I also agree that 64 dynamic regions should be sufficient for reasonable use cases.
To give some context on why I wrote this patch: the 64 dynamic region limit is implicit, there is no message to inform the user, but more than 64 regions also seems like an abuse of reserved memory. I will drop this patch as well, thanks for the review. Best regards, Wandun

Rob