Re: [PATCH 1/1] tty: serial: handle HAS_IOPORT dependencies

From: Arnd Bergmann
Date: Mon Nov 25 2024 - 12:55:44 EST


On Mon, Nov 25, 2024, at 17:54, Maciej W. Rozycki wrote:
> On Mon, 25 Nov 2024, Arnd Bergmann wrote:
>
>> > But the configuration can give less than old_serial_port contains.
>> > See dozens of the explicit settings in the defconfigs.
>>
>> I don't see any of the upstream defconfigs doing this
>> though, the only ones setting CONFIG_SERIAL_8250_RUNTIME_UARTS
>> are those that have an empty old_serial_port[].
>>
>> Note that SERIAL_PORT_DFNS is only defined on x86, alpha
>> and m68k (for q40), which are the main PC-like platforms.
>
> May I suggest to call `serial8250_isa_init_ports':
>
> if (IS_ENABLED(CONFIG_ISA) || IS_ENABLED(CONFIG_ALPHA) ||
> IS_ENABLED(CONFIG_M68K) || IS_ENABLED(CONFIG_X86))
>
> then (or have an equivalent `select' in the relevant Kconfig files)?

Right, I think that makes sense, but I'm a little worried
about renumbering or incorrectly configuring the uarts on
a non-x86 system that might have ISA slots and also register
a 8250 console.

E.g. on the RM200, two serial ports get registered on
MMIO addresses:

arch/mips/sni/rm200.c:static struct serial8250_platform_data rm200_data[] = {
arch/mips/sni/rm200.c- MEMPORT(0x160003f8, RM200_I8259A_IRQ_BASE + 4),
arch/mips/sni/rm200.c- MEMPORT(0x160002f8, RM200_I8259A_IRQ_BASE + 3),
arch/mips/sni/rm200.c- { },
arch/mips/sni/rm200.c-};

so these would become ports ttyS4 and ttyS5 if the first four
ports get reserved for ISA cards, or disappear when using the
default CONFIG_SERIAL_8250_NR_UARTS=4.

Arnd