All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evan Green <evgreen@chromium.org>
To: Lina Iyer <ilina@codeaurora.org>
Cc: Andy Gross <andy.gross@linaro.org>,
	David Brown <david.brown@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
	Rajendra Nayak <rnayak@codeaurora.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 05/10] drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS
Date: Fri, 16 Feb 2018 15:50:29 -0800	[thread overview]
Message-ID: <CAE=gft5vEa69ML7mu=-=dg8Djb5dGdbs01PnwAYcJmSPioNasg@mail.gmail.com> (raw)
In-Reply-To: <20180215173507.10989-6-ilina@codeaurora.org>

Hello Lina,

On Thu, Feb 15, 2018 at 9:35 AM, Lina Iyer <ilina@codeaurora.org> wrote:
> Sleep and wake requests are sent when the application processor
> subsystem of the SoC is entering deep sleep states like in suspend.
> These requests help lower the system power requirements when the
> resources are not in use.
>
> Sleep and wake requests are written to the TCS slots but are not
> triggered at the time of writing. The TCS are triggered by the firmware
> after the last of the CPUs has executed its WFI. Since these requests
> may come in different batches of requests, it is job of this controller
> driver to find arrange the requests into the available TCSes.
>
> Signed-off-by: Lina Iyer <ilina@codeaurora.org>
> ---
>  drivers/soc/qcom/rpmh-internal.h |   7 +++
>  drivers/soc/qcom/rpmh-rsc.c      | 126 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 133 insertions(+)
>
[...]
> +static int find_slots(struct tcs_group *tcs, struct tcs_request *msg,
> +                    int *m, int *n)
> +{
> +       int slot, offset;
> +       int i = 0;
> +
> +       /* Find if we already have the msg in our TCS */
> +       slot = find_match(tcs, msg->payload, msg->num_payload);
> +       if (slot >= 0)
> +               goto copy_data;
> +
> +       /* Do over, until we can fit the full payload in a TCS */
> +       do {
> +               slot = bitmap_find_next_zero_area(tcs->slots, MAX_TCS_SLOTS,
> +                                                i, msg->num_payload, 0);
> +               if (slot == MAX_TCS_SLOTS)
> +                       break;
> +               i += tcs->ncpt;
> +       } while (slot + msg->num_payload - 1 >= i);
> +
> +       if (slot == MAX_TCS_SLOTS)
> +               return -ENOMEM;
> +
> +copy_data:
> +       bitmap_set(tcs->slots, slot, msg->num_payload);
> +       /* Copy the addresses of the resources over to the slots */
> +       for (i = 0; tcs->cmd_addr && i < msg->num_payload; i++)

I don't think tcs->cmd_addr can be null, can it? Above, find_match()
is already reaching through cmd_addr with enthusiasm. If kept, it
could at least be moved outside of the loop.

Evan

  reply	other threads:[~2018-02-16 23:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 17:34 [PATCH v2 00/10] drivers/qcom: add RPMH communication support Lina Iyer
2018-02-15 17:34 ` [PATCH v2 01/10] drivers: qcom: rpmh-rsc: add RPMH controller for QCOM SoCs Lina Iyer
2018-02-16 21:29   ` Evan Green
2018-02-16 23:51     ` Lina Iyer
2018-02-15 17:34 ` [PATCH v2 02/10] dt-bindings: introduce RPMH RSC bindings for Qualcomm SoCs Lina Iyer
2018-02-19 15:58   ` Rob Herring
2018-02-15 17:35 ` [PATCH v2 03/10] drivers: qcom: rpmh-rsc: log RPMH requests in FTRACE Lina Iyer
2018-02-15 19:57   ` Steven Rostedt
2018-02-15 20:38     ` Lina Iyer
2018-02-15 20:41   ` Lina Iyer
2018-02-15 20:51     ` Steven Rostedt
2018-02-15 20:55       ` Lina Iyer
2018-02-18 11:27   ` kbuild test robot
2018-02-15 17:35 ` [PATCH v2 04/10] drivers: qcom: rpmh: add RPMH helper functions Lina Iyer
2018-02-15 17:35 ` [PATCH v2 05/10] drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS Lina Iyer
2018-02-16 23:50   ` Evan Green [this message]
2018-02-20 16:03     ` Lina Iyer
2018-02-15 17:35 ` [PATCH v2 06/10] drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS Lina Iyer
2018-02-15 17:35 ` [PATCH v2 07/10] drivers: qcom: rpmh: cache sleep/wake state requests Lina Iyer
2018-02-21 22:07   ` Evan Green
2018-02-22 16:58     ` Lina Iyer
2018-02-22 23:41       ` Evan Green
2018-02-15 17:35 ` [PATCH v2 08/10] drivers: qcom: rpmh: allow requests to be sent asynchronously Lina Iyer
2018-02-15 17:35 ` [PATCH v2 09/10] drivers: qcom: rpmh: add support for batch RPMH request Lina Iyer
2018-02-21 23:24   ` Evan Green
2018-02-22 17:04     ` Lina Iyer
2018-02-22 23:45       ` Evan Green
2018-02-15 17:35 ` [PATCH v2 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS 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='CAE=gft5vEa69ML7mu=-=dg8Djb5dGdbs01PnwAYcJmSPioNasg@mail.gmail.com' \
    --to=evgreen@chromium.org \
    --cc=andy.gross@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=david.brown@linaro.org \
    --cc=ilina@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=rnayak@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.