From: Wilson Felipe Pereira <wfelipe@google.com>
To: Arnd Bergmann <arnd@arndb.de>, Andrew Morton <akpm@linux-foundation.org>
Cc: "Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Sven Schnelle" <svens@linux.ibm.com>,
linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-s390@vger.kernel.org,
"Wilson Felipe Pereira" <wfelipe@google.com>,
"Maciej Żenczykowski" <maze@google.com>
Subject: [PATCH 2/3] arch: use CONFIG_COMMAND_LINE_SIZE across all architectures
Date: Thu, 6 Aug 2026 06:14:15 +0000 [thread overview]
Message-ID: <20260806061429.474992-3-wfelipe@google.com> (raw)
In-Reply-To: <20260806061429.474992-1-wfelipe@google.com>
Now that CONFIG_COMMAND_LINE_SIZE is available in init/Kconfig for all
architectures, update every architecture's setup.h header to define
COMMAND_LINE_SIZE as CONFIG_COMMAND_LINE_SIZE.
For user-space API (uapi) headers, wrap the definition in an
`#ifdef __KERNEL__` guard and retain the historical hardcoded default in
the `#else` block. When user-space headers are installed via
`make headers_install`, unifdef strips out the kernel section, ensuring
same value as before for user-space applications including `<asm/setup.h>`.
Originally-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Wilson Felipe Pereira <wfelipe@google.com>
---
arch/alpha/include/uapi/asm/setup.h | 4 ++++
arch/arc/include/asm/setup.h | 2 +-
arch/arm/include/uapi/asm/setup.h | 6 +++++-
arch/arm64/include/uapi/asm/setup.h | 4 ++++
arch/loongarch/include/uapi/asm/setup.h | 4 ++++
arch/m68k/include/uapi/asm/setup.h | 6 +++++-
arch/microblaze/include/uapi/asm/setup.h | 4 ++++
arch/mips/include/uapi/asm/setup.h | 4 ++++
arch/parisc/include/uapi/asm/setup.h | 4 ++++
arch/powerpc/include/uapi/asm/setup.h | 4 ++++
arch/riscv/include/uapi/asm/setup.h | 4 ++++
arch/sparc/include/uapi/asm/setup.h | 10 +++++++---
arch/um/include/asm/setup.h | 2 +-
arch/x86/include/asm/setup.h | 2 +-
arch/xtensa/include/uapi/asm/setup.h | 4 ++++
include/uapi/asm-generic/setup.h | 4 ++++
16 files changed, 60 insertions(+), 8 deletions(-)
diff --git a/arch/alpha/include/uapi/asm/setup.h b/arch/alpha/include/uapi/asm/setup.h
index f881ea5947cbc..169f743ef7658 100644
--- a/arch/alpha/include/uapi/asm/setup.h
+++ b/arch/alpha/include/uapi/asm/setup.h
@@ -2,6 +2,10 @@
#ifndef _UAPI__ALPHA_SETUP_H
#define _UAPI__ALPHA_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 256
+#endif
#endif /* _UAPI__ALPHA_SETUP_H */
diff --git a/arch/arc/include/asm/setup.h b/arch/arc/include/asm/setup.h
index 1c6db599e1fcc..60e158d58cec7 100644
--- a/arch/arc/include/asm/setup.h
+++ b/arch/arc/include/asm/setup.h
@@ -9,7 +9,7 @@
#include <linux/types.h>
#include <uapi/asm/setup.h>
-#define COMMAND_LINE_SIZE 256
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
/*
* Data structure to map a ID to string
diff --git a/arch/arm/include/uapi/asm/setup.h b/arch/arm/include/uapi/asm/setup.h
index 8e50e034fec73..4aa93558af1e7 100644
--- a/arch/arm/include/uapi/asm/setup.h
+++ b/arch/arm/include/uapi/asm/setup.h
@@ -17,7 +17,11 @@
#include <linux/types.h>
-#define COMMAND_LINE_SIZE 1024
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
+#define COMMAND_LINE_SIZE 1024
+#endif
/* The list ends with an ATAG_NONE node. */
#define ATAG_NONE 0x00000000
diff --git a/arch/arm64/include/uapi/asm/setup.h b/arch/arm64/include/uapi/asm/setup.h
index 5d703888f3511..2236890175a5a 100644
--- a/arch/arm64/include/uapi/asm/setup.h
+++ b/arch/arm64/include/uapi/asm/setup.h
@@ -22,6 +22,10 @@
#include <linux/types.h>
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 2048
+#endif
#endif
diff --git a/arch/loongarch/include/uapi/asm/setup.h b/arch/loongarch/include/uapi/asm/setup.h
index d46363ce3e024..03c7bfa1e5d9f 100644
--- a/arch/loongarch/include/uapi/asm/setup.h
+++ b/arch/loongarch/include/uapi/asm/setup.h
@@ -3,6 +3,10 @@
#ifndef _UAPI_ASM_LOONGARCH_SETUP_H
#define _UAPI_ASM_LOONGARCH_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 4096
+#endif
#endif /* _UAPI_ASM_LOONGARCH_SETUP_H */
diff --git a/arch/m68k/include/uapi/asm/setup.h b/arch/m68k/include/uapi/asm/setup.h
index 25fe26d5597cc..2d5b24a5345f9 100644
--- a/arch/m68k/include/uapi/asm/setup.h
+++ b/arch/m68k/include/uapi/asm/setup.h
@@ -12,6 +12,10 @@
#ifndef _UAPI_M68K_SETUP_H
#define _UAPI_M68K_SETUP_H
-#define COMMAND_LINE_SIZE 256
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
+#define COMMAND_LINE_SIZE 256
+#endif
#endif /* _UAPI_M68K_SETUP_H */
diff --git a/arch/microblaze/include/uapi/asm/setup.h b/arch/microblaze/include/uapi/asm/setup.h
index 16c56807f86a2..e4b253064c7d9 100644
--- a/arch/microblaze/include/uapi/asm/setup.h
+++ b/arch/microblaze/include/uapi/asm/setup.h
@@ -12,6 +12,10 @@
#ifndef _UAPI_ASM_MICROBLAZE_SETUP_H
#define _UAPI_ASM_MICROBLAZE_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 256
+#endif
#endif /* _UAPI_ASM_MICROBLAZE_SETUP_H */
diff --git a/arch/mips/include/uapi/asm/setup.h b/arch/mips/include/uapi/asm/setup.h
index 7d48c433b0c27..8d6c474835aec 100644
--- a/arch/mips/include/uapi/asm/setup.h
+++ b/arch/mips/include/uapi/asm/setup.h
@@ -2,7 +2,11 @@
#ifndef _UAPI_MIPS_SETUP_H
#define _UAPI_MIPS_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 4096
+#endif
#endif /* _UAPI_MIPS_SETUP_H */
diff --git a/arch/parisc/include/uapi/asm/setup.h b/arch/parisc/include/uapi/asm/setup.h
index 78b2f4ec7d652..cfa77e84205dc 100644
--- a/arch/parisc/include/uapi/asm/setup.h
+++ b/arch/parisc/include/uapi/asm/setup.h
@@ -2,6 +2,10 @@
#ifndef _PARISC_SETUP_H
#define _PARISC_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 1024
+#endif
#endif /* _PARISC_SETUP_H */
diff --git a/arch/powerpc/include/uapi/asm/setup.h b/arch/powerpc/include/uapi/asm/setup.h
index c54940b09d065..daa15ac4e94c6 100644
--- a/arch/powerpc/include/uapi/asm/setup.h
+++ b/arch/powerpc/include/uapi/asm/setup.h
@@ -2,6 +2,10 @@
#ifndef _UAPI_ASM_POWERPC_SETUP_H
#define _UAPI_ASM_POWERPC_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 2048
+#endif
#endif /* _UAPI_ASM_POWERPC_SETUP_H */
diff --git a/arch/riscv/include/uapi/asm/setup.h b/arch/riscv/include/uapi/asm/setup.h
index eb4f0209c6960..a6c1f4b0987e3 100644
--- a/arch/riscv/include/uapi/asm/setup.h
+++ b/arch/riscv/include/uapi/asm/setup.h
@@ -3,6 +3,10 @@
#ifndef _UAPI_ASM_RISCV_SETUP_H
#define _UAPI_ASM_RISCV_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 2048
+#endif
#endif /* _UAPI_ASM_RISCV_SETUP_H */
diff --git a/arch/sparc/include/uapi/asm/setup.h b/arch/sparc/include/uapi/asm/setup.h
index 3c208a4dd4640..7054f5249a3a6 100644
--- a/arch/sparc/include/uapi/asm/setup.h
+++ b/arch/sparc/include/uapi/asm/setup.h
@@ -6,10 +6,14 @@
#ifndef _UAPI_SPARC_SETUP_H
#define _UAPI_SPARC_SETUP_H
-#if defined(__sparc__) && defined(__arch64__)
-# define COMMAND_LINE_SIZE 2048
+#ifdef __KERNEL__
+# define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
#else
-# define COMMAND_LINE_SIZE 256
+# if defined(__sparc__) && defined(__arch64__)
+# define COMMAND_LINE_SIZE 2048
+# else
+# define COMMAND_LINE_SIZE 256
+# endif
#endif
diff --git a/arch/um/include/asm/setup.h b/arch/um/include/asm/setup.h
index 80ada899f2542..bc83dc4d467d3 100644
--- a/arch/um/include/asm/setup.h
+++ b/arch/um/include/asm/setup.h
@@ -6,6 +6,6 @@
* command line, so this choice is ok.
*/
-#define COMMAND_LINE_SIZE 4096
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
#endif /* SETUP_H_INCLUDED */
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 914eb32581c73..b73caf64f2199 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -4,7 +4,7 @@
#include <uapi/asm/setup.h>
-#define COMMAND_LINE_SIZE 2048
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
#include <linux/linkage.h>
#include <asm/page_types.h>
diff --git a/arch/xtensa/include/uapi/asm/setup.h b/arch/xtensa/include/uapi/asm/setup.h
index 5356a5fd4d173..dcf33a403527a 100644
--- a/arch/xtensa/include/uapi/asm/setup.h
+++ b/arch/xtensa/include/uapi/asm/setup.h
@@ -12,6 +12,10 @@
#ifndef _XTENSA_SETUP_H
#define _XTENSA_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 256
+#endif
#endif
diff --git a/include/uapi/asm-generic/setup.h b/include/uapi/asm-generic/setup.h
index 88ac5100df359..b8d06e6d56bd7 100644
--- a/include/uapi/asm-generic/setup.h
+++ b/include/uapi/asm-generic/setup.h
@@ -2,6 +2,10 @@
#ifndef __ASM_GENERIC_SETUP_H
#define __ASM_GENERIC_SETUP_H
+#ifdef __KERNEL__
+#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
+#else
#define COMMAND_LINE_SIZE 512
+#endif
#endif /* __ASM_GENERIC_SETUP_H */
--
2.55.0.654.g21b8a5bc05-goog
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-08-06 6:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 6:14 [PATCH 0/3] init/Kconfig: generalize config COMMAND_LINE_SIZE Wilson Felipe Pereira
2026-08-06 6:14 ` [PATCH 1/3] init/Kconfig: generalize config COMMAND_LINE_SIZE to all architectures Wilson Felipe Pereira
2026-08-06 6:14 ` Wilson Felipe Pereira [this message]
2026-08-06 6:14 ` [PATCH 3/3] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable Wilson Felipe Pereira
2026-08-06 22:57 ` [PATCH 0/3] init/Kconfig: generalize config COMMAND_LINE_SIZE Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2026-08-06 6:05 Wilson Felipe Pereira
2026-08-06 6:05 ` [PATCH 2/3] arch: use CONFIG_COMMAND_LINE_SIZE across all architectures Wilson Felipe Pereira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260806061429.474992-3-wfelipe@google.com \
--to=wfelipe@google.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=maze@google.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=svens@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox