[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231204185409.19615-7-quic_obabatun@quicinc.com>
Date: Mon, 4 Dec 2023 10:54:09 -0800
From: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
To: <catalin.marinas@....com>, <will@...nel.org>, <robh+dt@...nel.org>,
<frowand.list@...il.com>, <dinguyen@...nel.org>,
<chenhuacai@...nel.org>, <tsbogend@...ha.franken.de>,
<jonas@...thpole.se>, <stefan.kristiansson@...nalahti.fi>,
<shorne@...il.com>, <mpe@...erman.id.au>,
<ysato@...rs.sourceforge.jp>, <dalias@...c.org>,
<glaubitz@...sik.fu-berlin.de>, <richard@....at>,
<anton.ivanov@...bridgegreys.com>, <johannes@...solutions.net>,
<chris@...kel.net>, <jcmvbkbc@...il.com>
CC: <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-arm-msm@...r.kernel.org>, <kernel@...cinc.com>,
Oreoluwa Babatunde <quic_obabatun@...cinc.com>
Subject: [RFC PATCH v2 6/6] of: reserved_mem: Make MAX_RESERVED_REGIONS a config option
Make the value of MAX_RESERVED_REGIONS a config option which can be
modified based on user requirements.
The reserved_mem_array is required during device bootup to store the
information of the dynamically-placed reserved memory regions.
After paging_init(), this information is transferred to another
array which is dynamically allocated and used to store all the reserved
memory regions.
There is currently no obvious way to free the memory for the static
array after its contents are copied over to the dynamically allocated
array, but since the size required for the reserved_mem_array can vary
from device to device depending on the number of dynamically-placed
reserved memory regions, make the size of the array configurable in an
attempt to save some memory.
Signed-off-by: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
---
drivers/of/Kconfig | 13 +++++++++++++
drivers/of/of_private.h | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index da9826accb1b..409ce2527461 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -102,4 +102,17 @@ config OF_OVERLAY
config OF_NUMA
bool
+config OF_MAX_RESERVED_REGIONS
+ int "OF resvered_mem array size"
+ default "64"
+ range 1 64
+ help
+ The reserved_mem_array is used to store information about the dynamically
+ placed reserved memory regions before we are able to allocate the memory
+ needed to store all the reserved memory regions defined in the DT.
+ Because the amount of memory needed initially for this array could vary,
+ make the size of the reserved_mem_array configurable in an attempt to
+ save some memory when possible.
+ if unsure, leave as default value.
+
endif # OF
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index ef56b2ea185c..278038bce0c0 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -36,7 +36,7 @@ struct alias_prop {
#endif
#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
-#define MAX_RESERVED_REGIONS 64
+#define MAX_RESERVED_REGIONS CONFIG_OF_MAX_RESERVED_REGIONS
extern struct mutex of_mutex;
extern raw_spinlock_t devtree_lock;
--
2.17.1
Powered by blists - more mailing lists