Re: [PATCH V6 7/7] remoteproc: imx_rproc: Enable attach recovery for i.MX8QM/QXP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 29, 2022 at 02:17:04PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
> 
> i.MX8QM/QXP M4 could recover without help from Linux, so to support it:
>  - enable feature RPROC_FEAT_ATTACH_ON_RECOVERY
>  - add detach hook
>  - Since we have detach callback, we could move the free mbox operation
>  from partition reset notify to detach callback.
> 
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> ---
>  drivers/remoteproc/imx_rproc.c | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index bece44b46719..4057d6f33813 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -603,6 +603,22 @@ static int imx_rproc_attach(struct rproc *rproc)
>  	return imx_rproc_xtr_mbox_init(rproc);
>  }
>  
> +static int imx_rproc_detach(struct rproc *rproc)
> +{
> +	struct imx_rproc *priv = rproc->priv;
> +	const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> +
> +	if (dcfg->method != IMX_RPROC_SCU_API)
> +		return -EOPNOTSUPP;
> +
> +	if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id))
> +		return -EOPNOTSUPP;
> +
> +	imx_rproc_free_mbox(rproc);

Which is exactly what you did here.

I really don't understand what you did in patch 6/7...  Anyways, I suggest to
add support for the detached scenario and then fix the mailbox corruption
problem.

I am done reviewing this set.

> +
> +	return 0;
> +}
> +
>  static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz)
>  {
>  	struct imx_rproc *priv = rproc->priv;
> @@ -618,6 +634,7 @@ static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc
>  static const struct rproc_ops imx_rproc_ops = {
>  	.prepare	= imx_rproc_prepare,
>  	.attach		= imx_rproc_attach,
> +	.detach		= imx_rproc_detach,
>  	.start		= imx_rproc_start,
>  	.stop		= imx_rproc_stop,
>  	.kick		= imx_rproc_kick,
> @@ -797,8 +814,6 @@ static int imx_rproc_partition_notify(struct notifier_block *nb,
>  	if (!((event & BIT(priv->rproc_pt)) && (*(u8 *)group == IMX_SC_IRQ_GROUP_REBOOTED)))
>  		return 0;
>  
> -	imx_rproc_free_mbox(priv->rproc);
> -
>  	rproc_report_crash(priv->rproc, RPROC_WATCHDOG);
>  
>  	pr_info("Partition%d reset!\n", priv->rproc_pt);
> @@ -916,7 +931,8 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
>  		}
>  
>  		priv->rproc->state = RPROC_DETACHED;
> -		priv->rproc->recovery_disabled = true;
> +		priv->rproc->recovery_disabled = false;
> +		rproc_set_feature(priv->rproc, RPROC_FEAT_ATTACH_ON_RECOVERY);
>  
>  		/* Get partition id and enable irq in SCFW */
>  		ret = imx_sc_rm_get_resource_owner(priv->ipc_handle, priv->rsrc_id, &pt);
> -- 
> 2.37.1
> 



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux