All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Phil Rosenthal" <phil@phil.gs>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: 8250_pci: Add support for ASPEED BMC VUARTs over PCIe
Date: Thu, 08 Oct 2026 13:38:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-164226@kernel.org> (raw)
In-Reply-To: <20261008-aspeed-vuart-v1-1-d2be17c99cd7@phil.gs>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tty: lockless read of UART_LSR during resume destructively clears receiver error bits
--

commit c43e6e51b74f249795f1e627ed53624daf3d509b
Author: Phil Rosenthal <phil@phil.gs>

serial: 8250_pci: Add support for ASPEED BMC VUARTs over PCIe

This commit adds PCI driver support for ASPEED BMC virtual UARTs, allowing 
them to be used for the kernel console and getty. It polls the ports due to a 
lack of interrupts on the tested board and probes for the VUARTs using custom 
initialization and setup quirks.

Link: https://lore.kernel.org/r/20230823173104.3219128-2-ninad@linux.ibm.com

> diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
> index 6e53d6d72a8e2..8c243c4fd58a9 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c

[ ... ]

> +/*
> + * A live 16550 can read LSR as 0xff, but never IIR, whose bits 4-5 are
> + * reserved. Only read IIR when LSR looks absent: reading IIR clears a
> + * pending THRI, and this also runs on resume while the port may be in use.
> + */
> +static bool pci_aspeed_vuart_present(void __iomem *base, unsigned int offset)
> +{
> +	void __iomem *regs = base + offset;
> +
> +	return readl(regs + (UART_LSR << PCI_ASPEED_VUART_REGSHIFT)) != ~0U ||
> +	       readl(regs + (UART_IIR << PCI_ASPEED_VUART_REGSHIFT)) != ~0U;
> +}

[Severity: Medium]
Does this lockless read of UART_LSR destructively clear receiver error bits?

While the comment correctly notes that reading UART_IIR clears a pending THRI,
reading the Line Status Register (UART_LSR) on a 16550-compatible UART will
instantly clear the receiver error flags (Overrun, Parity, Framing, Break).

> +
> +static int pci_aspeed_vuart_init(struct pci_dev *dev)
> +{
> +	void __iomem *base;
> +	int i, n = 0;
> +
> +	if (!(pci_resource_flags(dev, PCI_ASPEED_VUART_BAR) & IORESOURCE_MEM) ||
> +	    pci_resource_len(dev, PCI_ASPEED_VUART_BAR) < SZ_4K)
> +		return -ENODEV;
> +
> +	base = pci_iomap_range(dev, PCI_ASPEED_VUART_BAR, 0, SZ_4K);
> +	if (!base)
> +		return -ENOMEM;
> +
> +	for (i = 0; i < ARRAY_SIZE(pci_aspeed_vuart_io); i++)
> +		if (pci_aspeed_vuart_present(base, pci_aspeed_vuart_offset(i)))
> +			n++;

[Severity: Medium]
Because pci_aspeed_vuart_init() is mapped to quirk->init, won't it be invoked
by pciserial_resume_ports() during system resume?

If the port receives malformed data or experiences FIFO overruns while the
system is resuming, will this iteration clear those error flags locklessly
before the driver's interrupt handler or polling routine can process them?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-aspeed-vuart-v1-1-d2be17c99cd7@phil.gs?part=1

  reply	other threads:[~2026-10-08 13:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 13:27 [PATCH] serial: 8250_pci: Add support for ASPEED BMC VUARTs over PCIe Phil Rosenthal via B4 Relay
2026-10-08 13:27 ` Phil Rosenthal
2026-10-08 13:38 ` sashiko-bot [this message]
2026-10-08 17:38   ` Phil Rosenthal
2026-10-09  8:57 ` Andy Shevchenko
2026-10-09 13:45   ` Phil Rosenthal
2026-10-10  8:10     ` Andy Shevchenko
2026-10-10 10:47       ` Phil Rosenthal
2026-10-11 16:18         ` Tan Siewert
2026-10-11 17:00           ` Phil Rosenthal
2026-10-12 19:57           ` git

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-164226@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=phil@phil.gs \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.