linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Peng Fan <peng.fan@nxp.com>,
	linux-kernel@vger.kernel.org,
	Bo Zhang <bozhang.zhang@broadcom.com>,
	Jim Quinlan <james.quinlan@broadcom.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Volodymyr Babchuk <volodymyr_babchuk@epam.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 11/11] firmware: arm_scmi: Use asynchronous CLOCK_RATE_SET when possible
Date: Tue, 23 Jul 2019 11:59:58 +0100	[thread overview]
Message-ID: <20190723105958.GB2815@e107155-lin> (raw)
In-Reply-To: <20190722212954.8924D21900@mail.kernel.org>

On Mon, Jul 22, 2019 at 02:29:53PM -0700, Stephen Boyd wrote:
> Quoting Sudeep Holla (2019-07-08 08:47:30)
> > CLOCK_PROTOCOL_ATTRIBUTES provides attributes to indicate the maximum
> > number of pending asynchronous clock rate changes supported by the
> > platform. If it's non-zero, then we should be able to use asynchronous
> > clock rate set for any clocks until the maximum limit is reached.
> >
> > Keeping the current count of pending asynchronous clock set rate
> > requests, we can decide if we can you asynchronous request for the
>
> This last part of the sentence doesn't read properly. Please rewrite.
>

Will fix.

> > incoming/new request.
> >
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> >  drivers/firmware/arm_scmi/clock.c | 21 ++++++++++++++++++---
> >  1 file changed, 18 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
> > index dd215bd11a58..70044b7c812e 100644
> > --- a/drivers/firmware/arm_scmi/clock.c
> > +++ b/drivers/firmware/arm_scmi/clock.c
> > @@ -221,21 +222,35 @@ static int scmi_clock_rate_set(const struct scmi_handle *handle, u32 clk_id,
> >                                u64 rate)
> >  {
> >         int ret;
> > +       u32 flags = 0;
> >         struct scmi_xfer *t;
> >         struct scmi_clock_set_rate *cfg;
> > +       struct clock_info *ci = handle->clk_priv;
> >
> >         ret = scmi_xfer_get_init(handle, CLOCK_RATE_SET, SCMI_PROTOCOL_CLOCK,
> >                                  sizeof(*cfg), 0, &t);
> >         if (ret)
> >                 return ret;
> >
> > +       if (ci->max_async_req) {
> > +               if (atomic_inc_return(&ci->cur_async_req) < ci->max_async_req)
> > +                       flags |= CLOCK_SET_ASYNC;
> > +               else
> > +                       atomic_dec(&ci->cur_async_req);
>
> Can this be combined with the atomic_dec() below and done after either
> transfer?
>

Yes but cleaner.

> > +       }
> > +
> >         cfg = t->tx.buf;
> > -       cfg->flags = cpu_to_le32(0);
> > +       cfg->flags = cpu_to_le32(flags);
> >         cfg->id = cpu_to_le32(clk_id);
> >         cfg->value_low = cpu_to_le32(rate & 0xffffffff);
> >         cfg->value_high = cpu_to_le32(rate >> 32);
> >
> > -       ret = scmi_do_xfer(handle, t);
> > +       if (flags & CLOCK_SET_ASYNC) {
> > +               ret = scmi_do_xfer_with_response(handle, t);
> > +               atomic_dec(&ci->cur_async_req);
> > +       } else {
> > +               ret = scmi_do_xfer(handle, t);
> > +       }
>
> I mean putting the atomic_dec() here.
>

Understood and done locally, will post as v2.

--
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2019-07-23 11:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 15:47 [PATCH 00/11] firmware: arm_scmi: Add support for Rx, async commands and delayed response Sudeep Holla
2019-07-08 15:47 ` [PATCH 01/11] firmware: arm_scmi: Reorder some functions to avoid forward declarations Sudeep Holla
2019-07-08 15:47 ` [PATCH 02/11] firmware: arm_scmi: Segregate tx channel handling and prepare to add rx Sudeep Holla
2019-07-18 21:23   ` Jim Quinlan
2019-07-19 10:26     ` Sudeep Holla
2019-07-08 15:47 ` [PATCH 03/11] firmware: arm_scmi: Add receive channel support for notifications Sudeep Holla
2019-07-08 15:47 ` [PATCH 04/11] firmware: arm_scmi: Separate out tx buffer handling and prepare to add rx Sudeep Holla
2019-07-08 15:47 ` [PATCH 05/11] firmware: arm_scmi: Add receive buffer support for notifications Sudeep Holla
2019-07-18 21:24   ` Jim Quinlan
     [not found]   ` <CA+-6iNz26xUyrzVSbWA+jwEfj3BC8k8KNCg2SreDK7mfWsbAWg@mail.gmail.com>
2019-07-19 10:29     ` Sudeep Holla
2019-07-08 15:47 ` [PATCH 06/11] firmware: arm_scmi: Add mechanism to unpack message headers Sudeep Holla
2019-07-08 15:47 ` [PATCH 07/11] firmware: arm_scmi: Add support for asynchronous commands and delayed response Sudeep Holla
2019-07-18 21:38   ` Jim Quinlan
2019-07-19 11:03     ` Sudeep Holla
2019-07-19 20:16       ` Jim Quinlan
2019-07-22 13:08         ` Sudeep Holla
2019-07-08 15:47 ` [PATCH 08/11] firmware: arm_scmi: Drop async flag in sensor_ops->reading_get Sudeep Holla
2019-07-08 16:05   ` Guenter Roeck
2019-07-08 15:47 ` [PATCH 09/11] firmware: arm_scmi: Add asynchronous sensor read if it supports Sudeep Holla
2019-07-08 15:47 ` [PATCH 10/11] firmware: arm_scmi: Drop config flag in clk_ops->rate_set Sudeep Holla
2019-07-22 21:30   ` Stephen Boyd
2019-07-08 15:47 ` [PATCH 11/11] firmware: arm_scmi: Use asynchronous CLOCK_RATE_SET when possible Sudeep Holla
2019-07-22 21:29   ` Stephen Boyd
2019-07-23 10:59     ` Sudeep Holla [this message]

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=20190723105958.GB2815@e107155-lin \
    --to=sudeep.holla@arm.com \
    --cc=bozhang.zhang@broadcom.com \
    --cc=james.quinlan@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=sboyd@kernel.org \
    --cc=volodymyr_babchuk@epam.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;
as well as URLs for NNTP newsgroup(s).