linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: rishabhb@codeaurora.org
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Andy Gross <agross@kernel.org>, Ohad Ben-Cohen <ohad@wizery.com>,
	Siddharth Gupta <sidgup@codeaurora.org>,
	Sibi Sankar <sibis@codeaurora.org>,
	linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] remoteproc: qcom: q6v5: Query sysmon before graceful shutdown
Date: Tue, 10 Nov 2020 17:03:27 -0800	[thread overview]
Message-ID: <9b917882cc9191bbfadc69dbcb067f6b@codeaurora.org> (raw)
In-Reply-To: <20201105045051.1365780-4-bjorn.andersson@linaro.org>

On 2020-11-04 20:50, Bjorn Andersson wrote:
> Requesting a graceful shutdown through the shared memory state signals
> will not be acked in the event that sysmon has already successfully 
> shut
> down the remote firmware. So extend the stop request API to optinally
optionally
> take the remoteproc's sysmon instance and query if there's already been
> a successful shutdown attempt, before doing the signal dance.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> 
> Changes since v1:
> - New patch
> 
>  drivers/remoteproc/qcom_q6v5.c      | 8 +++++++-
>  drivers/remoteproc/qcom_q6v5.h      | 3 ++-
>  drivers/remoteproc/qcom_q6v5_adsp.c | 2 +-
>  drivers/remoteproc/qcom_q6v5_mss.c  | 2 +-
>  drivers/remoteproc/qcom_q6v5_pas.c  | 2 +-
>  drivers/remoteproc/qcom_q6v5_wcss.c | 2 +-
>  6 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/remoteproc/qcom_q6v5.c 
> b/drivers/remoteproc/qcom_q6v5.c
> index fd6fd36268d9..9627a950928e 100644
> --- a/drivers/remoteproc/qcom_q6v5.c
> +++ b/drivers/remoteproc/qcom_q6v5.c
> @@ -13,6 +13,7 @@
>  #include <linux/soc/qcom/smem.h>
>  #include <linux/soc/qcom/smem_state.h>
>  #include <linux/remoteproc.h>
> +#include "qcom_common.h"
>  #include "qcom_q6v5.h"
> 
>  #define Q6V5_PANIC_DELAY_MS	200
> @@ -146,15 +147,20 @@ static irqreturn_t q6v5_stop_interrupt(int irq,
> void *data)
>  /**
>   * qcom_q6v5_request_stop() - request the remote processor to stop
>   * @q6v5:	reference to qcom_q6v5 context
> + * @sysmon:	reference to the remote's sysmon instance, or NULL
>   *
>   * Return: 0 on success, negative errno on failure
>   */
> -int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5)
> +int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5, struct qcom_sysmon 
> *sysmon)
>  {
>  	int ret;
> 
>  	q6v5->running = false;
> 
> +	/* Don't perform SMP2P dance if sysmon already shut down the remote 
> */
> +	if (qcom_sysmon_shutdown_acked(sysmon))
> +		return 0;
> +
>  	qcom_smem_state_update_bits(q6v5->state,
>  				    BIT(q6v5->stop_bit), BIT(q6v5->stop_bit));
> 
> diff --git a/drivers/remoteproc/qcom_q6v5.h 
> b/drivers/remoteproc/qcom_q6v5.h
> index c4ed887c1499..1c212f670cbc 100644
> --- a/drivers/remoteproc/qcom_q6v5.h
> +++ b/drivers/remoteproc/qcom_q6v5.h
> @@ -8,6 +8,7 @@
> 
>  struct rproc;
>  struct qcom_smem_state;
> +struct qcom_sysmon;
> 
>  struct qcom_q6v5 {
>  	struct device *dev;
> @@ -40,7 +41,7 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct
> platform_device *pdev,
> 
>  int qcom_q6v5_prepare(struct qcom_q6v5 *q6v5);
>  int qcom_q6v5_unprepare(struct qcom_q6v5 *q6v5);
> -int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5);
> +int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5, struct qcom_sysmon 
> *sysmon);
>  int qcom_q6v5_wait_for_start(struct qcom_q6v5 *q6v5, int timeout);
>  unsigned long qcom_q6v5_panic(struct qcom_q6v5 *q6v5);
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c
> b/drivers/remoteproc/qcom_q6v5_adsp.c
> index efb2c1aa80a3..9db0380236e7 100644
> --- a/drivers/remoteproc/qcom_q6v5_adsp.c
> +++ b/drivers/remoteproc/qcom_q6v5_adsp.c
> @@ -264,7 +264,7 @@ static int adsp_stop(struct rproc *rproc)
>  	int handover;
>  	int ret;
> 
> -	ret = qcom_q6v5_request_stop(&adsp->q6v5);
> +	ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon);
>  	if (ret == -ETIMEDOUT)
>  		dev_err(adsp->dev, "timed out on wait\n");
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_mss.c
> b/drivers/remoteproc/qcom_q6v5_mss.c
> index 9a473cfef758..501764934014 100644
> --- a/drivers/remoteproc/qcom_q6v5_mss.c
> +++ b/drivers/remoteproc/qcom_q6v5_mss.c
> @@ -1370,7 +1370,7 @@ static int q6v5_stop(struct rproc *rproc)
>  	struct q6v5 *qproc = (struct q6v5 *)rproc->priv;
>  	int ret;
> 
> -	ret = qcom_q6v5_request_stop(&qproc->q6v5);
> +	ret = qcom_q6v5_request_stop(&qproc->q6v5, qproc->sysmon);
>  	if (ret == -ETIMEDOUT)
>  		dev_err(qproc->dev, "timed out on wait\n");
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c
> b/drivers/remoteproc/qcom_q6v5_pas.c
> index 3837f23995e0..ed1772bfa55d 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -214,7 +214,7 @@ static int adsp_stop(struct rproc *rproc)
>  	int handover;
>  	int ret;
> 
> -	ret = qcom_q6v5_request_stop(&adsp->q6v5);
> +	ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon);
>  	if (ret == -ETIMEDOUT)
>  		dev_err(adsp->dev, "timed out on wait\n");
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c
> b/drivers/remoteproc/qcom_q6v5_wcss.c
> index 8846ef0b0f1a..d6639856069b 100644
> --- a/drivers/remoteproc/qcom_q6v5_wcss.c
> +++ b/drivers/remoteproc/qcom_q6v5_wcss.c
> @@ -390,7 +390,7 @@ static int q6v5_wcss_stop(struct rproc *rproc)
>  	int ret;
> 
>  	/* WCSS powerdown */
> -	ret = qcom_q6v5_request_stop(&wcss->q6v5);
> +	ret = qcom_q6v5_request_stop(&wcss->q6v5, wcss->sysmon);
>  	if (ret == -ETIMEDOUT) {
>  		dev_err(wcss->dev, "timed out on wait\n");
>  		return ret;
Reviewed-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>

  reply	other threads:[~2020-11-11  1:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05  4:50 [PATCH v2 0/4] remoteproc: Improvement for the Qualcomm sysmon Bjorn Andersson
2020-11-05  4:50 ` [PATCH v2 1/4] remoteproc: sysmon: Ensure remote notification ordering Bjorn Andersson
2020-11-11  0:57   ` rishabhb
2020-11-11  5:40     ` Bjorn Andersson
2020-11-05  4:50 ` [PATCH v2 2/4] remoteproc: sysmon: Expose the shutdown result Bjorn Andersson
2020-11-11  1:01   ` rishabhb
2020-11-05  4:50 ` [PATCH v2 3/4] remoteproc: qcom: q6v5: Query sysmon before graceful shutdown Bjorn Andersson
2020-11-11  1:03   ` rishabhb [this message]
2020-11-05  4:50 ` [PATCH v2 4/4] remoteproc: sysmon: Improve error messages Bjorn Andersson
2020-11-11  1:04   ` rishabhb
2020-11-12 18:00 ` [PATCH v2 0/4] remoteproc: Improvement for the Qualcomm sysmon Steev Klimaszewski

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=9b917882cc9191bbfadc69dbcb067f6b@codeaurora.org \
    --to=rishabhb@codeaurora.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.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 \
    --cc=sidgup@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).