From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Sibi Sankar <sibis@codeaurora.org>
Cc: ohad@wizery.com, clew@codeaurora.org,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] remoteproc: Proxy unvote clk/regs in handover context
Date: Fri, 18 May 2018 12:58:45 -0700 [thread overview]
Message-ID: <20180518195845.GS14924@minitux> (raw)
In-Reply-To: <20180425145025.21654-1-sibis@codeaurora.org>
On Wed 25 Apr 07:50 PDT 2018, Sibi Sankar wrote:
> Introduce interrupt handler for smp2p ready interrupt and
> handle start completion. Remove the proxy votes for clocks
> and regulators in the handover interrupt context. Disable
> wdog and fatal interrupts on remoteproc device stop and
> re-enable them on remoteproc device start.
Can't the enable/disable dance be split out into a separate commit?
Making the introduction of them cleaner in the git history?
>
> Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
> ---
> drivers/remoteproc/qcom_q6v5_pil.c | 71 +++++++++++++++++++++++++-----
> 1 file changed, 60 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
> index 296eb3f8b551..7e2d04d4f2f0 100644
> --- a/drivers/remoteproc/qcom_q6v5_pil.c
> +++ b/drivers/remoteproc/qcom_q6v5_pil.c
> @@ -143,6 +143,10 @@ struct q6v5 {
> struct qcom_smem_state *state;
> unsigned stop_bit;
>
> + unsigned int handover_interrupt;
> + unsigned int wdog_interrupt;
> + unsigned int fatal_interrupt;
Make these "int", and write "irq" instead of "interrupt".
> +
> struct clk *active_clks[8];
> struct clk *proxy_clks[4];
> int active_clk_count;
> @@ -170,6 +174,7 @@ struct q6v5 {
> struct qcom_rproc_ssr ssr_subdev;
> struct qcom_sysmon *sysmon;
> bool need_mem_protection;
> + bool unvoted_flag;
> int mpss_perm;
> int mba_perm;
> int version;
> @@ -727,6 +732,7 @@ static int q6v5_start(struct rproc *rproc)
> int xfermemop_ret;
> int ret;
>
> + qproc->unvoted_flag = false;
> ret = q6v5_regulator_enable(qproc, qproc->proxy_regs,
> qproc->proxy_reg_count);
> if (ret) {
> @@ -793,9 +799,16 @@ static int q6v5_start(struct rproc *rproc)
> if (ret)
> goto reclaim_mpss;
>
> + enable_irq(qproc->handover_interrupt);
> + enable_irq(qproc->wdog_interrupt);
> + enable_irq(qproc->fatal_interrupt);
> +
> ret = wait_for_completion_timeout(&qproc->start_done,
> msecs_to_jiffies(5000));
> if (ret == 0) {
> + disable_irq(qproc->handover_interrupt);
> + disable_irq(qproc->wdog_interrupt);
> + disable_irq(qproc->fatal_interrupt);
> dev_err(qproc->dev, "start timed out\n");
> ret = -ETIMEDOUT;
> goto reclaim_mpss;
> @@ -809,11 +822,6 @@ static int q6v5_start(struct rproc *rproc)
> "Failed to reclaim mba buffer system may become unstable\n");
> qproc->running = true;
>
> - q6v5_clk_disable(qproc->dev, qproc->proxy_clks,
> - qproc->proxy_clk_count);
> - q6v5_regulator_disable(qproc, qproc->proxy_regs,
> - qproc->proxy_reg_count);
> -
> return 0;
>
> reclaim_mpss:
> @@ -892,6 +900,16 @@ static int q6v5_stop(struct rproc *rproc)
> WARN_ON(ret);
>
> reset_control_assert(qproc->mss_restart);
> + disable_irq(qproc->handover_interrupt);
> + if (!qproc->unvoted_flag) {
> + q6v5_clk_disable(qproc->dev, qproc->proxy_clks,
> + qproc->proxy_clk_count);
> + q6v5_regulator_disable(qproc, qproc->proxy_regs,
> + qproc->proxy_reg_count);
> + }
Perhaps break this out into a separate function and call it from the two
places?
> + disable_irq(qproc->wdog_interrupt);
> + disable_irq(qproc->fatal_interrupt);
Any particular reason why you didn't group the disable_irq() calls
together? Would look prettier than spreading them on each side of the
resource disable.
> +
> q6v5_clk_disable(qproc->dev, qproc->active_clks,
> qproc->active_clk_count);
> q6v5_regulator_disable(qproc, qproc->active_regs,
[..]
> @@ -1184,19 +1221,31 @@ static int q6v5_probe(struct platform_device *pdev)
>
> qproc->version = desc->version;
> qproc->need_mem_protection = desc->need_mem_protection;
> - ret = q6v5_request_irq(qproc, pdev, "wdog", q6v5_wdog_interrupt);
> + ret = q6v5_request_irq(qproc, pdev, "wdog", q6v5_wdog_interrupt,
> + &qproc->wdog_interrupt);
I think it's time to inline this function instead. You can omit the
first error handling and rely on request_irq to fail if you pass it an
invalid irq number.
> + if (ret < 0)
> + goto free_rproc;
> + disable_irq(qproc->wdog_interrupt);
I presume this is to balance the IRQ enable/disable later?
> +
Regards,
Bjorn
next prev parent reply other threads:[~2018-05-18 19:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-25 14:50 [PATCH] remoteproc: Proxy unvote clk/regs in handover context Sibi Sankar
2018-05-18 19:58 ` Bjorn Andersson [this message]
2018-05-21 16:49 ` Sibi S
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=20180518195845.GS14924@minitux \
--to=bjorn.andersson@linaro.org \
--cc=clew@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=sibis@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 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).