linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: qcom-geni-se: Don't use relaxed writes when writing commands
@ 2020-07-22 22:01 Douglas Anderson
  2020-07-23  0:50 ` Stephen Boyd
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Douglas Anderson @ 2020-07-22 22:01 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson
  Cc: linux-arm-msm, swboyd, Rajendra Nayak, Akash Asthana,
	Sai Prakash Ranjan, Wolfram Sang, msavaliy, Douglas Anderson,
	Greg Kroah-Hartman, Matthias Kaehlcke, linux-kernel

Writing the command is the final step in kicking off a transfer.
Let's use writel() to ensure that any other memory accesses are done
before the command kicks off.  It's expected that this is mostly
relevant if we're in DMA mode but since it doesn't appear to regress
performance in a measurable way [1] even in PIO mode and it's easier
to reason about then let's just always use it.

NOTE: this patch came about due to code inspection.  No actual
problems were observed that this patch fixes.

[1] Tested by timing "flashrom -p ec" on a Chromebook which stresses
GENI SPI a lot.

Suggested-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 include/linux/qcom-geni-se.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h
index dd464943f717..f50c73be1428 100644
--- a/include/linux/qcom-geni-se.h
+++ b/include/linux/qcom-geni-se.h
@@ -262,7 +262,7 @@ static inline void geni_se_setup_m_cmd(struct geni_se *se, u32 cmd, u32 params)
 	u32 m_cmd;
 
 	m_cmd = (cmd << M_OPCODE_SHFT) | (params & M_PARAMS_MSK);
-	writel_relaxed(m_cmd, se->base + SE_GENI_M_CMD0);
+	writel(m_cmd, se->base + SE_GENI_M_CMD0);
 }
 
 /**
@@ -282,7 +282,7 @@ static inline void geni_se_setup_s_cmd(struct geni_se *se, u32 cmd, u32 params)
 	s_cmd &= ~(S_OPCODE_MSK | S_PARAMS_MSK);
 	s_cmd |= (cmd << S_OPCODE_SHFT);
 	s_cmd |= (params & S_PARAMS_MSK);
-	writel_relaxed(s_cmd, se->base + SE_GENI_S_CMD0);
+	writel(s_cmd, se->base + SE_GENI_S_CMD0);
 }
 
 /**
-- 
2.28.0.rc0.142.g3c755180ce-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom-geni-se: Don't use relaxed writes when writing commands
  2020-07-22 22:01 [PATCH] soc: qcom-geni-se: Don't use relaxed writes when writing commands Douglas Anderson
@ 2020-07-23  0:50 ` Stephen Boyd
  2020-07-23  5:13 ` Akash Asthana
  2020-07-23  8:57 ` Mukesh, Savaliya
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-07-23  0:50 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Douglas Anderson
  Cc: linux-arm-msm, Rajendra Nayak, Akash Asthana, Sai Prakash Ranjan,
	Wolfram Sang, msavaliy, Douglas Anderson, Greg Kroah-Hartman,
	Matthias Kaehlcke, linux-kernel

