LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] firmware: qcom_scm: Fix legacy convention SCM accessors
@ 2020-07-04 17:23 Jonathan McDowell
  2020-07-13 16:35 ` Elliot Berman
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan McDowell @ 2020-07-04 17:23 UTC (permalink / raw)
  To: Elliot Berman, Andy Gross, Bjorn Andersson, linux-arm-msm, linux-kernel

The move to a combined driver for the QCOM SCM hardware changed the
io_writel and io_readl helpers to use non-atomic calls, despite the
commit message saying that atomic was a better option. This breaks these
helpers on hardware that uses the old legacy convention (access fails
with a -95 return code). Switch back to using the atomic calls.

Observed as a failure routing GPIO interrupts to the Apps processor on
an IPQ8064; fix is confirmed as correctly allowing the interrupts to be
routed and observed.

Fixes: 57d3b816718c ("firmware: qcom_scm: Remove thin wrappers")
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan McDowell <noodles@earth.li>
---
 drivers/firmware/qcom_scm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
index 0e7233a20f34..d4fda210adfe 100644
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
@@ -391,7 +391,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
 
 	desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;
 
-	return qcom_scm_call(__scm->dev, &desc, NULL);
+	return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
 }
 
 static void qcom_scm_set_download_mode(bool enable)
@@ -650,7 +650,7 @@ int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val)
 	int ret;
 
 
-	ret = qcom_scm_call(__scm->dev, &desc, &res);
+	ret = qcom_scm_call_atomic(__scm->dev, &desc, &res);
 	if (ret >= 0)
 		*val = res.result[0];
 
@@ -669,8 +669,7 @@ int qcom_scm_io_writel(phys_addr_t addr, unsigned int val)
 		.owner = ARM_SMCCC_OWNER_SIP,
 	};
 
-
-	return qcom_scm_call(__scm->dev, &desc, NULL);
+	return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
 }
 EXPORT_SYMBOL(qcom_scm_io_writel);
 
-- 
2.20.1


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

* Re: [PATCH] firmware: qcom_scm: Fix legacy convention SCM accessors
  2020-07-04 17:23 [PATCH] firmware: qcom_scm: Fix legacy convention SCM accessors Jonathan McDowell
@ 2020-07-13 16:35 ` Elliot Berman
  2020-07-13 18:42   ` Bjorn Andersson
  0 siblings, 1 reply; 3+ messages in thread
From: Elliot Berman @ 2020-07-13 16:35 UTC (permalink / raw)
  To: Jonathan McDowell, Andy Gross, Bjorn Andersson, linux-arm-msm,
	linux-kernel

For the Qualcomm TrustZone firmwares which I am familiar with:

Reviewed-by: Elliot Berman <eberman@codeaurora.org>

On 7/4/2020 10:23 AM, Jonathan McDowell wrote:
> The move to a combined driver for the QCOM SCM hardware changed the
> io_writel and io_readl helpers to use non-atomic calls, despite the
> commit message saying that atomic was a better option. This breaks these
> helpers on hardware that uses the old legacy convention (access fails
> with a -95 return code). Switch back to using the atomic calls.
> 
> Observed as a failure routing GPIO interrupts to the Apps processor on
> an IPQ8064; fix is confirmed as correctly allowing the interrupts to be
> routed and observed.
> 
> Fixes: 57d3b816718c ("firmware: qcom_scm: Remove thin wrappers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jonathan McDowell <noodles@earth.li>
> ---
>  drivers/firmware/qcom_scm.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
> index 0e7233a20f34..d4fda210adfe 100644
> --- a/drivers/firmware/qcom_scm.c
> +++ b/drivers/firmware/qcom_scm.c
> @@ -391,7 +391,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
>  
>  	desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;
>  
> -	return qcom_scm_call(__scm->dev, &desc, NULL);
> +	return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
>  }
>  
>  static void qcom_scm_set_download_mode(bool enable)
> @@ -650,7 +650,7 @@ int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val)
>  	int ret;
>  
>  
> -	ret = qcom_scm_call(__scm->dev, &desc, &res);
> +	ret = qcom_scm_call_atomic(__scm->dev, &desc, &res);
>  	if (ret >= 0)
>  		*val = res.result[0];
>  
> @@ -669,8 +669,7 @@ int qcom_scm_io_writel(phys_addr_t addr, unsigned int val)
>  		.owner = ARM_SMCCC_OWNER_SIP,
>  	};
>  
> -
> -	return qcom_scm_call(__scm->dev, &desc, NULL);
> +	return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
>  }
>  EXPORT_SYMBOL(qcom_scm_io_writel);
>  
> 

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

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

* Re: [PATCH] firmware: qcom_scm: Fix legacy convention SCM accessors
  2020-07-13 16:35 ` Elliot Berman
@ 2020-07-13 18:42   ` Bjorn Andersson
  0 siblings, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2020-07-13 18:42 UTC (permalink / raw)
  To: Elliot Berman; +Cc: Jonathan McDowell, Andy Gross, linux-arm-msm, linux-kernel

On Mon 13 Jul 09:35 PDT 2020, Elliot Berman wrote:

> For the Qualcomm TrustZone firmwares which I am familiar with:
> 
> Reviewed-by: Elliot Berman <eberman@codeaurora.org>
> 

Thanks for the patch Jonathan and thanks for the review Elliot!

Applied

Regards,
Bjorn

> On 7/4/2020 10:23 AM, Jonathan McDowell wrote:
> > The move to a combined driver for the QCOM SCM hardware changed the
> > io_writel and io_readl helpers to use non-atomic calls, despite the
> > commit message saying that atomic was a better option. This breaks these
> > helpers on hardware that uses the old legacy convention (access fails
> > with a -95 return code). Switch back to using the atomic calls.
> > 
> > Observed as a failure routing GPIO interrupts to the Apps processor on
> > an IPQ8064; fix is confirmed as correctly allowing the interrupts to be
> > routed and observed.
> > 
> > Fixes: 57d3b816718c ("firmware: qcom_scm: Remove thin wrappers")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Jonathan McDowell <noodles@earth.li>
> > ---
> >  drivers/firmware/qcom_scm.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
> > index 0e7233a20f34..d4fda210adfe 100644
> > --- a/drivers/firmware/qcom_scm.c
> > +++ b/drivers/firmware/qcom_scm.c
> > @@ -391,7 +391,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
> >  
> >  	desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;
> >  
> > -	return qcom_scm_call(__scm->dev, &desc, NULL);
> > +	return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
> >  }
> >  
> >  static void qcom_scm_set_download_mode(bool enable)
> > @@ -650,7 +650,7 @@ int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val)
> >  	int ret;
> >  
> >  
> > -	ret = qcom_scm_call(__scm->dev, &desc, &res);
> > +	ret = qcom_scm_call_atomic(__scm->dev, &desc, &res);
> >  	if (ret >= 0)
> >  		*val = res.result[0];
> >  
> > @@ -669,8 +669,7 @@ int qcom_scm_io_writel(phys_addr_t addr, unsigned int val)
> >  		.owner = ARM_SMCCC_OWNER_SIP,
> >  	};
> >  
> > -
> > -	return qcom_scm_call(__scm->dev, &desc, NULL);
> > +	return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
> >  }
> >  EXPORT_SYMBOL(qcom_scm_io_writel);
> >  
> > 
> 
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-04 17:23 [PATCH] firmware: qcom_scm: Fix legacy convention SCM accessors Jonathan McDowell
2020-07-13 16:35 ` Elliot Berman
2020-07-13 18:42   ` Bjorn Andersson

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git