linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: make MAX_RESERVED_REGIONS configurable
@ 2021-11-15  6:35 Calvin Zhang
  2021-11-15  6:40 ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Calvin Zhang @ 2021-11-15  6:35 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand; +Cc: devicetree, linux-kernel, Calvin Zhang

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.

Signed-off-by: Calvin Zhang <calvinzhang.cool@gmail.com>
---
 drivers/of/Kconfig           | 10 ++++++++++
 drivers/of/of_reserved_mem.c |  3 +--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 80b5fd44ab1c..591b2c4d9dd0 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -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
 
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 9c0fb962c22b..d90ae4c03011 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -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,
-- 
2.30.2


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

* Re: [PATCH] of: make MAX_RESERVED_REGIONS configurable
  2021-11-15  6:35 [PATCH] of: make MAX_RESERVED_REGIONS configurable Calvin Zhang
@ 2021-11-15  6:40 ` Randy Dunlap
  2021-11-15  7:14   ` Calvin Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2021-11-15  6:40 UTC (permalink / raw)
  To: Calvin Zhang, Rob Herring, Frank Rowand; +Cc: devicetree, linux-kernel

On 11/14/21 10:35 PM, Calvin Zhang wrote:
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index 80b5fd44ab1c..591b2c4d9dd0 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -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

(as is used in mm/Kconfig)

> +        regions in the system.

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


thanks.
-- 
~Randy

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

* Re: [PATCH] of: make MAX_RESERVED_REGIONS configurable
  2021-11-15  6:40 ` Randy Dunlap
@ 2021-11-15  7:14   ` Calvin Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Calvin Zhang @ 2021-11-15  7:14 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Calvin Zhang, Rob Herring, Frank Rowand, devicetree, linux-kernel

On Sun, Nov 14, 2021 at 10:40:29PM -0800, Randy Dunlap wrote:
>On 11/14/21 10:35 PM, Calvin Zhang wrote:
>> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
>> index 80b5fd44ab1c..591b2c4d9dd0 100644
>> --- a/drivers/of/Kconfig
>> +++ b/drivers/of/Kconfig
>> @@ -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
>
>(as is used in mm/Kconfig)
>
>> +        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.
>
>thanks.
>-- 
>~Randy
>

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

end of thread, other threads:[~2021-11-15  7:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  6:35 [PATCH] of: make MAX_RESERVED_REGIONS configurable Calvin Zhang
2021-11-15  6:40 ` Randy Dunlap
2021-11-15  7:14   ` Calvin Zhang

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).