Skip to content

drivers/serial/uart_pci_16550: Share the device interrupt between its ports - #22024

Open
raiden00pl wants to merge 2 commits into
apache:masterfrom
raiden00pl:pci-16550-shared-irq
Open

raiden00pl wants to merge 2 commits into
apache:masterfrom
raiden00pl:pci-16550-shared-irq

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

All ports of one PCI function of a multiport 16550 card share its
interrupt, but every port attached and enabled it on its own: opening a
second port replaced the handler of the first port, and closing a port
disabled the interrupt of the others.

  • uart_16550: u16550_interrupt() returns nonzero if the UART had an
    interrupt pending.
  • uart_pci_16550: attach the interrupt of a device once when it is probed
    and service all its ports in the handler until none has an interrupt
    pending. The card interrupt stays asserted while any port has one, so on
    an edge-triggered input a single pass left the card stuck.

Impact

Multiport PCI 16550 cards: all ports can be opened at the same time. Single
port cards are unchanged.

Testing

qemu-intel64, echo on all configured ports at the same time:

  • pci-serial, pci-serial-2x, pci-serial-4x, ports opened at boot and later.
  • pci-serial-2x and pci-serial together, each card on its own interrupt.

Return nonzero if the UART had an interrupt pending.  The handler of an
interrupt shared by several UARTs needs this to know when none of them
asserts the interrupt any more.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <raiden00@railab.me>
… ports.

All ports of one PCI function share its interrupt, but every port
attached and enabled it on its own: opening a second port replaced the
handler of the first port, and closing a port disabled the interrupt of
the others.  Attach the interrupt of a device once when it is probed
and service all its ports in the handler.

The handler repeats until no port has an interrupt pending.  The card
interrupt stays asserted while any port has one, so on an edge-triggered
input a port that raised its interrupt while another port was serviced
never got serviced and the card stopped receiving.

QEMU docs/specs/pci-serial.rst, pci-serial-2x and pci-serial-4x:
"Interrupt: Wired to pin A."

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <raiden00@railab.me>
@github-actions github-actions Bot added Area: Drivers Drivers issues Size: S The size of the change in this PR is small labels Nov 18, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Drivers Drivers issues Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant