All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: kishon@ti.com, vkoul@kernel.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	geert+renesas@glider.be, andrew@lunn.ch,
	linux-phy@lists.infradead.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2 6/8] net: ethernet: renesas: rswitch: Add R-Car Gen4 gPTP support
Date: Wed, 21 Sep 2022 07:34:56 -0700	[thread overview]
Message-ID: <YyshEGhh7zr+gXpa@hoboy.vegasvil.org> (raw)
In-Reply-To: <20220921084745.3355107-7-yoshihiro.shimoda.uh@renesas.com>

On Wed, Sep 21, 2022 at 05:47:43PM +0900, Yoshihiro Shimoda wrote:

> +static int rcar_gen4_ptp_gettime(struct ptp_clock_info *ptp,
> +				 struct timespec64 *ts)
> +{
> +	struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp);
> +
> +	ts->tv_nsec = ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t0);
> +	ts->tv_sec = ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t1) |
> +		     ((s64)ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t2) << 32);

No locking here ...

> +	return 0;
> +}
> +
> +static int rcar_gen4_ptp_settime(struct ptp_clock_info *ptp,
> +				 const struct timespec64 *ts)
> +{
> +	struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp);
> +
> +	iowrite32(1, ptp_priv->addr + ptp_priv->offs->disable);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t2);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t1);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t0);
> +	iowrite32(1, ptp_priv->addr + ptp_priv->offs->enable);
> +	iowrite32(ts->tv_sec >> 32, ptp_priv->addr + ptp_priv->offs->config_t2);
> +	iowrite32(ts->tv_sec, ptp_priv->addr + ptp_priv->offs->config_t1);
> +	iowrite32(ts->tv_nsec, ptp_priv->addr + ptp_priv->offs->config_t0);

... or here?

You need to protect multiple register access against concurrent callers.

Thanks,
Richard

> +	return 0;
> +}

WARNING: multiple messages have this Message-ID (diff)
From: Richard Cochran <richardcochran@gmail.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: kishon@ti.com, vkoul@kernel.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	geert+renesas@glider.be, andrew@lunn.ch,
	linux-phy@lists.infradead.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2 6/8] net: ethernet: renesas: rswitch: Add R-Car Gen4 gPTP support
Date: Wed, 21 Sep 2022 07:34:56 -0700	[thread overview]
Message-ID: <YyshEGhh7zr+gXpa@hoboy.vegasvil.org> (raw)
In-Reply-To: <20220921084745.3355107-7-yoshihiro.shimoda.uh@renesas.com>

On Wed, Sep 21, 2022 at 05:47:43PM +0900, Yoshihiro Shimoda wrote:

> +static int rcar_gen4_ptp_gettime(struct ptp_clock_info *ptp,
> +				 struct timespec64 *ts)
> +{
> +	struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp);
> +
> +	ts->tv_nsec = ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t0);
> +	ts->tv_sec = ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t1) |
> +		     ((s64)ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t2) << 32);

No locking here ...

> +	return 0;
> +}
> +
> +static int rcar_gen4_ptp_settime(struct ptp_clock_info *ptp,
> +				 const struct timespec64 *ts)
> +{
> +	struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp);
> +
> +	iowrite32(1, ptp_priv->addr + ptp_priv->offs->disable);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t2);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t1);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t0);
> +	iowrite32(1, ptp_priv->addr + ptp_priv->offs->enable);
> +	iowrite32(ts->tv_sec >> 32, ptp_priv->addr + ptp_priv->offs->config_t2);
> +	iowrite32(ts->tv_sec, ptp_priv->addr + ptp_priv->offs->config_t1);
> +	iowrite32(ts->tv_nsec, ptp_priv->addr + ptp_priv->offs->config_t0);

... or here?

You need to protect multiple register access against concurrent callers.

Thanks,
Richard

