diff mbox series

[v2] ACPI: Add config to disable ACPI SPCR console by default on arm64

Message ID 20240621044706.87181-1-liuwei09@cestc.cn (mailing list archive)
State New, archived
Headers show
Series [v2] ACPI: Add config to disable ACPI SPCR console by default on arm64 | expand

Commit Message

Liu Wei June 21, 2024, 4:47 a.m. UTC
For varying privacy and security reasons, sometimes we would like to
completely silence the serial console output, and only enable it through
cmdline when needed.

But there are many existing systems that depend on this console,
so add CONFIG_ARM_DISABLE_ACPI_SPCR_CONSOLE for this situation.

Signed-off-by: Liu Wei <liuwei09@cestc.cn>
Suggested-by: Prarit Bhargava <prarit@redhat.com>
---

v2: Add a config option suggested by Prarit
---
 arch/arm64/kernel/acpi.c   | 12 ++++++++++++
 drivers/acpi/arm64/Kconfig | 11 +++++++++++
 2 files changed, 23 insertions(+)

Comments

Prarit Bhargava June 21, 2024, 11:26 a.m. UTC | #1
On 6/21/24 00:47, Liu Wei wrote:
> For varying privacy and security reasons, sometimes we would like to
> completely silence the serial console output, and only enable it through
> cmdline when needed.
> 
> But there are many existing systems that depend on this console,
> so add CONFIG_ARM_DISABLE_ACPI_SPCR_CONSOLE for this situation.
> 
> Signed-off-by: Liu Wei <liuwei09@cestc.cn>
> Suggested-by: Prarit Bhargava <prarit@redhat.com>
> ---
> 
> v2: Add a config option suggested by Prarit
> ---
>   arch/arm64/kernel/acpi.c   | 12 ++++++++++++
>   drivers/acpi/arm64/Kconfig | 11 +++++++++++
>   2 files changed, 23 insertions(+)
> 
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index dba8fcec7f33..3365fabb5cf8 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -227,7 +227,19 @@ void __init acpi_boot_table_init(void)
>   		if (earlycon_acpi_spcr_enable)
>   			early_init_dt_scan_chosen_stdout();
>   	} else {
> +		/*
> +		 * For varying privacy and security reasons, sometimes need
> +		 * to completely silence the serial console output, and only
> +		 * enable it by cmdline when needed.
> +		 * But there are many existing systems that depend on this
> +		 * behavior, so use CONFIG_ARM_DISABLE_ACPI_SPCR_CONSOLE.
> +		 */
> +#ifdef CONFIG_ARM_DISABLE_ACPI_SPCR_CONSOLE
> +		acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
> +#else
>   		acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
> +#endif
> +

I don't think you want a config option here after all.  See my previous 
comment about "acpi=nospcr".  I realized that if you do use a config 
then distros will not have the ability to default 'on', and advise users 
to disable it for their use cases.

Try the 'acpi=nospcr' option.  That should keep everyone happy.

P.

>   		if (IS_ENABLED(CONFIG_ACPI_BGRT))
>   			acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
>   	}
> diff --git a/drivers/acpi/arm64/Kconfig b/drivers/acpi/arm64/Kconfig
> index b3ed6212244c..7e4d860d7089 100644
> --- a/drivers/acpi/arm64/Kconfig
> +++ b/drivers/acpi/arm64/Kconfig
> @@ -21,3 +21,14 @@ config ACPI_AGDI
>   
>   config ACPI_APMT
>   	bool
> +
> +config ARM_DISABLE_ACPI_SPCR_CONSOLE
> +	bool "Disable ACPI SPCR Console by Default on Arm64"
> +	depends on ARM64 && ACPI_SPCR_TABLE
> +	default n
> +	help
> +		For varying privacy and security reasons, sometimes need to
> +		completely silence the serial console output, and only enable
> +		it by kernel cmdline when needed.
> +
> +		Say Y to disable ACPI SPCR console by default.
diff mbox series

Patch

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index dba8fcec7f33..3365fabb5cf8 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -227,7 +227,19 @@  void __init acpi_boot_table_init(void)
 		if (earlycon_acpi_spcr_enable)
 			early_init_dt_scan_chosen_stdout();
 	} else {
+		/*
+		 * For varying privacy and security reasons, sometimes need
+		 * to completely silence the serial console output, and only 
+		 * enable it by cmdline when needed.
+		 * But there are many existing systems that depend on this
+		 * behavior, so use CONFIG_ARM_DISABLE_ACPI_SPCR_CONSOLE.
+		 */
+#ifdef CONFIG_ARM_DISABLE_ACPI_SPCR_CONSOLE
+		acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
+#else
 		acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
+#endif
+
 		if (IS_ENABLED(CONFIG_ACPI_BGRT))
 			acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
 	}
diff --git a/drivers/acpi/arm64/Kconfig b/drivers/acpi/arm64/Kconfig
index b3ed6212244c..7e4d860d7089 100644
--- a/drivers/acpi/arm64/Kconfig
+++ b/drivers/acpi/arm64/Kconfig
@@ -21,3 +21,14 @@  config ACPI_AGDI
 
 config ACPI_APMT
 	bool
+
+config ARM_DISABLE_ACPI_SPCR_CONSOLE
+	bool "Disable ACPI SPCR Console by Default on Arm64"
+	depends on ARM64 && ACPI_SPCR_TABLE
+	default n
+	help
+		For varying privacy and security reasons, sometimes need to
+		completely silence the serial console output, and only enable
+		it by kernel cmdline when needed.
+
+		Say Y to disable ACPI SPCR console by default.