devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: Make the number of reserved memory regions configurable
@ 2025-10-23 15:35 Maxime Ripard
  2025-10-24 12:57 ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Ripard @ 2025-10-23 15:35 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan
  Cc: Eric Chanudet, Radu Rendec, devicetree, linux-kernel,
	Maxime Ripard

Some platforms register more reserved memory regions than the current
hardcoded limit of 64.

Let's turn into a Kconfig option so we can easily tune it according to a
platform needs, while keeping the current value as a default.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/of/Kconfig      | 12 ++++++++++++
 drivers/of/of_private.h |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 50697cc3b07ebeb24283e22299797ce4612db89c..721221ae73cef118f8bde8c64c6298aa5f1d106e 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -97,10 +97,22 @@ config OF_IRQ
 	depends on !SPARC && IRQ_DOMAIN
 
 config OF_RESERVED_MEM
 	def_bool OF_EARLY_FLATTREE
 
+config OF_RESERVED_MEM_AREAS
+	int "Maximum count of reserved memory areas"
+	depends on OF_RESERVED_MEM
+	default 64
+	help
+	  Platforms can create a number of reserved memory region
+	  to accomodate their firmware,	describe driver-specific
+	  memory regions, etc. This parameters sets the maximum
+	  number of reserved memory areas in the system.
+
+	  If unsure, leave to its default value 64.
+
 config OF_RESOLVE
 	bool
 
 config OF_OVERLAY
 	bool "Device Tree overlays"
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index df0bb00349e01145930fa85c195aefc0a7c32a06..af424ca876b4481c21563bfbac8691a74a42970b 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -7,11 +7,11 @@
  * Paul Mackerras	August 1996.
  * Copyright (C) 1996-2005 Paul Mackerras.
  */
 
 #define FDT_ALIGN_SIZE 8
-#define MAX_RESERVED_REGIONS    64
+#define MAX_RESERVED_REGIONS    CONFIG_OF_RESERVED_MEM_AREAS
 
 /**
  * struct alias_prop - Alias property in 'aliases' node
  * @link:	List node to link the structure in aliases_lookup list
  * @alias:	Alias property name

---
base-commit: efb26a23ed5f5dc3554886ab398f559dcb1de96b
change-id: 20251023-of-max-reserved-mem-a8e8d7db3afe

Best regards,
-- 
Maxime Ripard <mripard@kernel.org>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] of: Make the number of reserved memory regions configurable
  2025-10-23 15:35 [PATCH] of: Make the number of reserved memory regions configurable Maxime Ripard
@ 2025-10-24 12:57 ` Rob Herring
  2025-10-27 10:02   ` Maxime Ripard
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2025-10-24 12:57 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Saravana Kannan, Eric Chanudet, Radu Rendec, devicetree,
	linux-kernel

On Thu, Oct 23, 2025 at 10:35 AM Maxime Ripard <mripard@kernel.org> wrote:
>
> Some platforms register more reserved memory regions than the current
> hardcoded limit of 64.

I've already NAKed a kconfig option for this before.

The limit is now 64 dynamic regions, not total. The static regions are
unlimited. What platform needs so many regions and to abuse
/reserved-memory like this?

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] of: Make the number of reserved memory regions configurable
  2025-10-24 12:57 ` Rob Herring
@ 2025-10-27 10:02   ` Maxime Ripard
  2025-10-27 13:48     ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Ripard @ 2025-10-27 10:02 UTC (permalink / raw)
  To: Rob Herring
  Cc: Saravana Kannan, Eric Chanudet, Radu Rendec, devicetree,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

Hi Rob,

Thanks for your answer!

On Fri, Oct 24, 2025 at 07:57:06AM -0500, Rob Herring wrote:
> On Thu, Oct 23, 2025 at 10:35 AM Maxime Ripard <mripard@kernel.org> wrote:
> >
> > Some platforms register more reserved memory regions than the current
> > hardcoded limit of 64.
> 
> I've already NAKed a kconfig option for this before.
> 
> The limit is now 64 dynamic regions, not total. The static regions are
> unlimited. What platform needs so many regions and to abuse
> /reserved-memory like this?

I'm sorry, I totally missed both that you nacked it and that it got
fixed recently. We're still seeing the issue with 6.12, but it looks like

https://lore.kernel.org/all/20241008220624.551309-1-quic_obabatun@quicinc.com/

Is the series you were talking about?

Thanks,
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] of: Make the number of reserved memory regions configurable
  2025-10-27 10:02   ` Maxime Ripard
@ 2025-10-27 13:48     ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2025-10-27 13:48 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Saravana Kannan, Eric Chanudet, Radu Rendec, devicetree,
	linux-kernel

On Mon, Oct 27, 2025 at 11:02:39AM +0100, Maxime Ripard wrote:
> Hi Rob,
> 
> Thanks for your answer!
> 
> On Fri, Oct 24, 2025 at 07:57:06AM -0500, Rob Herring wrote:
> > On Thu, Oct 23, 2025 at 10:35 AM Maxime Ripard <mripard@kernel.org> wrote:
> > >
> > > Some platforms register more reserved memory regions than the current
> > > hardcoded limit of 64.
> > 
> > I've already NAKed a kconfig option for this before.
> > 
> > The limit is now 64 dynamic regions, not total. The static regions are
> > unlimited. What platform needs so many regions and to abuse
> > /reserved-memory like this?
> 
> I'm sorry, I totally missed both that you nacked it and that it got
> fixed recently. We're still seeing the issue with 6.12, but it looks like
> 
> https://lore.kernel.org/all/20241008220624.551309-1-quic_obabatun@quicinc.com/
> 
> Is the series you were talking about?

Yes. Plus some fixes on top of that. Every time this code is touched, we 
break someone...

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-27 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 15:35 [PATCH] of: Make the number of reserved memory regions configurable Maxime Ripard
2025-10-24 12:57 ` Rob Herring
2025-10-27 10:02   ` Maxime Ripard
2025-10-27 13:48     ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).