From: Lina Iyer <ilina@codeaurora.org>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Raju P L S S S N <rplsssn@codeaurora.org>,
andy.gross@linaro.org, david.brown@linaro.org,
linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
rnayak@codeaurora.org, bjorn.andersson@linaro.org,
linux-kernel@vger.kernel.org, sboyd@kernel.org,
evgreen@chromium.org, dianders@chromium.org
Subject: Re: [PATCH v2 3/6] drivers: qcom: rpmh: disallow active requests in solver mode
Date: Tue, 11 Sep 2018 20:22:04 -0600 [thread overview]
Message-ID: <20180912022204.GI15710@codeaurora.org> (raw)
In-Reply-To: <20180911230203.GI22824@google.com>
On Tue, Sep 11 2018 at 17:02 -0600, Matthias Kaehlcke wrote:
>Hi Raju/Lina,
>
>On Fri, Jul 27, 2018 at 03:34:46PM +0530, Raju P L S S S N wrote:
>> From: Lina Iyer <ilina@codeaurora.org>
>>
>> Controllers may be in 'solver' state, where they could be in autonomous
>> mode executing low power modes for their hardware and as such are not
>> available for sending active votes. Device driver may notify RPMH API
>> that the controller is in solver mode and when in such mode, disallow
>> requests from platform drivers for state change using the RSC.
>>
>> Signed-off-by: Lina Iyer <ilina@codeaurora.org>
>> Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org>
>> ---
>> drivers/soc/qcom/rpmh-internal.h | 2 ++
>> drivers/soc/qcom/rpmh.c | 59 ++++++++++++++++++++++++++++++++++++++++
>> include/soc/qcom/rpmh.h | 5 ++++
>> 3 files changed, 66 insertions(+)
>>
>> diff --git a/drivers/soc/qcom/rpmh-internal.h b/drivers/soc/qcom/rpmh-internal.h
>> index 4ff43bf..6cd2f78 100644
>> --- a/drivers/soc/qcom/rpmh-internal.h
>> +++ b/drivers/soc/qcom/rpmh-internal.h
>> @@ -72,12 +72,14 @@ struct rpmh_request {
>> * @cache_lock: synchronize access to the cache data
>> * @dirty: was the cache updated since flush
>> * @batch_cache: Cache sleep and wake requests sent as batch
>> + * @in_solver_mode: Controller is busy in solver mode
>> */
>> struct rpmh_ctrlr {
>> struct list_head cache;
>> spinlock_t cache_lock;
>> bool dirty;
>> struct list_head batch_cache;
>> + bool in_solver_mode;
>> };
>>
>> /**
>> diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c
>> index 2382276..0d276fd 100644
>> --- a/drivers/soc/qcom/rpmh.c
>> +++ b/drivers/soc/qcom/rpmh.c
>> @@ -5,6 +5,7 @@
>>
>> #include <linux/atomic.h>
>> #include <linux/bug.h>
>> +#include <linux/delay.h>
>> #include <linux/interrupt.h>
>> #include <linux/jiffies.h>
>> #include <linux/kernel.h>
>> @@ -75,6 +76,50 @@ static struct rpmh_ctrlr *get_rpmh_ctrlr(const struct device *dev)
>> return &drv->client;
>> }
>>
>> +static int check_ctrlr_state(struct rpmh_ctrlr *ctrlr, enum rpmh_state state)
>> +{
>> + unsigned long flags;
>> + int ret = 0;
>> +
>> + /* Do not allow setting active votes when in solver mode */
>> + spin_lock_irqsave(&ctrlr->cache_lock, flags);
>> + if (ctrlr->in_solver_mode && state == RPMH_ACTIVE_ONLY_STATE)
>> + ret = -EBUSY;
>> + spin_unlock_irqrestore(&ctrlr->cache_lock, flags);
>> +
>> + return ret;
>> +}
>> +
>> +/**
>> + * rpmh_mode_solver_set: Indicate that the RSC controller hardware has
>> + * been configured to be in solver mode
>> + *
>> + * @dev: the device making the request
>> + * @enable: Boolean value indicating if the controller is in solver mode.
>> + *
>> + * When solver mode is enabled, passthru API will not be able to send wake
>> + * votes, just awake and active votes.
>> + */
>> +int rpmh_mode_solver_set(const struct device *dev, bool enable)
>> +{
>> + struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
>> + unsigned long flags;
>> +
>> + for (;;) {
>> + spin_lock_irqsave(&ctrlr->cache_lock, flags);
>> + if (rpmh_rsc_ctrlr_is_idle(ctrlr_to_drv(ctrlr))) {
>> + ctrlr->in_solver_mode = enable;
>
>As commented on '[v2,1/6] drivers: qcom: rpmh-rsc: return if the
>controller is idle', this seems potentially
>racy. _is_idle() could report the controller as idle, even though some
>TCSes are in use (after _is_idle() visited them).
>
>Additional locking may be needed or a comment if this situation should
>never happen on a sane system (I don't know enough about RPMh and its
>clients to judge if this is the case).
Hmm.. Forgot that we call from here. May be a lock might be helpful.
-- Lina
next prev parent reply other threads:[~2018-09-12 2:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-27 10:04 [PATCH v2 0/6] drivers/qcom: add additional functionality to RPMH Raju P L S S S N
2018-07-27 10:04 ` [PATCH v2 1/6] drivers: qcom: rpmh-rsc: return if the controller is idle Raju P L S S S N
2018-09-11 22:39 ` Matthias Kaehlcke
2018-09-12 2:20 ` Lina Iyer
2018-07-27 10:04 ` [PATCH v2 2/6] drivers: qcom: rpmh: export controller idle status Raju P L S S S N
2018-07-27 10:04 ` [PATCH v2 3/6] drivers: qcom: rpmh: disallow active requests in solver mode Raju P L S S S N
2018-09-11 23:02 ` Matthias Kaehlcke
2018-09-12 2:22 ` Lina Iyer [this message]
2018-07-27 10:04 ` [PATCH v2 4/6] drivers: qcom: rpmh-rsc: clear active mode configuration for waketcs Raju P L S S S N
2018-09-12 21:51 ` Matthias Kaehlcke
2018-07-27 10:04 ` [PATCH v2 5/6] drivers: qcom: rpmh-rsc: write PDC data Raju P L S S S N
2018-09-12 22:28 ` Matthias Kaehlcke
2018-09-12 22:33 ` Lina Iyer
2018-09-12 22:37 ` Matthias Kaehlcke
2018-07-27 10:04 ` [PATCH v2 6/6] drivers: qcom: rpmh: " Raju P L S S S N
2018-09-12 22:55 ` Matthias Kaehlcke
2018-09-05 20:05 ` [PATCH v2 0/6] drivers/qcom: add additional functionality to RPMH Lina Iyer
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=20180912022204.GI15710@codeaurora.org \
--to=ilina@codeaurora.org \
--cc=andy.gross@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=david.brown@linaro.org \
--cc=dianders@chromium.org \
--cc=evgreen@chromium.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=mka@chromium.org \
--cc=rnayak@codeaurora.org \
--cc=rplsssn@codeaurora.org \
--cc=sboyd@kernel.org \
/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