[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFp+6iEwN6jeEGNxKVU5_i5NxdEbuF2ZggegEJZ1Rq6F=H34jg@mail.gmail.com>
Date: Wed, 19 Jun 2019 17:04:39 +0530
From: Vivek Gautam <vivek.gautam@...eaurora.org>
To: Will Deacon <will.deacon@....com>
Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"robh+dt" <robh+dt@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
David Brown <david.brown@...aro.org>,
"list@....net:IOMMU DRIVERS <iommu@...ts.linux-foundation.org>, Joerg
Roedel <joro@...tes.org>," <iommu@...ts.linux-foundation.org>,
Andy Gross <agross@...nel.org>,
Robin Murphy <robin.murphy@....com>
Subject: Re: [PATCH v3 1/4] firmware: qcom_scm-64: Add atomic version of qcom_scm_call
On Tue, Jun 18, 2019 at 11:25 PM Will Deacon <will.deacon@....com> wrote:
>
> On Wed, Jun 12, 2019 at 12:45:51PM +0530, Vivek Gautam wrote:
> > There are scnenarios where drivers are required to make a
> > scm call in atomic context, such as in one of the qcom's
> > arm-smmu-500 errata [1].
> >
> > [1] ("https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/
> > drivers/iommu/arm-smmu.c?h=CogSystems-msm-49/
> > msm-4.9&id=da765c6c75266b38191b38ef086274943f353ea7")
> >
> > Signed-off-by: Vivek Gautam <vivek.gautam@...eaurora.org>
> > Reviewed-by: Bjorn Andersson <bjorn.andersson@...aro.org>
> > ---
> > drivers/firmware/qcom_scm-64.c | 136 ++++++++++++++++++++++++++++-------------
> > 1 file changed, 92 insertions(+), 44 deletions(-)
> >
> > diff --git a/drivers/firmware/qcom_scm-64.c b/drivers/firmware/qcom_scm-64.c
> > index 91d5ad7cf58b..b6dca32c5ac4 100644
> > --- a/drivers/firmware/qcom_scm-64.c
> > +++ b/drivers/firmware/qcom_scm-64.c
[snip]
> > +
> > +static void qcom_scm_call_do(const struct qcom_scm_desc *desc,
> > + struct arm_smccc_res *res, u32 fn_id,
> > + u64 x5, bool atomic)
> > +{
>
> Maybe pass in the call type (ARM_SMCCC_FAST_CALL vs ARM_SMCCC_STD_CALL)
> instead of "bool atomic"? Would certainly make the callsites easier to
> understand.
Sure, will do that.
>
> > + int retry_count = 0;
> > +
> > + if (!atomic) {
> > + do {
> > + mutex_lock(&qcom_scm_lock);
> > +
> > + __qcom_scm_call_do(desc, res, fn_id, x5,
> > + ARM_SMCCC_STD_CALL);
> > +
> > + mutex_unlock(&qcom_scm_lock);
> > +
> > + if (res->a0 == QCOM_SCM_V2_EBUSY) {
> > + if (retry_count++ > QCOM_SCM_EBUSY_MAX_RETRY)
> > + break;
> > + msleep(QCOM_SCM_EBUSY_WAIT_MS);
> > + }
> > + } while (res->a0 == QCOM_SCM_V2_EBUSY);
> > + } else {
> > + __qcom_scm_call_do(desc, res, fn_id, x5, ARM_SMCCC_FAST_CALL);
> > + }
>
> Is it safe to make concurrent FAST calls?
I better add a spinlock here.
Thanks & regards
Vivek
>
> Will
> _______________________________________________
> iommu mailing list
> iommu@...ts.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
Powered by blists - more mailing lists