Skip to contentSkip to conversation

of: make MAX_RESERVED_REGIONS configurable

PATCH Superseded Calvin Zhang 2 participants 3 messages Nov 15, 2021 Device tree

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of: make MAX_RESERVED_REGIONS configurable

MAX_RESERVED_REGIONS has changed several times. Max reserved regions count grow bigger as more SOC subsystems require reserved regions.

Add a Kconfig for it so that when properly configured, the static reserved_mem array consumes less memory on systems with few reserved regions.

---
 drivers/of/Kconfig           | 10 ++++++++++
 drivers/of/of_reserved_mem.c |  3 +--
 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/of/Kconfig +10 -0
index 80b5fd44ab1c..591b2c4d9dd0 100644
@@ -73,6 +73,16 @@ config OF_IRQ
 config OF_RESERVED_MEM
 	def_bool OF_EARLY_FLATTREE
 
+config OF_MAX_RESERVED_REGIONS
+    int "Maximum count of reserved regions"
+    depends on OF_RESERVED_MEM
+    default 64
+    help
+        Reserved regions in /reserved-memory node includes static
+        reservations with fixed location and dynamic ones for device
+        cma regions. This parameter sets the maximum number of reserved
+        regions in the system.
+
 config OF_RESOLVE
 	bool
 
drivers/of/of_reserved_mem.c +1 -2
index 9c0fb962c22b..d90ae4c03011 100644
@@ -25,8 +25,7 @@
 
 #include "of_private.h"
 
-#define MAX_RESERVED_REGIONS	64
-static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS];
+static struct reserved_mem reserved_mem[CONFIG_OF_MAX_RESERVED_REGIONS];
 static int reserved_mem_count;
 
 static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
Signature · 1 line
2.30.2
#1 lore raw
Quoted 6 lines · Calvin Zhang
drivers/of/Kconfig +0 -0
index 80b5fd44ab1c..591b2c4d9dd0 100644
@@ -73,6 +73,16 @@ config OF_IRQ
  config OF_RESERVED_MEM

drivers/of/Kconfig config OF_IRQ · line 83

Quoted 10 lines
drivers/of/Kconfig +8 -0
  	def_bool OF_EARLY_FLATTREE
 
+config OF_MAX_RESERVED_REGIONS
+    int "Maximum count of reserved regions"
+    depends on OF_RESERVED_MEM
+    default 64
+    help
+        Reserved regions in /reserved-memory node includes static
+        reservations with fixed location and dynamic ones for device
+        cma regions. This parameter sets the maximum number of reserved

CMA

(as is used in mm/Kconfig)

drivers/of/Kconfig config OF_IRQ · line 84

Quoted 1 line
drivers/of/Kconfig +1 -0
+        regions in the system.

Also, all 4 lines of the help text should be indented with one tab + 2 spaces, not all spaces.

thanks.

Signature · 1 line
~Randy
#2 lore raw
Quoted 19 lines · Randy Dunlap
Quoted 5 lines · Calvin Zhang
drivers/of/Kconfig +0 -0
index 80b5fd44ab1c..591b2c4d9dd0 100644

drivers/of/Kconfig config OF_IRQ · line 82

Quoted 10 lines
drivers/of/Kconfig +8 -0
@@ -73,6 +73,16 @@ config OF_IRQ
  config OF_RESERVED_MEM
  	def_bool OF_EARLY_FLATTREE
+config OF_MAX_RESERVED_REGIONS
+    int "Maximum count of reserved regions"
+    depends on OF_RESERVED_MEM
+    default 64
+    help
+        Reserved regions in /reserved-memory node includes static
+        reservations with fixed location and dynamic ones for device
+        cma regions. This parameter sets the maximum number of reserved

CMA

Quoted 7 lines

(as is used in mm/Kconfig)

drivers/of/Kconfig config OF_IRQ · line 84

Quoted 1 line
drivers/of/Kconfig +1 -0
+        regions in the system.

Also, all 4 lines of the help text should be indented with one tab + 2 spaces, not all spaces.

Thanks for the review. I will send a v2.

Quoted 5 lines

thanks.

Signature · 1 line
~Randy