> +	return 0;
> +}

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2022-09-21 14:35 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21  8:47 [PATCH v2 0/8] treewide: Add R-Car S4-8 Ethernet Switch support Yoshihiro Shimoda
2022-09-21  8:47 ` [PATCH v2 1/8] clk: renesas: r8a779f0: Add Ethernet Switch clocks Yoshihiro Shimoda
2022-09-21  8:47 ` [PATCH v2 2/8] dt-bindings: phy: renesas: Document Renesas Ethernet SERDES Yoshihiro Shimoda
2022-09-22  7:28   ` Krzysztof Kozlowski
2022-09-22  7:28     ` Krzysztof Kozlowski
2022-09-22  7:39     ` Yoshihiro Shimoda
2022-09-22  7:39       ` Yoshihiro Shimoda
2022-09-22  7:56       ` Geert Uytterhoeven
2022-09-22  7:56         ` Geert Uytterhoeven
2022-09-22  8:20         ` Yoshihiro Shimoda
2022-09-22  8:20           ` Yoshihiro Shimoda
2022-09-21  8:47 ` [PATCH v2 3/8] phy: renesas: Add Renesas Ethernet SERDES driver for R-Car S4-8 Yoshihiro Shimoda
2022-09-21  8:47 ` [PATCH v2 4/8] dt-bindings: net: renesas: Document Renesas Ethernet Switch Yoshihiro Shimoda
2022-09-22  7:37   ` Krzysztof Kozlowski
2022-09-22  7:37     ` Krzysztof Kozlowski
2022-09-22 12:13     ` Andrew Lunn
2022-09-22 12:13       ` Andrew Lunn
2022-09-26  6:10     ` Yoshihiro Shimoda
2022-09-26  6:10       ` Yoshihiro Shimoda
2022-09-26  6:50       ` Krzysztof Kozlowski
2022-09-26  6:50         ` Krzysztof Kozlowski
2022-09-26  9:14         ` Yoshihiro Shimoda
2022-09-26  9:14           ` Yoshihiro Shimoda
2022-09-26  9:25           ` Krzysztof Kozlowski
2022-09-26  9:25             ` Krzysztof Kozlowski
2022-09-26 10:20             ` Yoshihiro Shimoda
2022-09-26 10:20               ` Yoshihiro Shimoda
2022-09-21  8:47 ` [PATCH v2 5/8] net: ethernet: renesas: Add Ethernet Switch driver Yoshihiro Shimoda
2022-09-21  8:47 ` [PATCH v2 6/8] net: ethernet: renesas: rswitch: Add R-Car Gen4 gPTP support Yoshihiro Shimoda
2022-09-21 14:34   ` Richard Cochran [this message]
2022-09-21 14:34     ` Richard Cochran
2022-09-22  0:10     ` Yoshihiro Shimoda
2022-09-22  0:10       ` Yoshihiro Shimoda
2022-09-21  8:47 ` [PATCH v2 7/8] arm64: dts: renesas: r8a779f0: Add Ethernet Switch and SERDES nodes Yoshihiro Shimoda
2022-09-21  8:47 ` [PATCH v2 8/8] arm64: dts: renesas: r8a779f0: spider: Enable Ethernet Switch and SERDES Yoshihiro Shimoda
2022-09-21 14:40 ` [PATCH v2 0/8] treewide: Add R-Car S4-8 Ethernet Switch support Jakub Kicinski
2022-09-21 14:40   ` Jakub Kicinski
2022-09-22  0:46   ` Yoshihiro Shimoda
2022-09-22  0:46     ` Yoshihiro Shimoda
2022-09-22  1:06     ` Jakub Kicinski
2022-09-22  1:06       ` Jakub Kicinski
2022-09-22  1:18       ` Andrew Lunn
2022-09-22  1:18         ` Andrew Lunn
2022-09-22  1:31         ` Yoshihiro Shimoda
2022-09-22  1:31           ` Yoshihiro Shimoda
2022-09-22  1:20       ` Yoshihiro Shimoda
2022-09-22  1:20         ` Yoshihiro Shimoda
2022-09-24  6:57     ` Vinod Koul
2022-09-24  6:57       ` Vinod Koul
2022-09-26  0:21       ` Yoshihiro Shimoda
2022-09-26  0:21         ` Yoshihiro Shimoda

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=YyshEGhh7zr+gXpa@hoboy.vegasvil.org \
    --to=richardcochran@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=kishon@ti.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.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.