* [PATCH RESEND v2 0/2] ACPI: SPCR: Support UART clock frequency field
@ 2026-06-08 22:40 Markus Probst
2026-06-08 22:40 ` [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst
2026-06-08 22:40 ` [PATCH RESEND v2 2/2] ACPI: SPCR: Support UART clock frequency field Markus Probst
0 siblings, 2 replies; 6+ messages in thread
From: Markus Probst @ 2026-06-08 22:40 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Geert Uytterhoeven,
Thomas Bogendoerfer, Ard Biesheuvel, Ilias Apalodimas,
Greg Kroah-Hartman, Jiri Slaby
Cc: linux-acpi, linux-kernel, linux-m68k, linux-mips, linux-efi,
linux-serial, Markus Probst
Support the uart clock frequency in the SPCR table.
See the commit messages for details.
Signed-off-by: Markus Probst <markus.probst@posteo.de>
---
Changes in v2:
- fix uart_clk_freq possibly being interpreted as parity/bits/flow
- Link to v1: https://patch.msgid.link/20260505-acpi_spcr-v1-1-fd4bc6f4eb53@posteo.de
---
Markus Probst (2):
serial: earlycon: add uart_clk_freq parameter
ACPI: SPCR: Support UART clock frequency field
arch/m68k/virt/config.c | 2 +-
arch/mips/mti-malta/malta-init.c | 2 +-
drivers/acpi/spcr.c | 2 +-
drivers/firmware/efi/earlycon.c | 2 +-
drivers/tty/serial/earlycon.c | 17 ++++++++++++-----
include/linux/serial_core.h | 7 +++++--
6 files changed, 21 insertions(+), 11 deletions(-)
---
base-commit: aa61612ab641d7d62b0b6889f2c7c9251489f6e3
change-id: 20260430-acpi_spcr-61902fd923f2
-----BEGIN PGP SIGNATURE-----
iQJPBAABCAA5FiEEgnQYxPSsWOdyMMRzNHYf+OetQ9IFAmoTfSQbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJEDR2H/jnrUPS9e4P/3ObHEJDC0UywwA9xj1z
kzoUrs/iZrus7ROb6ri7MzHVY8riTrzHZrvMOkdWBAxuMXrnzdLwDx96qnQuiaHm
GJBDNBAxoRzBxVkkQJi9Osa+zr8DOEC3+gsv3dCqNqI4DT1wXsBEMi4zgg5dJ5Ye
oFFjEXN/EAiFVa6DHeNMaoJ69sLbYjvWUxAvU74Zpa6zjQMc1n9oCcJFc5D6cvkx
9/WozDV7rTNjmqDy9kcmyb3geeEMd14/y3j8adIe6qB0kkIJQwQr671eIWzGA7pg
353gxRmbLaT9YCKJvHsP32N7Z2EUhrp/o3U6Od/Q0I+qDz13RBSuDLUTogi/mhAw
U7i9a2WHaD2LvwQdt5azLjuo7etx5si84E/cT5G2xJBwUeC2ftYjZulJZs8BMKZp
Oac3Ln/qWCEVw52DWOcxPPIkxlGfjEZOqWBajkRI4NdY3+d0o0/nBK+RYfOt30sf
L3+yLnMmqBjF1RkF1Lm3kTZ589K2KSxGOKMGoYKZqyvV4Ato4w4EoIwL+MQJw7SD
De/BNNpFpTDqJxqgnl4HuELZRzmiKAQCGMwDq285I0Ng1r7xlxFCDYBJnyjnm2Qd
LbD/ZH5yl0beq/S1qZla+JIRjYdbRNQlLUSh3MqBxgll0Xg5GYLk2qeeF+xJJDCq
LkXKR59axau1efToWKWn7CBZ
=EGzU
-----END PGP SIGNATURE-----
--
Markus Probst <markus.probst@posteo.de>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter 2026-06-08 22:40 [PATCH RESEND v2 0/2] ACPI: SPCR: Support UART clock frequency field Markus Probst @ 2026-06-08 22:40 ` Markus Probst 2026-06-09 5:30 ` Greg Kroah-Hartman 2026-06-09 6:53 ` Geert Uytterhoeven 2026-06-08 22:40 ` [PATCH RESEND v2 2/2] ACPI: SPCR: Support UART clock frequency field Markus Probst 1 sibling, 2 replies; 6+ messages in thread From: Markus Probst @ 2026-06-08 22:40 UTC (permalink / raw) To: Rafael J. Wysocki, Len Brown, Geert Uytterhoeven, Thomas Bogendoerfer, Ard Biesheuvel, Ilias Apalodimas, Greg Kroah-Hartman, Jiri Slaby Cc: linux-acpi, linux-kernel, linux-m68k, linux-mips, linux-efi, linux-serial, Markus Probst Add `uart_clk_freq` parameter to `setup_earlycon`. This allows the options string to be reused with `add_preferred_console`, while still allowing to set the uart clock frequency. This will be used in the following commit ("ACPI: SPCR: Support UART clock frequency field"). No logical change intended. Signed-off-by: Markus Probst <markus.probst@posteo.de> --- arch/m68k/virt/config.c | 2 +- arch/mips/mti-malta/malta-init.c | 2 +- drivers/acpi/spcr.c | 2 +- drivers/firmware/efi/earlycon.c | 2 +- drivers/tty/serial/earlycon.c | 17 ++++++++++++----- include/linux/serial_core.h | 7 +++++-- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/arch/m68k/virt/config.c b/arch/m68k/virt/config.c index b338e2a8da6a..2c35ec15a51b 100644 --- a/arch/m68k/virt/config.c +++ b/arch/m68k/virt/config.c @@ -83,7 +83,7 @@ void __init config_virt(void) snprintf(earlycon, sizeof(earlycon), "early_gf_tty,0x%08x", virt_bi_data.tty.mmio); - setup_earlycon(earlycon); + setup_earlycon(earlycon, 0); mach_init_IRQ = virt_init_IRQ; mach_sched_init = virt_sched_init; diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c index 82b0fd8576a2..88ef17967ced 100644 --- a/arch/mips/mti-malta/malta-init.c +++ b/arch/mips/mti-malta/malta-init.c @@ -75,7 +75,7 @@ static void __init console_config(void) if ((strstr(fw_getcmdline(), "earlycon=")) == NULL) { sprintf(console_string, "uart8250,io,0x3f8,%d%c%c", baud, parity, bits); - setup_earlycon(console_string); + setup_earlycon(console_string, 0); } if ((strstr(fw_getcmdline(), "console=")) == NULL) { diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c index 73cb933fdc89..cfacbe53f279 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c @@ -228,7 +228,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) pr_info("console: %s\n", opts); if (enable_earlycon) - setup_earlycon(opts); + setup_earlycon(opts, 0); if (enable_console) err = add_preferred_console(uart, 0, opts + strlen(uart) + 1); diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c index 3d060d59968c..0e3c2cb08966 100644 --- a/drivers/firmware/efi/earlycon.c +++ b/drivers/firmware/efi/earlycon.c @@ -221,7 +221,7 @@ static bool __initdata fb_probed; void __init efi_earlycon_reprobe(void) { if (fb_probed) - setup_earlycon("efifb"); + setup_earlycon("efifb", 0); } static int __init efi_earlycon_setup(struct earlycon_device *device, diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index ab9af37f6cda..a419943e083b 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -135,11 +135,14 @@ static int __init parse_options(struct earlycon_device *device, char *options) return 0; } -static int __init register_earlycon(char *buf, const struct earlycon_id *match) +static int __init register_earlycon(char *buf, unsigned int uart_clk_freq, + const struct earlycon_id *match) { int err; struct uart_port *port = &early_console_dev.port; + port->uartclk = uart_clk_freq; + /* On parsing error, pass the options buf to the setup function */ if (buf && !parse_options(&early_console_dev, buf)) buf = NULL; @@ -164,7 +167,8 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match) /** * setup_earlycon - match and register earlycon console - * @buf: earlycon param string + * @buf: earlycon param string + * @uart_clk_freq: uart clock frequency in Hz or 0 for BASE_BAUD*16 * * Registers the earlycon console matching the earlycon specified * in the param string @buf. Acceptable param strings are of the form @@ -177,10 +181,13 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match) * <options> string in the 'options' parameter; all other forms set * the parameter to NULL. * + * If the uart clock frequency is specified in the 'options' parameter, + * the value of the param @uart_clk_freq will be ignored. + * * Returns 0 if an attempt to register the earlycon was made, * otherwise negative error code */ -int __init setup_earlycon(char *buf) +int __init setup_earlycon(char *buf, unsigned int uart_clk_freq) { const struct earlycon_id *match; bool empty_compatible = true; @@ -209,7 +216,7 @@ int __init setup_earlycon(char *buf) } else buf = NULL; - return register_earlycon(buf, match); + return register_earlycon(buf, uart_clk_freq, match); } if (empty_compatible) { @@ -241,7 +248,7 @@ static int __init param_setup_earlycon(char *buf) } } - err = setup_earlycon(buf); + err = setup_earlycon(buf, 0); if (err == -ENOENT || err == -EALREADY) return 0; return err; diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 666430b47899..5c60fda9dd3a 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -1097,10 +1097,13 @@ int of_setup_earlycon(const struct earlycon_id *match, unsigned long node, #ifdef CONFIG_SERIAL_EARLYCON extern bool earlycon_acpi_spcr_enable __initdata; -int setup_earlycon(char *buf); +int setup_earlycon(char *buf, unsigned int uart_clk_freq); #else static const bool earlycon_acpi_spcr_enable EARLYCON_USED_OR_UNUSED; -static inline int setup_earlycon(char *buf) { return 0; } +static inline int setup_earlycon(char *buf, unsigned int uart_clk_freq) +{ + return 0; +} #endif /* Variant of uart_console_registered() when the console_list_lock is held. */ -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter 2026-06-08 22:40 ` [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst @ 2026-06-09 5:30 ` Greg Kroah-Hartman 2026-06-09 6:53 ` Geert Uytterhoeven 1 sibling, 0 replies; 6+ messages in thread From: Greg Kroah-Hartman @ 2026-06-09 5:30 UTC (permalink / raw) To: Markus Probst Cc: Rafael J. Wysocki, Len Brown, Geert Uytterhoeven, Thomas Bogendoerfer, Ard Biesheuvel, Ilias Apalodimas, Jiri Slaby, linux-acpi, linux-kernel, linux-m68k, linux-mips, linux-efi, linux-serial On Mon, Jun 08, 2026 at 10:40:21PM +0000, Markus Probst wrote: > Add `uart_clk_freq` parameter to `setup_earlycon`. This allows the > options string to be reused with `add_preferred_console`, while still > allowing to set the uart clock frequency. This will be used in the > following commit ("ACPI: SPCR: Support UART clock frequency field"). Ick, this is bad, now you need to look up what this 0 is as a parameter every time you see this call. Please just add a new function that takes the new paramter, don't abuse the old one for this. thanks, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter 2026-06-08 22:40 ` [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst 2026-06-09 5:30 ` Greg Kroah-Hartman @ 2026-06-09 6:53 ` Geert Uytterhoeven 2026-06-09 14:56 ` Markus Probst 1 sibling, 1 reply; 6+ messages in thread From: Geert Uytterhoeven @ 2026-06-09 6:53 UTC (permalink / raw) To: Markus Probst Cc: Rafael J. Wysocki, Len Brown, Thomas Bogendoerfer, Ard Biesheuvel, Ilias Apalodimas, Greg Kroah-Hartman, Jiri Slaby, linux-acpi, linux-kernel, linux-m68k, linux-mips, linux-efi, linux-serial Hi Markus, On Tue, 9 Jun 2026 at 00:40, Markus Probst <markus.probst@posteo.de> wrote: > Add `uart_clk_freq` parameter to `setup_earlycon`. This allows the > options string to be reused with `add_preferred_console`, while still > allowing to set the uart clock frequency. This will be used in the > following commit ("ACPI: SPCR: Support UART clock frequency field"). > > No logical change intended. > > Signed-off-by: Markus Probst <markus.probst@posteo.de> > --- a/drivers/tty/serial/earlycon.c > +++ b/drivers/tty/serial/earlycon.c > @@ -135,11 +135,14 @@ static int __init parse_options(struct earlycon_device *device, char *options) > return 0; > } > > -static int __init register_earlycon(char *buf, const struct earlycon_id *match) > +static int __init register_earlycon(char *buf, unsigned int uart_clk_freq, > + const struct earlycon_id *match) > { > int err; > struct uart_port *port = &early_console_dev.port; > > + port->uartclk = uart_clk_freq; Who is actually consuming this value? Earlycon typically works with the serial console, as configured before Linux boot by the firmware. The Microsoft doc referenced in patch 2 seem to agree with that: "On a system where the BIOS or system firmware uses the serial port for console input/output, this table should be used to convey information about the settings, to ensure a seamless transition between the firmware console output and Windows EMS output." > + > /* On parsing error, pass the options buf to the setup function */ > if (buf && !parse_options(&early_console_dev, buf)) > buf = NULL; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter 2026-06-09 6:53 ` Geert Uytterhoeven @ 2026-06-09 14:56 ` Markus Probst 0 siblings, 0 replies; 6+ messages in thread From: Markus Probst @ 2026-06-09 14:56 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Rafael J. Wysocki, Len Brown, Thomas Bogendoerfer, Ard Biesheuvel, Ilias Apalodimas, Greg Kroah-Hartman, Jiri Slaby, linux-acpi, linux-kernel, linux-m68k, linux-mips, linux-efi, linux-serial [-- Attachment #1: Type: text/plain, Size: 2270 bytes --] On Tue, 2026-06-09 at 08:53 +0200, Geert Uytterhoeven wrote: > Hi Markus, > > On Tue, 9 Jun 2026 at 00:40, Markus Probst <markus.probst@posteo.de> wrote: > > Add `uart_clk_freq` parameter to `setup_earlycon`. This allows the > > options string to be reused with `add_preferred_console`, while still > > allowing to set the uart clock frequency. This will be used in the > > following commit ("ACPI: SPCR: Support UART clock frequency field"). > > > > No logical change intended. > > > > Signed-off-by: Markus Probst <markus.probst@posteo.de> > > > --- a/drivers/tty/serial/earlycon.c > > +++ b/drivers/tty/serial/earlycon.c > > @@ -135,11 +135,14 @@ static int __init parse_options(struct earlycon_device *device, char *options) > > return 0; > > } > > > > -static int __init register_earlycon(char *buf, const struct earlycon_id *match) > > +static int __init register_earlycon(char *buf, unsigned int uart_clk_freq, > > + const struct earlycon_id *match) > > { > > int err; > > struct uart_port *port = &early_console_dev.port; > > > > + port->uartclk = uart_clk_freq; > > Who is actually consuming this value? I think primarily init_port in drivers/tty/serial/8250/8250_early.c. > Earlycon typically works with the serial console, as configured before > Linux boot by the firmware. Thats defined in the SPCR table. If "Configured Baud Rate" is set to 0, it will use it as is [1]. If not, it will configure it. Thanks - Markus Probst [1]https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/serial-port-console-redirection-table > The Microsoft doc referenced in patch 2 seem to agree with that: > > "On a system where the BIOS or system firmware uses the serial > port for console input/output, this table should be used to convey > information about the settings, to ensure a seamless transition > between the firmware console output and Windows EMS output." > > > + > > /* On parsing error, pass the options buf to the setup function */ > > if (buf && !parse_options(&early_console_dev, buf)) > > buf = NULL; > > Gr{oetje,eeting}s, > > Geert [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 870 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH RESEND v2 2/2] ACPI: SPCR: Support UART clock frequency field 2026-06-08 22:40 [PATCH RESEND v2 0/2] ACPI: SPCR: Support UART clock frequency field Markus Probst 2026-06-08 22:40 ` [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst @ 2026-06-08 22:40 ` Markus Probst 1 sibling, 0 replies; 6+ messages in thread From: Markus Probst @ 2026-06-08 22:40 UTC (permalink / raw) To: Rafael J. Wysocki, Len Brown, Geert Uytterhoeven, Thomas Bogendoerfer, Ard Biesheuvel, Ilias Apalodimas, Greg Kroah-Hartman, Jiri Slaby Cc: linux-acpi, linux-kernel, linux-m68k, linux-mips, linux-efi, linux-serial, Markus Probst The Microsoft Serial Port Console Redirection (SPCR) specification revision 1.08 comprises additional field: UART Clock Frequency [1]. It contains a non-zero value indicating the UART clock frequency in Hz. Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table [1] Signed-off-by: Markus Probst <markus.probst@posteo.de> --- drivers/acpi/spcr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c index cfacbe53f279..16f94073fde6 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c @@ -228,7 +228,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) pr_info("console: %s\n", opts); if (enable_earlycon) - setup_earlycon(opts, 0); + setup_earlycon(opts, table->header.revision >= 3 ? table->uart_clk_freq : 0); if (enable_console) err = add_preferred_console(uart, 0, opts + strlen(uart) + 1); -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-09 14:56 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-06-08 22:40 [PATCH RESEND v2 0/2] ACPI: SPCR: Support UART clock frequency field Markus Probst 2026-06-08 22:40 ` [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst 2026-06-09 5:30 ` Greg Kroah-Hartman 2026-06-09 6:53 ` Geert Uytterhoeven 2026-06-09 14:56 ` Markus Probst 2026-06-08 22:40 ` [PATCH RESEND v2 2/2] ACPI: SPCR: Support UART clock frequency field Markus Probst
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox