ACPI: Improve SPCR handling and messaging on SPCR-less systems
v2 cover ACPI: Improve SPCR handling and messaging on SPCR-less systems
From: Li Chen <[email protected]>
From: Li Chen <[email protected]>
This small series improves the kernel behavior and output when the ACPI SPCR table is not present or not supported.
Currently, even on systems that completely lack an SPCR table, the kernel prints:
"Use ACPI SPCR as default console: Yes"
This may mislead users into thinking an SPCR table exists
when in fact there is no such table at all. This series addresses this in two steps:
Patch 1 ensures that acpi_parse_spcr() returns -ENODEV if CONFIG_ACPI_SPCR_TABLE is disabled.
Patch 2 updates arm64 acpi_boot_table_init() to only print the Yes if acpi_parse_spcr() succeeds.
This results in cleaner and more accurate boot logs on ARM64.
Tested on both SPCR-enabled and SPCR-less qemu-system arm64 virt platform. [1]
Changelog:
v2: refine the printk message logic as suggested by Hanjun Guo. [2]
[1]: https://patchew.org/QEMU/[email protected]/
[2]: https://www.spinics.net/lists/kernel/msg5730585.html
Li Chen (2):
ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is
disabled
ACPI: Suppress misleading SPCR console message when SPCR table is
absent
arch/arm64/kernel/acpi.c | 10 +++++++--- include/linux/acpi.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.49.0
PATCH v2 1/2 ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is disabled
From: Li Chen <[email protected]>
If CONFIG_ACPI_SPCR_TABLE is disabled, acpi_parse_spcr() currently returns 0, which may incorrectly suggest that SPCR parsing was successful. This patch changes the behavior to return -ENODEV to clearly indicate that SPCR support is not available.
This prepares the codebase for future changes that depend on acpi_parse_spcr() failure detection, such as suppressing misleading console messages.
--- include/linux/acpi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/acpi.h +1 -1
@@ -1503,7 +1503,7 @@ int acpi_parse_spcr(bool enable_earlycon, bool enable_console);#else static inline int acpi_parse_spcr (bool enable_earlycon,bool enable_console) { -return 0 ; +return -ENODEV ; }#endif
Signature · 1 line
2.49.0
Catalin Marinas
maintainerRe: [PATCH v2 1/2] ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is disabled
Quoted 22 lines · Li Chen
From: Li Chen <[email protected]>
If
CONFIG_ACPI_SPCR_TABLEis disabled,acpi_parse_spcr()currently returns 0, which may incorrectly suggest that SPCR parsing was successful. This patch changes the behavior to return-ENODEVto clearly indicate that SPCR support is not available.This prepares the codebase for future changes that depend on
acpi_parse_spcr()failure detection, such as suppressing misleading console messages.Signed-off-by Li Chen <[email protected]>--- include/linux/acpi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/acpi.h +0
-0
include/linux/acpi.h int acpi_parse_spcr(bool enable_earlycon, bool enable_console); · line 1508
Quoted 7 lines
include/linux/acpi.h +1
-1@@ -1503,7 +1503,7 @@ int acpi_parse_spcr(bool enable_earlycon, bool enable_console);#else static inline int acpi_parse_spcr (bool enable_earlycon,bool enable_console) { -return 0 ; +return -ENODEV ; }#endif
Rafael, are you ok with this patch going via the arm64 tree?
Thanks.
Signature · 1 line
Catalin
Rafael J. Wysocki
maintainerRe: [PATCH v2 1/2] ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is disabled
Quoted 19 lines · Catalin Marinas
Quoted 17 lines · Li Chen
From: Li Chen <[email protected]>
If
CONFIG_ACPI_SPCR_TABLEis disabled,acpi_parse_spcr()currently returns 0, which may incorrectly suggest that SPCR parsing was successful. This patch changes the behavior to return-ENODEVto clearly indicate that SPCR support is not available.This prepares the codebase for future changes that depend on
acpi_parse_spcr()failure detection, such as suppressing misleading console messages.Signed-off-by Li Chen <[email protected]>--- include/linux/acpi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
include/linux/acpi.h int acpi_parse_spcr(bool enable_earlycon, bool enable_console); · line 1508
Quoted 12 lines
include/linux/acpi.h +1
-1@@ -1503,7 +1503,7 @@ int acpi_parse_spcr(bool enable_earlycon, bool enable_console);#else static inline int acpi_parse_spcr (bool enable_earlycon,bool enable_console) { -return 0 ; +return -ENODEV ; }#endif Rafael, are you ok with this patch going via the arm64 tree?
Yes, I am, thanks!
PATCH v2 2/2 ACPI: Suppress misleading SPCR console message when SPCR table is absent
In reply to Li ChenFrom: Li Chen <[email protected]>
The kernel currently alway prints:
"Use ACPI SPCR as default console: No/Yes "
even on systems that lack an SPCR table. This can mislead users into thinking the SPCR table exists on the machines without SPCR.
With this change, the "Yes" is only printed if the SPCR table is present, parsed and !param_acpi_nospcr. This avoids user confusion on SPCR-less systems.
---
changelog:
v2: refine the printk message logic as suggested by Hanjun Guo.
arch/arm64/kernel/acpi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm64/kernel/acpi.c +7 -3
@@ -197,6 +197,8 @@ static int __init acpi_fadt_sanity_check(void)*/ void __init acpi_boot_table_init (void ) { +int ret; +/* * Enable ACPI instead of device tree unless * - ACPI has been disabled explicitly (acpi=off), or
@@ -250,10 +252,12 @@ void __init acpi_boot_table_init(void)* behaviour, use acpi=nospcr to disable console in ACPI SPCR * table as default serial console. */ -acpi_parse_spcr (earlycon_acpi_spcr_enable, + ret =acpi_parse_spcr (earlycon_acpi_spcr_enable, !param_acpi_nospcr); -pr_info ("Use ACPI SPCR as default console: %s\n" , - param_acpi_nospcr ?"No" :"Yes" ); +if (!ret || param_acpi_nospcr || !IS_ENABLED (CONFIG_ACPI_SPCR_TABLE )) +pr_info ("Use ACPI SPCR as default console: No\n" ); +else +pr_info ("Use ACPI SPCR as default console: Yes\n" );if (IS_ENABLED (CONFIG_ACPI_BGRT ))acpi_table_parse (ACPI_SIG_BGRT , acpi_parse_bgrt);
Signature · 1 line
2.49.0
Quoted 31 lines · Li Chen
From: Li Chen <[email protected]>
This small series improves the kernel behavior and output when the ACPI SPCR table is not present or not supported.Currently, even on systems that completely lack an SPCR table, the kernel prints:
"Use ACPI SPCR as default console: Yes"This may mislead users into thinking an SPCR table exists
when in fact there is no such table at all. This series addresses this in two steps:Patch 1 ensures that
acpi_parse_spcr()returns-ENODEVifCONFIG_ACPI_SPCR_TABLEis disabled.Patch 2 updates arm64
acpi_boot_table_init()to only print the Yes ifacpi_parse_spcr()succeeds.This results in cleaner and more accurate boot logs on ARM64.
Tested on both SPCR-enabled and SPCR-less qemu-system arm64 virt platform. [1]
Changelog:
v2: refine the printk message logic as suggested by Hanjun Guo. [2][1]: https://patchew.org/QEMU/[email protected]/
[2]: https://www.spinics.net/lists/kernel/msg5730585.htmlLi Chen (2):
ACPI: Return-ENODEVfromacpi_parse_spcr()when SPCR support is
disabled
ACPI: Suppress misleading SPCR console message when SPCR table is
absent
Quoted 3 lines
arch/arm64/kernel/acpi.c | 10 +++++++--- include/linux/acpi.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-)
This version looks good to me,
Thanks
Hanjun
Quoted 9 lines · Li Chen
From: Li Chen <[email protected]>
This small series improves the kernel behavior and output when the ACPI SPCR table is not present or not supported.
Currently, even on systems that completely lack an SPCR table, the kernel prints:
"Use ACPI SPCR as default console: Yes"[...]
Applied to arm64 (for-next/acpi), thanks!
[1/2] ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is disabled
https://git.kernel.org/arm64/c/b9f58d3572a8 [2/2] ACPI: Suppress misleading SPCR console message when SPCR table is absent https://git.kernel.org/arm64/c/bad3fa2fb920
Signature · 1 line
Catalin