Skip to content

Commit 2a11e14

Browse files
shenghaoyangbp3tk0v
authored andcommitted
x86/acpi: Add acpi=spcr to use SPCR-provided default console
The SPCR provided console on x86 is only available as a boot console when earlycon is provided on the kernel command line, and will not be present in /proc/consoles. While it's possible to retain the boot console with the keep_bootcon parameter, that leaves the console using the less efficient 8250_early driver. Users wanting to use the firmware suggested console (to avoid maintaining unique serial console parameters for different server models in large fleets) with the conventional driver have to parse the kernel log for the console parameters and reinsert them. [ 0.005091] ACPI: SPCR 0x000000007FFB5000 000059 (v04 ALASKA A M I 01072009 INTL 20250404) [ 0.073387] ACPI: SPCR: console: uart,io,0x3f8,115200 In commit 0231d00 ("ACPI: SPCR: Make SPCR available to x86")¹ the SPCR console was only added as an option for earlycon but not as an ordinary console so users don't see console output changes. So users can opt in to an automatic SPCR console, make ACPI init add it if acpi=spcr is set. ¹https://lore.kernel.org/lkml/20180118150951.28964-1-prarit@redhat.com/ [ bp: Touchups. ] Signed-off-by: Shenghao Yang <me@shenghaoyang.info> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260117072827.355360-1-me@shenghaoyang.info
1 parent 6c08d76 commit 2a11e14

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ Kernel parameters
125125
may result in duplicate corrected error reports.
126126
nospcr -- disable console in ACPI SPCR table as
127127
default _serial_ console on ARM64
128+
spcr -- enable console in ACPI SPCR table as
129+
default _serial_ console on x86
128130
For ARM64, ONLY "acpi=off", "acpi=on", "acpi=force" or
129131
"acpi=nospcr" are available
130132
For RISCV64, ONLY "acpi=off", "acpi=on" or "acpi=force"

arch/x86/kernel/acpi/boot.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ EXPORT_SYMBOL(acpi_disabled);
4848

4949
int acpi_noirq; /* skip ACPI IRQ initialization */
5050
static int acpi_nobgrt; /* skip ACPI BGRT */
51-
int acpi_pci_disabled; /* skip ACPI PCI scan and IRQ initialization */
51+
static int acpi_spcr_add __initdata; /* add SPCR-provided console */
52+
int acpi_pci_disabled; /* skip ACPI PCI scan and IRQ initialization */
5253
EXPORT_SYMBOL(acpi_pci_disabled);
5354

5455
int acpi_lapic;
@@ -1669,8 +1670,8 @@ int __init acpi_boot_init(void)
16691670
if (!acpi_noirq)
16701671
x86_init.pci.init = pci_acpi_init;
16711672

1672-
/* Do not enable ACPI SPCR console by default */
1673-
acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
1673+
acpi_parse_spcr(earlycon_acpi_spcr_enable, acpi_spcr_add);
1674+
16741675
return 0;
16751676
}
16761677

@@ -1707,6 +1708,10 @@ static int __init parse_acpi(char *arg)
17071708
/* "acpi=nocmcff" disables FF mode for corrected errors */
17081709
else if (strcmp(arg, "nocmcff") == 0) {
17091710
acpi_disable_cmcff = 1;
1711+
}
1712+
/* "acpi=spcr" adds the SPCR-provided console as a preferred one */
1713+
else if (strcmp(arg, "spcr") == 0) {
1714+
acpi_spcr_add = 1;
17101715
} else {
17111716
/* Core will printk when we return error. */
17121717
return -EINVAL;

0 commit comments

Comments
 (0)