of: make MAX_RESERVED_REGIONS configurable
PATCH v2 1/1 of: make MAX_RESERVED_REGIONS configurable
MAX_RESERVED_REGIONS has changed several times. Max reserved regions count grows 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
@@ -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
@@ -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
Quoted 7 lines · Calvin Zhang
MAX_RESERVED_REGIONShas changed several times. Max reserved regions count grows bigger as more SOC subsystems require reserved regions.Add a
Kconfigfor it so that when properly configured, the staticreserved_memarray consumes less memory on systems with few reserved regions.
Please read prior discussions:
https://lore.kernel.org/all/?q=of+MAX_RESERVED_REGIONS
And these 2 in particular:
https://lore.kernel.org/all/CAL_JsqJQcWsguwfehAoaRf4o-2VqXxSzKzTqg7s4+N1bp=6V5Q@mail.gmail.com/
https://lore.kernel.org/all/CAL_JsqLGvUYQmCGXLgSO+6kFj2i87dpaTbMGbyu5oMt=eeu35A@mail.gmail.com/
Quoted 9 lines · Rob Herring
Quoted 7 lines · Calvin Zhang
MAX_RESERVED_REGIONShas changed several times. Max reserved regions count grows bigger as more SOC subsystems require reserved regions.Add a
Kconfigfor it so that when properly configured, the staticreserved_memarray consumes less memory on systems with few reserved regions.
Quoted 9 lines
Please read prior discussions:
https://lore.kernel.org/all/?q=of+MAX_RESERVED_REGIONS
And these 2 in particular:
https://lore.kernel.org/all/CAL_JsqJQcWsguwfehAoaRf4o-2VqXxSzKzTqg7s4+N1bp=6V5Q@mail.gmail.com/
https://lore.kernel.org/all/CAL_JsqLGvUYQmCGXLgSO+6kFj2i87dpaTbMGbyu5oMt=eeu35A@mail.gmail.com/
OK. I will try to make the array dynamic.
Thanks,
Calvin