Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Long Zhao" <longzhao@ambarella.com>
Cc: conor+dt@kernel.org, lee@kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, linux-clk@vger.kernel.org, mfd@lists.linux.dev
Subject: Re: [PATCH v5 10/12] serial: 8250: add Ambarella UART driver
Date: Tue, 18 Aug 2026 10:50:35 +0000	[thread overview]
Message-ID: <20260818105036.0A9AF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818-cv75-v5-v5-10-7bbb12f0360f@ambarella.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Data race on up->ier and premature hardware interrupt enablement in ambarella_startup().
- [Medium] Silent drop of accumulated UART error and break status in ambarella_idle_enter().
--

--- Patch [10]: [PATCH v5 10/12] serial: 8250: add Ambarella UART driver ---
commit 766436c7b1daf21bb460e72b46363bc9a4c0f145
Author: Long Zhao <longzhao@ambarella.com>

serial: 8250: add Ambarella UART driver

This patch adds an 8250 platform driver for Ambarella CV75 instead of claiming
snps,dw-apb-uart compatibility.

> diff --git a/drivers/tty/serial/8250/8250_ambarella.c b/drivers/tty/serial/8250/8250_ambarella.c
> new file mode 100644
> index 0000000000000..951355e19fa25
> --- /dev/null
> +++ b/drivers/tty/serial/8250/8250_ambarella.c
[ ... ]
> +static int ambarella_idle_enter(struct uart_port *p)
> +{
[ ... ]
> +	status = serial_lsr_in(up);
> +	if (status & UART_LSR_DR) {
> +		readl(p->membase + (UART_RX << p->regshift));
> +		up->lsr_saved_flags = 0;

[Severity: Medium]
Will this unconditionally clear any pending parity, framing, overrun errors,
or break conditions accumulated in lsr_saved_flags by the preceding call
to serial_lsr_in()? If so, this could prevent the interrupt handler from
reporting these conditions to the upper layers, resulting in lost break
signals.

> +	}
> +
> +	if (readl(p->membase + (AMBARELLA_UART_USR << p->regshift)) &
> +	    AMBARELLA_UART_USR_BUSY) {
> +		ambarella_idle_exit(p);
> +		return -EBUSY;
> +	}
> +
> +	return 0;
> +}
[ ... ]
> +static int ambarella_startup(struct uart_port *port)
> +{
> +	struct uart_8250_port *up = up_to_u8250p(port);
> +	int ret;
> +
> +	ret = serial8250_do_startup(port);
> +	if (ret)
> +		return ret;
> +
> +	up->ier |= AMBARELLA_UART_IER_ETOI;
> +	serial_port_out(port, UART_IER, up->ier);

[Severity: High]
Does modifying up->ier and writing it to UART_IER here without holding
port->lock cause a data race with concurrent console writes
(e.g., serial8250_console_write()), which also manipulates interrupts under
the lock? 

Additionally, doesn't writing the IER register here defeat the 8250 core's
intentional deferral of interrupt enablement? The core typically defers
writing to UART_IER until set_termios to avoid swamping the interrupt handler
before the FIFOs are configured.

> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818-cv75-v5-v5-0-7bbb12f0360f@ambarella.com?part=10

  reply	other threads:[~2026-08-18 10:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 10:31 [PATCH v5 00/12] Ambarella CV75 SoC minimal bring-up Long Zhao via B4 Relay
2026-08-18 10:31 ` [PATCH v5 01/12] dt-bindings: arm: add Ambarella CV75 platforms Long Zhao via B4 Relay
2026-08-18 10:35   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 02/12] dt-bindings: mfd: syscon: add Ambarella CV75 secure scratchpad Long Zhao via B4 Relay
2026-08-18 10:37   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 03/12] dt-bindings: clock: add Ambarella CV75 RCT Long Zhao via B4 Relay
2026-08-18 10:36   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 04/12] dt-bindings: pinctrl: add Ambarella CV75 pinctrl Long Zhao via B4 Relay
2026-08-18 10:39   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 05/12] dt-bindings: gpio: pl061: add Ambarella CV75 variant Long Zhao via B4 Relay
2026-08-18 10:40   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 06/12] dt-bindings: serial: add Ambarella CV75 UART Long Zhao via B4 Relay
2026-08-18 10:39   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 07/12] clk: ambarella: add CV75 CCU driver Long Zhao via B4 Relay
2026-08-18 10:46   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 08/12] gpio: pl061: add Ambarella CV75 register layout variant Long Zhao via B4 Relay
2026-08-18 10:45   ` sashiko-bot
2026-08-18 14:11   ` Andy Shevchenko
2026-08-18 10:31 ` [PATCH v5 09/12] pinctrl: ambarella: add CV75 pin controller Long Zhao via B4 Relay
2026-08-18 10:48   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 10/12] serial: 8250: add Ambarella UART driver Long Zhao via B4 Relay
2026-08-18 10:50   ` sashiko-bot [this message]
2026-08-18 14:17   ` Andy Shevchenko
2026-08-18 10:31 ` [PATCH v5 11/12] arm64: ambarella: add ARCH_AMBARELLA and CV75 EVK DT Long Zhao via B4 Relay
2026-08-18 10:49   ` sashiko-bot
2026-08-18 10:31 ` [PATCH v5 12/12] MAINTAINERS: add ARM/AMBARELLA SoC support Long Zhao via B4 Relay

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=20260818105036.0A9AF1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=longzhao@ambarella.com \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox