lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211115063521.3457302-1-calvinzhang.cool@gmail.com>
Date:   Mon, 15 Nov 2021 14:35:21 +0800
From:   Calvin Zhang <calvinzhang.cool@...il.com>
To:     Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>
Cc:     devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Calvin Zhang <calvinzhang.cool@...il.com>
Subject: [PATCH] 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.

Signed-off-by: Calvin Zhang <calvinzhang.cool@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