diff mbox series

dmaengine: ti: omap-dma: Skip pointless cpu_pm context restore on errors

Message ID 20210518074347.16908-1-tony@atomide.com (mailing list archive)
State New, archived
Headers show
Series dmaengine: ti: omap-dma: Skip pointless cpu_pm context restore on errors | expand

Commit Message

Tony Lindgren May 18, 2021, 7:43 a.m. UTC
There's no need to restore DMA context on CPU_CLUSTER_PM_ENTER_FAILED as
the DMA context won't be lost on errors.

Note that this does not cause invalid context restore as we already check
for busy DMA with omap_dma_busy() in CPU_CLUSTER_PM_ENTER, and block any
deeper idle states for the SoC by returning NOTIFY_BAD if busy.

If other drivers block deeper idle states with cpu_pm, we now just do a
pointless restore, but only if dma was not busy on CPU_CLUSTER_PM_ENTER.

Let's update the CPU_CLUSTER_PM_ENTER_FAILED handling for correctness,
and add a comment.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Adam Ford <aford173@gmail.com>
Cc: Andreas Kemnade <andreas@kemnade.info>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/dma/ti/omap-dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Péter Ujfalusi May 18, 2021, 11:36 a.m. UTC | #1
On 18/05/2021 10:43, Tony Lindgren wrote:
> There's no need to restore DMA context on CPU_CLUSTER_PM_ENTER_FAILED as
> the DMA context won't be lost on errors.
> 
> Note that this does not cause invalid context restore as we already check
> for busy DMA with omap_dma_busy() in CPU_CLUSTER_PM_ENTER, and block any
> deeper idle states for the SoC by returning NOTIFY_BAD if busy.
> 
> If other drivers block deeper idle states with cpu_pm, we now just do a
> pointless restore, but only if dma was not busy on CPU_CLUSTER_PM_ENTER.
> 
> Let's update the CPU_CLUSTER_PM_ENTER_FAILED handling for correctness,
> and add a comment.

Make sense,

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: Adam Ford <aford173@gmail.com>
> Cc: Andreas Kemnade <andreas@kemnade.info>
> Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/dma/ti/omap-dma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
> --- a/drivers/dma/ti/omap-dma.c
> +++ b/drivers/dma/ti/omap-dma.c
> @@ -1608,7 +1608,8 @@ static int omap_dma_context_notifier(struct notifier_block *nb,
>  			return NOTIFY_BAD;
>  		omap_dma_context_save(od);
>  		break;
> -	case CPU_CLUSTER_PM_ENTER_FAILED:
> +	case CPU_CLUSTER_PM_ENTER_FAILED:	/* No need to restore context */
> +		break;
>  	case CPU_CLUSTER_PM_EXIT:
>  		omap_dma_context_restore(od);
>  		break;
>
Vinod Koul May 31, 2021, 4:32 a.m. UTC | #2
On 18-05-21, 10:43, Tony Lindgren wrote:
> There's no need to restore DMA context on CPU_CLUSTER_PM_ENTER_FAILED as
> the DMA context won't be lost on errors.
> 
> Note that this does not cause invalid context restore as we already check
> for busy DMA with omap_dma_busy() in CPU_CLUSTER_PM_ENTER, and block any
> deeper idle states for the SoC by returning NOTIFY_BAD if busy.
> 
> If other drivers block deeper idle states with cpu_pm, we now just do a
> pointless restore, but only if dma was not busy on CPU_CLUSTER_PM_ENTER.
> 
> Let's update the CPU_CLUSTER_PM_ENTER_FAILED handling for correctness,
> and add a comment.

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
--- a/drivers/dma/ti/omap-dma.c
+++ b/drivers/dma/ti/omap-dma.c
@@ -1608,7 +1608,8 @@  static int omap_dma_context_notifier(struct notifier_block *nb,
 			return NOTIFY_BAD;
 		omap_dma_context_save(od);
 		break;
-	case CPU_CLUSTER_PM_ENTER_FAILED:
+	case CPU_CLUSTER_PM_ENTER_FAILED:	/* No need to restore context */
+		break;
 	case CPU_CLUSTER_PM_EXIT:
 		omap_dma_context_restore(od);
 		break;