Quoting Douglas Anderson (2020-07-22 15:01:20)
> Writing the command is the final step in kicking off a transfer.
> Let's use writel() to ensure that any other memory accesses are done
> before the command kicks off.  It's expected that this is mostly
> relevant if we're in DMA mode but since it doesn't appear to regress
> performance in a measurable way [1] even in PIO mode and it's easier
> to reason about then let's just always use it.
> 
> NOTE: this patch came about due to code inspection.  No actual
> problems were observed that this patch fixes.
> 
> [1] Tested by timing "flashrom -p ec" on a Chromebook which stresses
> GENI SPI a lot.
> 
> Suggested-by: Stephen Boyd <swboyd@chromium.org>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom-geni-se: Don't use relaxed writes when writing commands
  2020-07-22 22:01 [PATCH] soc: qcom-geni-se: Don't use relaxed writes when writing commands Douglas Anderson
  2020-07-23  0:50 ` Stephen Boyd
@ 2020-07-23  5:13 ` Akash Asthana
  2020-07-23  8:57 ` Mukesh, Savaliya
  2 siblings, 0 replies; 4+ messages in thread
From: Akash Asthana @ 2020-07-23  5:13 UTC (permalink / raw)
  To: Douglas Anderson, Andy Gross, Bjorn Andersson
  Cc: linux-arm-msm, swboyd, Rajendra Nayak, Sai Prakash Ranjan,
	Wolfram Sang, msavaliy, Greg Kroah-Hartman, Matthias Kaehlcke,
	linux-kernel


On 7/23/2020 3:31 AM, Douglas Anderson wrote:
> Writing the command is the final step in kicking off a transfer.
> Let's use writel() to ensure that any other memory accesses are done
> before the command kicks off.  It's expected that this is mostly
> relevant if we're in DMA mode but since it doesn't appear to regress
> performance in a measurable way [1] even in PIO mode and it's easier
> to reason about then let's just always use it.
>
> NOTE: this patch came about due to code inspection.  No actual
> problems were observed that this patch fixes.
>
> [1] Tested by timing "flashrom -p ec" on a Chromebook which stresses
> GENI SPI a lot.
>
> Suggested-by: Stephen Boyd <swboyd@chromium.org>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
Reviewed-by: Akash Asthana <akashast@codeaurora.org>

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom-geni-se: Don't use relaxed writes when writing commands
  2020-07-22 22:01 [PATCH] soc: qcom-geni-se: Don't use relaxed writes when writing commands Douglas Anderson
  2020-07-23  0:50 ` Stephen Boyd
  2020-07-23  5:13 ` Akash Asthana
@ 2020-07-23  8:57 ` Mukesh, Savaliya
  2 siblings, 0 replies; 4+ messages in thread
From: Mukesh, Savaliya @ 2020-07-23  8:57 UTC (permalink / raw)
  To: Douglas Anderson, Andy Gross, Bjorn Andersson
  Cc: linux-arm-msm, swboyd, Rajendra Nayak, Akash Asthana,
	Sai Prakash Ranjan, Wolfram Sang, Greg Kroah-Hartman,
	Matthias Kaehlcke, linux-kernel


On 7/23/2020 3:31 AM, Douglas Anderson wrote:
> Writing the command is the final step in kicking off a transfer.
> Let's use writel() to ensure that any other memory accesses are done
> before the command kicks off.  It's expected that this is mostly
> relevant if we're in DMA mode but since it doesn't appear to regress
> performance in a measurable way [1] even in PIO mode and it's easier
> to reason about then let's just always use it.
>
> NOTE: this patch came about due to code inspection.  No actual
> problems were observed that this patch fixes.
>
> [1] Tested by timing "flashrom -p ec" on a Chromebook which stresses
> GENI SPI a lot.
>
> Suggested-by: Stephen Boyd <swboyd@chromium.org>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
> ---
>
>   include/linux/qcom-geni-se.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h
> index dd464943f717..f50c73be1428 100644
> --- a/include/linux/qcom-geni-se.h
> +++ b/include/linux/qcom-geni-se.h
> @@ -262,7 +262,7 @@ static inline void geni_se_setup_m_cmd(struct geni_se *se, u32 cmd, u32 params)
>   	u32 m_cmd;
>   
>   	m_cmd = (cmd << M_OPCODE_SHFT) | (params & M_PARAMS_MSK);
> -	writel_relaxed(m_cmd, se->base + SE_GENI_M_CMD0);
> +	writel(m_cmd, se->base + SE_GENI_M_CMD0);
>   }
>   
>   /**
> @@ -282,7 +282,7 @@ static inline void geni_se_setup_s_cmd(struct geni_se *se, u32 cmd, u32 params)
>   	s_cmd &= ~(S_OPCODE_MSK | S_PARAMS_MSK);
>   	s_cmd |= (cmd << S_OPCODE_SHFT);
>   	s_cmd |= (params & S_PARAMS_MSK);
> -	writel_relaxed(s_cmd, se->base + SE_GENI_S_CMD0);
> +	writel(s_cmd, se->base + SE_GENI_S_CMD0);
>   }
>   
>   /**

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-23  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 22:01 [PATCH] soc: qcom-geni-se: Don't use relaxed writes when writing commands Douglas Anderson
2020-07-23  0:50 ` Stephen Boyd
2020-07-23  5:13 ` Akash Asthana
2020-07-23  8:57 ` Mukesh, Savaliya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).