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

From: Maciej W. Rozycki
Date: Wed May 22 2024 - 22:11:35 EST


On Fri, 5 Apr 2024, Niklas Schnelle wrote:

> diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
> index 0d35c77fad9e..38ac5236d2ea 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -928,6 +928,7 @@ static int pci_netmos_init(struct pci_dev *dev)
> return num_serial;
> }
>
> +#ifdef CONFIG_HAS_IOPORT
> /*
> * These chips are available with optionally one parallel port and up to
> * two serial ports. Unfortunately they all have the same product id.
[...]
> diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
> index 47ff50763c04..54bf98869abf 100644
> --- a/drivers/tty/serial/8250/Kconfig
> +++ b/drivers/tty/serial/8250/Kconfig
> @@ -136,7 +135,7 @@ config SERIAL_8250_PCILIB
>
> config SERIAL_8250_PCI
> tristate "8250/16550 PCI device support"
> - depends on SERIAL_8250 && PCI
> + depends on SERIAL_8250 && PCI && HAS_IOPORT
> select SERIAL_8250_PCILIB
> default SERIAL_8250
> help

This is clearly wrong, there is PCIe 8250 serial hardware that does MMIO
only, so the option has to stay possible to enable. I have such hardware
as shown in this log:

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial 0001:01:00.0: enabling device (0140 -> 0142)
serial 0001:01:00.0: detected caps 00000700 should be 00000500
0001:01:00.0: ttyS0 at MMIO 0x600c080401000 (irq = 40, base_baud = 15625000) is a 16C950/954
serial 0001:01:00.0: detected caps 00000700 should be 00000500
0001:01:00.0: ttyS1 at MMIO 0x600c080401200 (irq = 40, base_baud = 15625000) is a 16C950/954

which is from a POWER9 system. Which as you may know has no PCI port I/O
support in hardware, so it is quite relevant here. I'd like to keep this
PCIe serial option functional with my system.

Also your change itself modifies 8250_pci.c (cited above for reference),
which would make no sense if SERIAL_8250_PCI was permanently disabled for
!HAS_IOPORT. Shall I take it than that the Kconfig change I question has
been made merely by mistake?

Maciej