diff mbox series

[v14,10/12] remoteproc: mediatek: Report watchdog crash to all cores

Message ID 20230707052612.27521-11-tinghan.shen@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add support for MT8195 SCP 2nd core | expand

Commit Message

Tinghan Shen July 7, 2023, 5:26 a.m. UTC
Once the SCP watchdog timeout happened, trigger the rproc recovery flow on
all cores.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
---
 drivers/remoteproc/mtk_scp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Mathieu Poirier July 12, 2023, 7:38 p.m. UTC | #1
On Fri, Jul 07, 2023 at 01:26:10PM +0800, Tinghan Shen wrote:
> Once the SCP watchdog timeout happened, trigger the rproc recovery flow on
> all cores.
> 

You are missing the most important part... "Why" is this needed?  Without it I
don't know what is going on and can't review your work.

> Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
> ---
>  drivers/remoteproc/mtk_scp.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 9fed5161f094..7e786aaf04e1 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -80,8 +80,14 @@ EXPORT_SYMBOL_GPL(scp_put);
>  
>  static void scp_wdt_handler(struct mtk_scp *scp, u32 scp_to_host)
>  {
> +	struct mtk_scp_of_cluster *scp_cluster = platform_get_drvdata(scp->cluster_pdev);
> +	struct mtk_scp *scp_node;
> +
>  	dev_err(scp->dev, "SCP watchdog timeout! 0x%x", scp_to_host);
> -	rproc_report_crash(scp->rproc, RPROC_WATCHDOG);
> +
> +	/* report watchdog timeout to all cores */
> +	list_for_each_entry(scp_node, &scp_cluster->mtk_scp_list, elem)
> +		rproc_report_crash(scp_node->rproc, RPROC_WATCHDOG);
>  }
>  
>  static void scp_init_ipi_handler(void *data, unsigned int len, void *priv)
> -- 
> 2.18.0
>
Tinghan Shen July 13, 2023, 8:01 a.m. UTC | #2
Hi Mathieu,

On Wed, 2023-07-12 at 13:38 -0600, Mathieu Poirier wrote:
> On Fri, Jul 07, 2023 at 01:26:10PM +0800, Tinghan Shen wrote:
> > Once the SCP watchdog timeout happened, trigger the rproc recovery flow on
> > all cores.
> > 
> 
> You are missing the most important part... "Why" is this needed?  Without it I
> don't know what is going on and can't review your work.

Sorry, I'll improve the commit message.

I think that the SCP should have the same behavior as an SMP system. In the event
of a watchdog timeout occuring on any of the cores, the entire SCP should be recovered.


> 
> > Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
> > ---
> >  drivers/remoteproc/mtk_scp.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> > index 9fed5161f094..7e786aaf04e1 100644
> > --- a/drivers/remoteproc/mtk_scp.c
> > +++ b/drivers/remoteproc/mtk_scp.c
> > @@ -80,8 +80,14 @@ EXPORT_SYMBOL_GPL(scp_put);
> >  
> >  static void scp_wdt_handler(struct mtk_scp *scp, u32 scp_to_host)
> >  {
> > +	struct mtk_scp_of_cluster *scp_cluster = platform_get_drvdata(scp->cluster_pdev);
> > +	struct mtk_scp *scp_node;
> > +
> >  	dev_err(scp->dev, "SCP watchdog timeout! 0x%x", scp_to_host);
> > -	rproc_report_crash(scp->rproc, RPROC_WATCHDOG);
> > +
> > +	/* report watchdog timeout to all cores */
> > +	list_for_each_entry(scp_node, &scp_cluster->mtk_scp_list, elem)
> > +		rproc_report_crash(scp_node->rproc, RPROC_WATCHDOG);
> >  }
> >  
> >  static void scp_init_ipi_handler(void *data, unsigned int len, void *priv)
> > -- 
> > 2.18.0
diff mbox series

Patch

diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 9fed5161f094..7e786aaf04e1 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -80,8 +80,14 @@  EXPORT_SYMBOL_GPL(scp_put);
 
 static void scp_wdt_handler(struct mtk_scp *scp, u32 scp_to_host)
 {
+	struct mtk_scp_of_cluster *scp_cluster = platform_get_drvdata(scp->cluster_pdev);
+	struct mtk_scp *scp_node;
+
 	dev_err(scp->dev, "SCP watchdog timeout! 0x%x", scp_to_host);
-	rproc_report_crash(scp->rproc, RPROC_WATCHDOG);
+
+	/* report watchdog timeout to all cores */
+	list_for_each_entry(scp_node, &scp_cluster->mtk_scp_list, elem)
+		rproc_report_crash(scp_node->rproc, RPROC_WATCHDOG);
 }
 
 static void scp_init_ipi_handler(void *data, unsigned int len, void *priv)