@@ -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
@@ -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;
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@quicinc.com> --- drivers/of/Kconfig | 13 +++++++++++++ drivers/of/of_private.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-)