* [PATCH] serial: 8250: don't register ports that have no hardware
@ 2026-08-18 18:52 Lucas Tanure
2026-08-19 4:42 ` Jiri Slaby
2026-08-19 5:57 ` Greg Kroah-Hartman
0 siblings, 2 replies; 6+ messages in thread
From: Lucas Tanure @ 2026-08-18 18:52 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-kernel, linux-serial
The 8250 driver creates a fixed set of port slots at boot and
registers a ttyS device for each one, even when the slot describes no
hardware. On device tree platforms those slots are empty, but they
still take the ttyS0..ttyS3 names.
New Amlogic SoCs (S4, T7) name their real UARTs ttyS as well. With
both drivers built in, as in arm64 defconfig, the real port fails to bind:
sysfs: cannot create duplicate filename '/class/tty/ttyS0'
meson_uart fe078000.serial: Cannot register tty device on line 0
Skip slots that have no I/O and no memory address. Legacy x86 slots
come with resources and are not affected.
Signed-off-by: Lucas Tanure <tanure@linux.com>
Assisted-by: Claude:claude-fable-5
---
drivers/tty/serial/8250/8250_core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index f49862d90eeb..e66e0cdbb210 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -378,6 +378,14 @@ void __init serial8250_register_ports(struct uart_driver *drv, struct device *de
if (up->port.dev)
continue;
+ /*
+ * Skip slots that describe no hardware: they would only
+ * take up ttyS<n> names. Real ports get their node when
+ * they claim a slot in serial8250_register_8250_port().
+ */
+ if (!up->port.iobase && !up->port.mapbase && !up->port.membase)
+ continue;
+
up->port.dev = dev;
if (uart_console_registered(&up->port))
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] serial: 8250: don't register ports that have no hardware
2026-08-18 18:52 [PATCH] serial: 8250: don't register ports that have no hardware Lucas Tanure
@ 2026-08-19 4:42 ` Jiri Slaby
2026-08-19 6:31 ` Lucas Tanure
2026-08-19 5:57 ` Greg Kroah-Hartman
1 sibling, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2026-08-19 4:42 UTC (permalink / raw)
To: Lucas Tanure, Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial
On 18. 08. 26, 20:52, Lucas Tanure wrote:
> The 8250 driver creates a fixed set of port slots at boot and
> registers a ttyS device for each one, even when the slot describes no
> hardware. On device tree platforms those slots are empty, but they
> still take the ttyS0..ttyS3 names.
>
> New Amlogic SoCs (S4, T7) name their real UARTs ttyS as well. With
> both drivers built in, as in arm64 defconfig, the real port fails to bind:
>
> sysfs: cannot create duplicate filename '/class/tty/ttyS0'
> meson_uart fe078000.serial: Cannot register tty device on line 0
>
> Skip slots that have no I/O and no memory address. Legacy x86 slots
> come with resources and are not affected.
>
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> Assisted-by: Claude:claude-fable-5
> ---
> drivers/tty/serial/8250/8250_core.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index f49862d90eeb..e66e0cdbb210 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -378,6 +378,14 @@ void __init serial8250_register_ports(struct uart_driver *drv, struct device *de
> if (up->port.dev)
> continue;
>
> + /*
> + * Skip slots that describe no hardware: they would only
> + * take up ttyS<n> names. Real ports get their node when
> + * they claim a slot in serial8250_register_8250_port().
> + */
> + if (!up->port.iobase && !up->port.mapbase && !up->port.membase)
> + continue;
So you can no longer set up those ports via TIOCSSERIAL?
And what about already registered consoles?
Why does meson register ttyS* in the first place?
F*ck AI proposed changes.
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] serial: 8250: don't register ports that have no hardware
2026-08-18 18:52 [PATCH] serial: 8250: don't register ports that have no hardware Lucas Tanure
2026-08-19 4:42 ` Jiri Slaby
@ 2026-08-19 5:57 ` Greg Kroah-Hartman
2026-08-19 6:40 ` Lucas Tanure
1 sibling, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-08-19 5:57 UTC (permalink / raw)
To: Lucas Tanure; +Cc: Jiri Slaby, linux-kernel, linux-serial
On Tue, Aug 18, 2026 at 07:52:00PM +0100, Lucas Tanure wrote:
> The 8250 driver creates a fixed set of port slots at boot and
> registers a ttyS device for each one, even when the slot describes no
> hardware. On device tree platforms those slots are empty, but they
> still take the ttyS0..ttyS3 names.
>
> New Amlogic SoCs (S4, T7) name their real UARTs ttyS as well. With
> both drivers built in, as in arm64 defconfig, the real port fails to bind:
Then fix that bug, don't break everyone else's systems because of it.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] serial: 8250: don't register ports that have no hardware
2026-08-19 4:42 ` Jiri Slaby
@ 2026-08-19 6:31 ` Lucas Tanure
0 siblings, 0 replies; 6+ messages in thread
From: Lucas Tanure @ 2026-08-19 6:31 UTC (permalink / raw)
To: Jiri Slaby, Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial
On 19/08/2026 05:42, Jiri Slaby wrote:
> On 18. 08. 26, 20:52, Lucas Tanure wrote:
>> The 8250 driver creates a fixed set of port slots at boot and
>> registers a ttyS device for each one, even when the slot describes no
>> hardware. On device tree platforms those slots are empty, but they
>> still take the ttyS0..ttyS3 names.
>>
>> New Amlogic SoCs (S4, T7) name their real UARTs ttyS as well. With
>> both drivers built in, as in arm64 defconfig, the real port fails to
>> bind:
>>
>> sysfs: cannot create duplicate filename '/class/tty/ttyS0'
>> meson_uart fe078000.serial: Cannot register tty device on line 0
>>
>> Skip slots that have no I/O and no memory address. Legacy x86 slots
>> come with resources and are not affected.
>>
>> Signed-off-by: Lucas Tanure <tanure@linux.com>
>> Assisted-by: Claude:claude-fable-5
>> ---
>> drivers/tty/serial/8250/8250_core.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/
>> serial/8250/8250_core.c
>> index f49862d90eeb..e66e0cdbb210 100644
>> --- a/drivers/tty/serial/8250/8250_core.c
>> +++ b/drivers/tty/serial/8250/8250_core.c
>> @@ -378,6 +378,14 @@ void __init serial8250_register_ports(struct
>> uart_driver *drv, struct device *de
>> if (up->port.dev)
>> continue;
>> + /*
>> + * Skip slots that describe no hardware: they would only
>> + * take up ttyS<n> names. Real ports get their node when
>> + * they claim a slot in serial8250_register_8250_port().
>> + */
>> + if (!up->port.iobase && !up->port.mapbase && !up->port.membase)
>> + continue;
>
Hi,
I am working on upstreaming the Khadas VIM4 (Amlogic T7). On that board
the serial console does not come up at all: meson_uart fails to register
because the 8250 stub ports already own the ttyS names.
> So you can no longer set up those ports via TIOCSSERIAL?
>
> And what about already registered consoles?
>
> Why does meson register ttyS* in the first place?
Because of commit e71aab9d6132 ("tty: serial: meson: apply ttyS devname
instead of ttyAML for new SoCs"). meson_uart carries two uart_drivers,
ttyAML and ttyS, and A1, S4 and T7 are wired to the ttyS one.
>
> F*ck AI proposed changes.
>
> thanks,
I will talk to Amlogic list to see if there is other solution.
thanks,
lucas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] serial: 8250: don't register ports that have no hardware
2026-08-19 5:57 ` Greg Kroah-Hartman
@ 2026-08-19 6:40 ` Lucas Tanure
2026-08-19 6:49 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Lucas Tanure @ 2026-08-19 6:40 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-kernel, linux-serial
On 19/08/2026 06:57, Greg Kroah-Hartman wrote:
> On Tue, Aug 18, 2026 at 07:52:00PM +0100, Lucas Tanure wrote:
>> The 8250 driver creates a fixed set of port slots at boot and
>> registers a ttyS device for each one, even when the slot describes no
>> hardware. On device tree platforms those slots are empty, but they
>> still take the ttyS0..ttyS3 names.
>>
>> New Amlogic SoCs (S4, T7) name their real UARTs ttyS as well. With
>> both drivers built in, as in arm64 defconfig, the real port fails to bind:
>
> Then fix that bug, don't break everyone else's systems because of it.
>
Hi,
Understood. I thought preventing 8250 from probing on devices that don't
use it would be a good idea, and fix my bug. Thanks for the feedback.
I will tak to Amlogic list the ttyS name collision introduced for the
new Amlogic SoCs in e71aab9d6132.
Thanks,
Lucas
> greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] serial: 8250: don't register ports that have no hardware
2026-08-19 6:40 ` Lucas Tanure
@ 2026-08-19 6:49 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-08-19 6:49 UTC (permalink / raw)
To: Lucas Tanure; +Cc: Jiri Slaby, linux-kernel, linux-serial
On Wed, Aug 19, 2026 at 07:40:17AM +0100, Lucas Tanure wrote:
> On 19/08/2026 06:57, Greg Kroah-Hartman wrote:
> > On Tue, Aug 18, 2026 at 07:52:00PM +0100, Lucas Tanure wrote:
> > > The 8250 driver creates a fixed set of port slots at boot and
> > > registers a ttyS device for each one, even when the slot describes no
> > > hardware. On device tree platforms those slots are empty, but they
> > > still take the ttyS0..ttyS3 names.
> > >
> > > New Amlogic SoCs (S4, T7) name their real UARTs ttyS as well. With
> > > both drivers built in, as in arm64 defconfig, the real port fails to bind:
> >
> > Then fix that bug, don't break everyone else's systems because of it.
> >
> Hi,
>
> Understood. I thought preventing 8250 from probing on devices that don't use
> it would be a good idea, and fix my bug. Thanks for the feedback.
>
> I will tak to Amlogic list the ttyS name collision introduced for the new
> Amlogic SoCs in e71aab9d6132.
That was an explicit decision by Amlogic to do that, so there should not
be any collisions as their systems should NOT be having the older 8250
device tree entries.
So perhaps just fix your device tree to not be broken?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-19 6:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 18:52 [PATCH] serial: 8250: don't register ports that have no hardware Lucas Tanure
2026-08-19 4:42 ` Jiri Slaby
2026-08-19 6:31 ` Lucas Tanure
2026-08-19 5:57 ` Greg Kroah-Hartman
2026-08-19 6:40 ` Lucas Tanure
2026-08-19 6:49 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.