* [PATCH v3 0/2] ACPI: SPCR: Support UART clock frequency field
@ 2026-06-15 0:40 Markus Probst
2026-06-15 0:40 ` [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst
2026-06-15 0:40 ` [PATCH v3 2/2] ACPI: SPCR: Support UART clock frequency field Markus Probst
0 siblings, 2 replies; 9+ messages in thread
From: Markus Probst @ 2026-06-15 0:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rafael J. Wysocki, Len Brown
Cc: linux-kernel, linux-serial, linux-acpi, 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 v3:
- add separate function for earlycon with uartclk
- Link to v2: https://patch.msgid.link/20260525-acpi_spcr-v2-0-c042089d73ca@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
drivers/acpi/spcr.c | 3 ++-
drivers/tty/serial/earlycon.c | 17 ++++++++++++-----
include/linux/serial_core.h | 11 +++++++++--
3 files changed, 23 insertions(+), 8 deletions(-)
---
base-commit: b3f94b2b3f3e51ab880a51fc6510e1dafba654ed
change-id: 20260430-acpi_spcr-61902fd923f2
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter 2026-06-15 0:40 [PATCH v3 0/2] ACPI: SPCR: Support UART clock frequency field Markus Probst @ 2026-06-15 0:40 ` Markus Probst 2026-07-10 12:36 ` Greg Kroah-Hartman 2026-06-15 0:40 ` [PATCH v3 2/2] ACPI: SPCR: Support UART clock frequency field Markus Probst 1 sibling, 1 reply; 9+ messages in thread From: Markus Probst @ 2026-06-15 0:40 UTC (permalink / raw) To: Greg Kroah-Hartman, Jiri Slaby, Rafael J. Wysocki, Len Brown Cc: linux-kernel, linux-serial, linux-acpi, Markus Probst Add function `setup_earlycon_with_uartclk`. 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> --- drivers/tty/serial/earlycon.c | 17 ++++++++++++----- include/linux/serial_core.h | 11 +++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index ab9af37f6cda..5a20fe9e3fb6 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; @@ -163,8 +166,9 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match) } /** - * setup_earlycon - match and register earlycon console - * @buf: earlycon param string + * setup_earlycon_with_uartclk - match and register earlycon console + * @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_with_uartclk(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) { diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 110ad4e2aef9..19d8181c9005 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -1097,11 +1097,18 @@ 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_with_uartclk(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_with_uartclk(char *buf, unsigned int uart_clk_freq) +{ + return 0; +} #endif +static inline int setup_earlycon(char *buf) +{ + return setup_earlycon_with_uartclk(buf, 0); +} /* Variant of uart_console_registered() when the console_list_lock is held. */ static inline bool uart_console_registered_locked(struct uart_port *port) -- 2.53.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter 2026-06-15 0:40 ` [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst @ 2026-07-10 12:36 ` Greg Kroah-Hartman 2026-07-12 16:36 ` Markus Probst 0 siblings, 1 reply; 9+ messages in thread From: Greg Kroah-Hartman @ 2026-07-10 12:36 UTC (permalink / raw) To: Markus Probst Cc: Jiri Slaby, Rafael J. Wysocki, Len Brown, linux-kernel, linux-serial, linux-acpi On Mon, Jun 15, 2026 at 12:40:21AM +0000, Markus Probst wrote: > Add function `setup_earlycon_with_uartclk`. 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> > --- > drivers/tty/serial/earlycon.c | 17 ++++++++++++----- > include/linux/serial_core.h | 11 +++++++++-- > 2 files changed, 21 insertions(+), 7 deletions(-) > > diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c > index ab9af37f6cda..5a20fe9e3fb6 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; This looks like a logical change, the code today does not do that anywhere, right? thanks, greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter 2026-07-10 12:36 ` Greg Kroah-Hartman @ 2026-07-12 16:36 ` Markus Probst 2026-07-12 16:40 ` Greg Kroah-Hartman 0 siblings, 1 reply; 9+ messages in thread From: Markus Probst @ 2026-07-12 16:36 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Jiri Slaby, Rafael J. Wysocki, Len Brown, linux-kernel, linux-serial, linux-acpi [-- Attachment #1: Type: text/plain, Size: 1836 bytes --] On Fri, 2026-07-10 at 14:36 +0200, Greg Kroah-Hartman wrote: > On Mon, Jun 15, 2026 at 12:40:21AM +0000, Markus Probst wrote: > > Add function `setup_earlycon_with_uartclk`. 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> > > --- > > drivers/tty/serial/earlycon.c | 17 ++++++++++++----- > > include/linux/serial_core.h | 11 +++++++++-- > > 2 files changed, 21 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c > > index ab9af37f6cda..5a20fe9e3fb6 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; > > This looks like a logical change, the code today does not do that > anywhere, right? `register_earlycon` only gets executed once. Thus early_console_dev.port->uartclk is always 0. Since all current callers in this patch series use `setup_earlycon`, the uart_clk_freq parameter is also always 0. So in case of behaviour/logic, this line does nothing without the 2. patch. Thanks - Markus Probst > > thanks, > > greg k-h [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 870 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter 2026-07-12 16:36 ` Markus Probst @ 2026-07-12 16:40 ` Greg Kroah-Hartman 2026-07-12 16:46 ` Markus Probst 0 siblings, 1 reply; 9+ messages in thread From: Greg Kroah-Hartman @ 2026-07-12 16:40 UTC (permalink / raw) To: Markus Probst Cc: Jiri Slaby, Rafael J. Wysocki, Len Brown, linux-kernel, linux-serial, linux-acpi On Sun, Jul 12, 2026 at 04:36:17PM +0000, Markus Probst wrote: > On Fri, 2026-07-10 at 14:36 +0200, Greg Kroah-Hartman wrote: > > On Mon, Jun 15, 2026 at 12:40:21AM +0000, Markus Probst wrote: > > > Add function `setup_earlycon_with_uartclk`. 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> > > > --- > > > drivers/tty/serial/earlycon.c | 17 ++++++++++++----- > > > include/linux/serial_core.h | 11 +++++++++-- > > > 2 files changed, 21 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c > > > index ab9af37f6cda..5a20fe9e3fb6 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; > > > > This looks like a logical change, the code today does not do that > > anywhere, right? > > `register_earlycon` only gets executed once. > Thus early_console_dev.port->uartclk is always 0. > Since all current callers in this patch series use `setup_earlycon`, > the uart_clk_freq parameter is also always 0. > > So in case of behaviour/logic, this line does nothing without the 2. > patch. Then it belongs in the second patch, right? thanks, greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter 2026-07-12 16:40 ` Greg Kroah-Hartman @ 2026-07-12 16:46 ` Markus Probst 0 siblings, 0 replies; 9+ messages in thread From: Markus Probst @ 2026-07-12 16:46 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Jiri Slaby, Rafael J. Wysocki, Len Brown, linux-kernel, linux-serial, linux-acpi [-- Attachment #1: Type: text/plain, Size: 2430 bytes --] On Sun, 2026-07-12 at 18:40 +0200, Greg Kroah-Hartman wrote: > On Sun, Jul 12, 2026 at 04:36:17PM +0000, Markus Probst wrote: > > On Fri, 2026-07-10 at 14:36 +0200, Greg Kroah-Hartman wrote: > > > On Mon, Jun 15, 2026 at 12:40:21AM +0000, Markus Probst wrote: > > > > Add function `setup_earlycon_with_uartclk`. 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> > > > > --- > > > > drivers/tty/serial/earlycon.c | 17 ++++++++++++----- > > > > include/linux/serial_core.h | 11 +++++++++-- > > > > 2 files changed, 21 insertions(+), 7 deletions(-) > > > > > > > > diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c > > > > index ab9af37f6cda..5a20fe9e3fb6 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; > > > > > > This looks like a logical change, the code today does not do that > > > anywhere, right? > > > > `register_earlycon` only gets executed once. > > Thus early_console_dev.port->uartclk is always 0. > > Since all current callers in this patch series use `setup_earlycon`, > > the uart_clk_freq parameter is also always 0. > > > > So in case of behaviour/logic, this line does nothing without the 2. > > patch. > > Then it belongs in the second patch, right? No. It does nothing, because the newly added function `setup_earlycon_with_uartclk` isn't used yet (first caller in the second patch). Moving this line in the second patch, would make the `setup_earlycon_with_uartclk` function obsolete. Thanks - Markus Probst > > thanks, > > greg k-h [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 870 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 2/2] ACPI: SPCR: Support UART clock frequency field 2026-06-15 0:40 [PATCH v3 0/2] ACPI: SPCR: Support UART clock frequency field Markus Probst 2026-06-15 0:40 ` [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst @ 2026-06-15 0:40 ` Markus Probst 2026-07-10 12:34 ` Greg Kroah-Hartman 1 sibling, 1 reply; 9+ messages in thread From: Markus Probst @ 2026-06-15 0:40 UTC (permalink / raw) To: Greg Kroah-Hartman, Jiri Slaby, Rafael J. Wysocki, Len Brown Cc: linux-kernel, linux-serial, linux-acpi, 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c index 73cb933fdc89..c79c809f49d4 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c @@ -228,7 +228,8 @@ 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_with_uartclk(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] 9+ messages in thread
* Re: [PATCH v3 2/2] ACPI: SPCR: Support UART clock frequency field 2026-06-15 0:40 ` [PATCH v3 2/2] ACPI: SPCR: Support UART clock frequency field Markus Probst @ 2026-07-10 12:34 ` Greg Kroah-Hartman 2026-07-24 15:14 ` Markus Probst 0 siblings, 1 reply; 9+ messages in thread From: Greg Kroah-Hartman @ 2026-07-10 12:34 UTC (permalink / raw) To: Markus Probst Cc: Jiri Slaby, Rafael J. Wysocki, Len Brown, linux-kernel, linux-serial, linux-acpi On Mon, Jun 15, 2026 at 12:40:22AM +0000, Markus Probst wrote: > 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. Ok, but then what are we going to do with this? Please make this a lot more descriptive, I have no idea what this is supposed to be doing at all. > > 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 | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c > index 73cb933fdc89..c79c809f49d4 100644 > --- a/drivers/acpi/spcr.c > +++ b/drivers/acpi/spcr.c > @@ -228,7 +228,8 @@ 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_with_uartclk(opts, > + table->header.revision >= 3 ? table->uart_clk_freq : 0); Why the magic number 3? thanks, greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 2/2] ACPI: SPCR: Support UART clock frequency field 2026-07-10 12:34 ` Greg Kroah-Hartman @ 2026-07-24 15:14 ` Markus Probst 0 siblings, 0 replies; 9+ messages in thread From: Markus Probst @ 2026-07-24 15:14 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Jiri Slaby, Rafael J. Wysocki, Len Brown, linux-kernel, linux-serial, linux-acpi [-- Attachment #1: Type: text/plain, Size: 2140 bytes --] On Fri, 2026-07-10 at 14:34 +0200, Greg Kroah-Hartman wrote: I just noticed, I never replied to this email. My apologies for the late response. > On Mon, Jun 15, 2026 at 12:40:22AM +0000, Markus Probst wrote: > > 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. > > Ok, but then what are we going to do with this? Please make this a lot > more descriptive, I have no idea what this is supposed to be doing at > all. The SPCR table provides information about a serial port. This can be used, to make use of a serial port, before the necessary drivers are loaded. Linux makes use of this in the earlycon console, if `earlycon` is added to the kernel parameters. Currently the "UART clock frequency" field in the SPCR table is completely ignored. Thus if the uart clock frequency differs from the kernel default of `BAUD*16`, it results in a misconfiguration of the serial port. > > > > > 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 | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c > > index 73cb933fdc89..c79c809f49d4 100644 > > --- a/drivers/acpi/spcr.c > > +++ b/drivers/acpi/spcr.c > > @@ -228,7 +228,8 @@ 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_with_uartclk(opts, > > + table->header.revision >= 3 ? table->uart_clk_freq : 0); > > Why the magic number 3? As seen on the Link in the commit message, the "UART Clock Frequency" field was introduced in the SPCR table with revision 3. For lower revisions, this value must be ignored (and should be 0 anyway). Thanks - Markus Probst > > thanks, > greg k-h [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 870 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-07-24 15:14 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-06-15 0:40 [PATCH v3 0/2] ACPI: SPCR: Support UART clock frequency field Markus Probst 2026-06-15 0:40 ` [PATCH v3 1/2] serial: earlycon: add uart_clk_freq parameter Markus Probst 2026-07-10 12:36 ` Greg Kroah-Hartman 2026-07-12 16:36 ` Markus Probst 2026-07-12 16:40 ` Greg Kroah-Hartman 2026-07-12 16:46 ` Markus Probst 2026-06-15 0:40 ` [PATCH v3 2/2] ACPI: SPCR: Support UART clock frequency field Markus Probst 2026-07-10 12:34 ` Greg Kroah-Hartman 2026-07-24 15:14 ` Markus Probst
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox