mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Iuliana Prodan <iuliana.prodan@nxp.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
	Shengjiu Wang <shengjiu.wang@nxp.com>,
	daniel.baluta@nxp.com
Cc: andersson@kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-remoteproc@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] remoteproc: imx_dsp_rproc: Add support of recovery process
Date: Fri, 11 Jul 2025 10:54:41 +0300	[thread overview]
Message-ID: <71b45ffd-b554-4369-b988-860bdcfe4ee3@nxp.com> (raw)
In-Reply-To: <aG_SosukEqUxrHvH@p14s>

Hello Mathieu, Shengjiu,

On 7/10/2025 5:48 PM, Mathieu Poirier wrote:
> On Fri, Jul 04, 2025 at 01:25:28PM +0800, Shengjiu Wang wrote:
>> When recovery is triggered, rproc_stop() is called first then
>> rproc_start(), but there is no rproc_unprepare_device() and
>> rproc_prepare_device() in the flow. As the software reset is needed
>> before DSP starts, so move software reset from imx_dsp_runtime_resume()
>> to .load() to make the recovery work. And make sure memory is cleared
>> before loading firmware.
>>
>> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
>> ---
>>   drivers/remoteproc/imx_dsp_rproc.c | 43 +++++++++++++++++++-----------
>>   1 file changed, 27 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
>> index 5ee622bf5352..ba764fc55686 100644
>> --- a/drivers/remoteproc/imx_dsp_rproc.c
>> +++ b/drivers/remoteproc/imx_dsp_rproc.c
>> @@ -774,7 +774,6 @@ static int imx_dsp_rproc_prepare(struct rproc *rproc)
>>   {
>>   	struct imx_dsp_rproc *priv = rproc->priv;
>>   	struct device *dev = rproc->dev.parent;
>> -	struct rproc_mem_entry *carveout;
>>   	int ret;
>>   
>>   	ret = imx_dsp_rproc_add_carveout(priv);
>> @@ -785,15 +784,6 @@ static int imx_dsp_rproc_prepare(struct rproc *rproc)
>>   
>>   	pm_runtime_get_sync(dev);
>>   
>> -	/*
>> -	 * Clear buffers after pm rumtime for internal ocram is not
>> -	 * accessible if power and clock are not enabled.
>> -	 */
>> -	list_for_each_entry(carveout, &rproc->carveouts, node) {
>> -		if (carveout->va)
>> -			memset(carveout->va, 0, carveout->len);
>> -	}
>> -
>>   	return  0;
>>   }
>>   
>> @@ -1022,13 +1012,39 @@ static int imx_dsp_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw
>>   	return 0;
>>   }
>>   
>> +static int imx_dsp_rproc_load(struct rproc *rproc, const struct firmware *fw)
>> +{
>> +	struct imx_dsp_rproc *priv = rproc->priv;
>> +	const struct imx_dsp_rproc_dcfg *dsp_dcfg = priv->dsp_dcfg;
>> +	struct rproc_mem_entry *carveout;
>> +	int ret;
>> +
>> +	/* Reset DSP if needed */
>> +	if (dsp_dcfg->reset)
>> +		dsp_dcfg->reset(priv);
>> +	/*
>> +	 * Clear buffers after pm rumtime for internal ocram is not
>> +	 * accessible if power and clock are not enabled.
>> +	 */
>> +	list_for_each_entry(carveout, &rproc->carveouts, node) {
>> +		if (carveout->va)
>> +			memset(carveout->va, 0, carveout->len);
>> +	}
>> +
>> +	ret = imx_dsp_rproc_elf_load_segments(rproc, fw);
>> +	if (ret)
>> +		return ret;
>> +
>> +	return 0;
>> +}
>> +
> 
> This is a much better approach.  During my last review I said that I would not
> move forward with this work until Daniel or Iuliana provide their R-B and yet,
> they have not been added to the recipient list.
> 

I will have a look at this patchset at the beginning of next week.
I also plan to test it.

Iulia

>>   static const struct rproc_ops imx_dsp_rproc_ops = {
>>   	.prepare	= imx_dsp_rproc_prepare,
>>   	.unprepare	= imx_dsp_rproc_unprepare,
>>   	.start		= imx_dsp_rproc_start,
>>   	.stop		= imx_dsp_rproc_stop,
>>   	.kick		= imx_dsp_rproc_kick,
>> -	.load		= imx_dsp_rproc_elf_load_segments,
>> +	.load		= imx_dsp_rproc_load,
>>   	.parse_fw	= imx_dsp_rproc_parse_fw,
>>   	.handle_rsc	= imx_dsp_rproc_handle_rsc,
>>   	.find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
>> @@ -1214,7 +1230,6 @@ static int imx_dsp_runtime_resume(struct device *dev)
>>   {
>>   	struct rproc *rproc = dev_get_drvdata(dev);
>>   	struct imx_dsp_rproc *priv = rproc->priv;
>> -	const struct imx_dsp_rproc_dcfg *dsp_dcfg = priv->dsp_dcfg;
>>   	int ret;
>>   
>>   	/*
>> @@ -1235,10 +1250,6 @@ static int imx_dsp_runtime_resume(struct device *dev)
>>   		return ret;
>>   	}
>>   
>> -	/* Reset DSP if needed */
>> -	if (dsp_dcfg->reset)
>> -		dsp_dcfg->reset(priv);
>> -
>>   	return 0;
>>   }
>>   
>> -- 
>> 2.34.1
>>


  reply	other threads:[~2025-07-11  7:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04  5:25 [PATCH v2 0/2] remoteproc: imx_dsp_rproc: Add coredump and recovery support Shengjiu Wang
2025-07-04  5:25 ` [PATCH v2 1/2] remoteproc: imx_dsp_rproc: Add support of recovery process Shengjiu Wang
2025-07-10 14:48   ` Mathieu Poirier
2025-07-11  7:54     ` Iuliana Prodan [this message]
2025-07-11 10:22     ` Daniel Baluta
2025-07-18 11:00   ` Daniel Baluta
2025-07-21  9:08     ` Shengjiu Wang
2025-07-04  5:25 ` [PATCH v2 2/2] remoteproc: imx_dsp_rproc: Add support of coredump Shengjiu Wang
2025-07-10 14:49   ` Mathieu Poirier

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=71b45ffd-b554-4369-b988-860bdcfe4ee3@nxp.com \
    --to=iuliana.prodan@nxp.com \
    --cc=andersson@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=shengjiu.wang@nxp.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

all inboxes | Powered by JetHome®