Thread (16 messages) 16 messages, 3 authors, 2022-10-13

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

From: Peng Fan <hidden>
Date: 2022-09-29 23:21:10
Also in: linux-devicetree, linux-remoteproc, lkml

Hi Mathieu,

This patch is an incremental patch that could ignored, if you not have 
time or think this patch is not in good shape. Patch 1-6 is
to achieve same as V5 patchset [1].

[1]https://lore.kernel.org/linux-remoteproc/DU0PR04MB941763C3EBF8AE9A9CD69445884C9@DU0PR04MB9417.eurprd04.prod.outlook.com/T/#md2af773bc7f251efbe8ca011b5a70ba2193b4c01 (local)

Thanks,
Peng.
On 9/29/2022 2:17 PM, Peng Fan (OSS) wrote:
quoted hunk ↗ jump to hunk
From: Peng Fan <peng.fan@nxp.com>

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@nxp.com>
---
  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);
+
+	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);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help