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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220730003846.1730265-1-balsup@cisco.com>
Date:   Fri, 29 Jul 2022 17:38:46 -0700
From:   Billie Alsup <balsup@...co.com>
To:     balsup@...co.com, linux@...linux.org.uk, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
        x86@...nel.org, hpa@...or.com, arnd@...db.de,
        linus.walleij@...aro.org, ardb@...nel.org,
        rmk+kernel@...linux.org.uk, rostedt@...dmis.org,
        nick.hawkins@....com, john@...ozen.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] Allow configuration of ARCH_NR_GPIO

From: Billie R Alsup <balsup@...co.com>

Problem: Some systems support a high number of GPIO pins.  Allow
the kernel builder to configure the maximum number of pins, rather
than forcing a large value on everyone.

Impact: Once a .config is generated, the ARCH_NR_GPIO setting
will persist.  To return to a default setting, the CONFIG_ARCH_NR_GPIO
must be removed from .config file first.

Trade-offs: It is possible to achieve similar via command line
parameters, e.g.

    make KBUILD_CFLAGS_KERNEL=-DARCH_NR_GPIOS=16384

to the build. This is problematic because the setting does not
show up in /proc/config.gz.  It is also problematic for out-of-tree
module builds, which require similar if they invoke the API
gpio_is_valid().  In both cases, one could envision one system
working normally, and another failing, even though they both have
the same kernel version and /proc/config.gz.  Therefore, it is
better to have the setting available in .config

Signed-off-by: Billie R Alsup <balsup@...co.com>
---
 arch/arm/Kconfig | 2 +-
 arch/x86/Kconfig | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7630ba9cb6cc..7fc6e52d1d3c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1226,7 +1226,7 @@ config ARM_PSCI
 # a multiplatform kernel, we just want the highest value required by the
 # selected platforms.
 config ARCH_NR_GPIO
-	int
+	int "Maximum number of GPIOs supported"
 	default 2048 if ARCH_INTEL_SOCFPGA
 	default 1024 if ARCH_BRCMSTB || ARCH_RENESAS || ARCH_TEGRA || \
 		ARCH_ZYNQ || ARCH_ASPEED
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 52a7f91527fe..a59cef517f56 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -347,9 +347,13 @@ config ARCH_HIBERNATION_POSSIBLE
 	def_bool y
 
 config ARCH_NR_GPIO
-	int
+	int "Maximum number of GPIOs supported"
 	default 1024 if X86_64
 	default 512
+	help
+	  Maximum number of GPIOs in the system.
+
+	  If unsure, leave the default value.
 
 config ARCH_SUSPEND_POSSIBLE
 	def_bool y
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