From: sashiko-bot@kernel.org
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
wsa+renesas@sang-engineering.com
Subject: Re: [PATCH net-next v4 02/10] net: ethernet: ravb: Move programming of gPTP timer interval
Date: Thu, 10 Sep 2026 17:31:46 +0000 [thread overview]
Message-ID: <20260910173147.08B8F1F0089D@smtp.kernel.org> (raw)
In-Reply-To: <20260909173027.2201560-3-niklas.soderlund+renesas@ragnatech.se>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incorrect wait condition for GTI loading completion causes a read-modify-write race on GCCR.
--
commit f10e77bf451957f130f23e3dcc282e0d86b9d848
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
net: ethernet: ravb: Move programming of gPTP timer interval
This commit moves the programming of the gPTP timer interval from the
main RAVB logic into the gPTP initialization function. It also executes
this operation while holding the gPTP registers lock and attempts to
wait for the hardware to acknowledge the programming.
> diff --git a/drivers/net/ethernet/renesas/ravb_ptp.c b/drivers/net/ethernet/renesas/ravb_ptp.c
> index 43218bc15b151..157fb78209c78 100644
> --- a/drivers/net/ethernet/renesas/ravb_ptp.c
> +++ b/drivers/net/ethernet/renesas/ravb_ptp.c
[ ... ]
> @@ -321,11 +321,20 @@ void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev)
>
> priv->ptp.info = ravb_ptp_info;
>
> - priv->ptp.default_addend = ravb_read(ndev, GTI);
> + priv->ptp.default_addend = priv->gti_tiv;
> priv->ptp.current_addend = priv->ptp.default_addend;
>
> spin_lock_irqsave(&priv->lock, flags);
> +
> + /* Set gPTP Timer Increment Value. */
> + ravb_write(ndev, priv->ptp.default_addend, GTI);
> +
> + /* Request GTI loading. */
> + ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
> +
> + /* Wait for GIT loading to complete. */
> ravb_wait(ndev, GCCR, GCCR_TCR, GCCR_TCR_NOREQ);
[Severity: High]
Does this wait on the correct bits for GTI loading? The comment mentions
waiting for the load to complete, which is triggered by GCCR_LTI, but the
code polls GCCR_TCR instead.
Since the wait condition on GCCR_TCR is likely already met (no TCR request
active), this wait will return immediately.
> +
> ravb_modify(ndev, GCCR, GCCR_TCSS, GCCR_TCSS_ADJGPTP);
If the hardware is still processing the LTI request, could this read-modify-write
operation cause a race condition?
It might read the still-active GCCR_LTI bit and write it back to 1,
erroneously re-triggering the loading and potentially corrupting the gPTP
hardware state machine during normal interface configuration.
> spin_unlock_irqrestore(&priv->lock, flags);
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909173027.2201560-1-niklas.soderlund+renesas@ragnatech.se?part=2
next prev parent reply other threads:[~2026-09-10 17:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 17:30 [PATCH net-next v4 00/10] ravb: Add gPTP support for Gen4 Niklas Söderlund
2026-09-09 17:30 ` [PATCH net-next v4 01/10] net: ethernet: ravb: Remove gPTP control from WoL setup and restore Niklas Söderlund
2026-09-10 17:31 ` sashiko-bot
2026-09-09 17:30 ` [PATCH net-next v4 02/10] net: ethernet: ravb: Move programming of gPTP timer interval Niklas Söderlund
2026-09-10 17:31 ` sashiko-bot [this message]
2026-09-09 17:30 ` [PATCH net-next v4 03/10] net: ethernet: ravb: Simplify gPTP start and stop Niklas Söderlund
2026-09-10 17:31 ` sashiko-bot
2026-09-09 17:30 ` [PATCH net-next v4 04/10] net: ethernet: ravb: Remove redundant argument to ravb_ptp_init() Niklas Söderlund
2026-09-09 17:30 ` [PATCH net-next v4 05/10] net: ethernet: ravb: Propagate error from ptp_clock_register() Niklas Söderlund
2026-09-10 17:31 ` sashiko-bot
2026-09-09 17:30 ` [PATCH net-next v4 06/10] net: ethernet: ravb: Replace gPTP flags with callbacks Niklas Söderlund
2026-09-10 17:31 ` sashiko-bot
2026-09-09 17:30 ` [PATCH net-next v4 07/10] net: ethernet: ravb: Add callback for gPTP probe Niklas Söderlund
2026-09-10 17:31 ` sashiko-bot
2026-09-09 17:30 ` [PATCH net-next v4 08/10] net: ethernet: ravb: Add callback for gPTP clock index Niklas Söderlund
2026-09-09 17:30 ` [PATCH net-next v4 09/10] dt-bindings: net: renesas,etheravb: Add optional gPTP phandle for Gen4 Niklas Söderlund
2026-09-10 17:31 ` sashiko-bot
2026-09-09 17:30 ` [PATCH net-next v4 10/10] net: ethernet: ravb: Add gPTP support " Niklas Söderlund
2026-09-10 17:31 ` sashiko-bot
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=20260910173147.08B8F1F0089D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox