All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v3 net-next 1/8] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access
Date: Tue, 01 Sep 2026 08:20:24 +0000	[thread overview]
Message-ID: <20260901082024.E6F931F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831082335.1184605-2-wei.fang@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Data loss of external hardware timestamps due to discarding all but the last timestamp from the FIFO
--

commit 7676c74333a13c4f33beb4f741615e25a7faf299
Author: Wei Fang <wei.fang@nxp.com>

ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access

This commit replaces open-coded 64-bit register read and write sequences
with ioread64_lo_hi() and iowrite64_lo_hi() helpers. It introduces new
macros to wrap these helpers to reduce boilerplate and enforce strict
L-before-H access ordering.

> diff --git a/drivers/ptp/ptp_netc.c b/drivers/ptp/ptp_netc.c
> index 19ca99d80e95b..376b3b0d1a38f 100644
> --- a/drivers/ptp/ptp_netc.c
> +++ b/drivers/ptp/ptp_netc.c

[ ... ]

> @@ -500,22 +473,19 @@ static void netc_timer_handle_etts_event(struct netc_timer *priv, int index,
>  					 bool update_event)
>  {
>  	struct ptp_clock_event event;
> -	u32 etts_l = 0, etts_h = 0;
> +	u64 etts = 0;
>  
> -	while (netc_timer_rd(priv, NETC_TMR_STAT) & TMR_STAT_ETS_VLD(index)) {
> -		etts_l = netc_timer_rd(priv, NETC_TMR_ETTS_L(index));
> -		etts_h = netc_timer_rd(priv, NETC_TMR_ETTS_H(index));
> -	}
> +	while (netc_timer_rd(priv, NETC_TMR_STAT) & TMR_STAT_ETS_VLD(index))
> +		etts = netc_timer_rd64(priv, NETC_TMR_ETTS_L(index));
>  
>  	/* Invalid time stamp */
> -	if (!etts_l && !etts_h)
> +	if (!etts)
>  		return;
>  
>  	if (update_event) {
>  		event.type = PTP_CLOCK_EXTTS;
>  		event.index = index;
> -		event.timestamp = (u64)etts_h << 32;
> -		event.timestamp |= etts_l;
> +		event.timestamp = etts;
>  		ptp_clock_event(priv->clock, &event);
>  	}
>  }

[Severity: High]
This is a pre-existing issue, but does this loop discard all but the last
timestamp from the hardware FIFO?

The while loop successfully drains multiple timestamps from the TMR_ETTS FIFO
if they accumulate before the interrupt is handled. However, because etts is
overwritten on each iteration and ptp_clock_event() is only called once
after the loop completes, it appears any prior external events in the batch
are silently lost.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831082335.1184605-1-wei.fang@oss.nxp.com?part=1

  reply	other threads:[~2026-09-01  8:20 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  8:23 [PATCH v3 net-next 0/8] net: dsa: netc: add PTP support for NETC switch wei.fang
2026-08-31  8:23 ` [PATCH v3 net-next 1/8] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access wei.fang
2026-09-01  8:20   ` sashiko-bot [this message]
2026-09-02  1:56     ` Wei Fang (OSS)
2026-08-31  8:23 ` [PATCH v3 net-next 2/8] ptp: netc: remove unnecessary pcie_flr() call in probe wei.fang
2026-08-31  8:23 ` [PATCH v3 net-next 3/8] ptp: netc: export netc_timer_get_current_time() for cross-driver use wei.fang
2026-09-01  8:20   ` sashiko-bot
2026-09-02  2:02     ` Wei Fang (OSS)
2026-09-04 22:25   ` netdev-bot+sashiko
2026-08-31  8:23 ` [PATCH v3 net-next 4/8] net: dsa: netc: use entry ID instead of pointer to track host flood rule wei.fang
2026-09-04 22:25   ` netdev-bot+sashiko
2026-08-31  8:23 ` [PATCH v3 net-next 5/8] net: dsa: netc: check return value of ntmp_ipft_delete_entry() wei.fang
2026-09-04 22:25   ` netdev-bot+sashiko
2026-09-07  2:42     ` Wei Fang
2026-08-31  8:23 ` [PATCH v3 net-next 6/8] net: dsa: netc: enable ingress port filtering lookup by default wei.fang
2026-08-31  8:23 ` [PATCH v3 net-next 7/8] net: dsa: netc: add PTP two-step timestamping support wei.fang
2026-09-01  8:20   ` sashiko-bot
2026-09-02  2:12     ` Wei Fang (OSS)
2026-09-04 22:25   ` netdev-bot+sashiko
2026-08-31  8:23 ` [PATCH v3 net-next 8/8] net: dsa: netc: add PTP one-step " wei.fang
2026-09-01  8:20   ` sashiko-bot
2026-09-02  3:00     ` Wei Fang (OSS)
2026-09-02  3:05     ` Wei Fang (OSS)
2026-09-04 22:25   ` netdev-bot+sashiko
2026-09-05  0:52   ` Jakub Kicinski
2026-09-05  6:16   ` Linus Walleij
2026-09-01 15:09 ` [PATCH v3 net-next 0/8] net: dsa: netc: add PTP support for NETC switch Jakub Kicinski
2026-09-02  1:43   ` Wei Fang

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=20260901082024.E6F931F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wei.fang@oss.nxp.com \
    /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.