public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dmaengine: fsl-edma: Do not suspend and resume the masked dma channel when the system is sleeping
@ 2023-11-13 13:11 Xiaolei Wang
  2023-11-13 13:11 ` [PATCH 2/2] dmaengine: fsl-edma: Add judgment on enabling round robin arbitration Xiaolei Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaolei Wang @ 2023-11-13 13:11 UTC (permalink / raw)
  To: Frank.Li, vkoul; +Cc: imx, dmaengine, linux-kernel

Some channels may be masked. When the system is suspended,
if these masked channels are not filtered out, this will
lead to null pointer operations and system crash:

Unable to handle kernel NULL pointer dereference at virtual address
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=0000000894300000
[00000000000002a0] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 989 Comm: sh Tainted: G B 6.6.0-16203-g557fb7a3ec4c-dirty #70
Hardware name: Freescale i.MX8QM MEK (DT)
pstate: 400000c5 (nZcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
  pc: fsl_edma_disable_request+0x3c/0x78
  lr: fsl_edma_disable_request+0x3c/0x78
  sp:ffff800089ae7690
  x29: ffff800089ae7690 x28: ffff000807ab5440 x27: ffff000807ab5830
  x26: 0000000000000008 x25: 0000000000000278 x24: 0000000000000001
  23: ffff000807ab4328 x22: 0000000000000000 x21: 0000000000000009
  x20: ffff800082616940 x19: 0000000000000000 x18: 0000000000000000
  x17: 3d3d3d3d3d3d3d3d x16: 3d3d3d3d3d3d3d3d x15: 3d3d3d3d3d3d3d3d
  x14: 3d3d3d3d3d3d3d3d x13: 3d3d3d3d3d3d3d3d x12: 1ffff00010d45724
  x11: ffff700010d45724 x10: dfff800000000000 x9: dfff800000000000
  x8: 00008fffef2ba8dc x7: 0000000000000001 x6: ffff800086a2b927
  x5: ffff800086a2b920 x4: ffff700010d45725 x3: ffff8000800d5bbc
  x2 : 0000000000000000 x1 : ffff000800c1d880 x0 : 0000000000000001
  Call trace:
   fsl_edma_disable_request+0x3c/0x78
   fsl_edma_suspend_late+0x128/0x12c
  dpm_run_callback+0xd4/0x304
   __device_suspend_late+0xd0/0x240
  dpm_suspend_late+0x174/0x59c
  suspend_devices_and_enter+0x194/0xd00
  pm_suspend+0x3c4/0x910

Fixes: 82d149b86d31 ("dmaengine: fsl-edma: add PM suspend/resume support")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
 drivers/dma/fsl-edma-main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 4635e16d7705..52577fffc62b 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -631,6 +631,8 @@ static int fsl_edma_suspend_late(struct device *dev)
 
 	for (i = 0; i < fsl_edma->n_chans; i++) {
 		fsl_chan = &fsl_edma->chans[i];
+		if (fsl_edma->chan_masked & BIT(i))
+			continue;
 		spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
 		/* Make sure chan is idle or will force disable. */
 		if (unlikely(!fsl_chan->idle)) {
@@ -655,6 +657,8 @@ static int fsl_edma_resume_early(struct device *dev)
 
 	for (i = 0; i < fsl_edma->n_chans; i++) {
 		fsl_chan = &fsl_edma->chans[i];
+		if (fsl_edma->chan_masked & BIT(i))
+			continue;
 		fsl_chan->pm_state = RUNNING;
 		edma_write_tcdreg(fsl_chan, 0, csr);
 		if (fsl_chan->slave_id != 0)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] dmaengine: fsl-edma: Add judgment on enabling round robin arbitration
  2023-11-13 13:11 [PATCH 1/2] dmaengine: fsl-edma: Do not suspend and resume the masked dma channel when the system is sleeping Xiaolei Wang
@ 2023-11-13 13:11 ` Xiaolei Wang
  2023-11-13 15:15   ` Frank Li
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaolei Wang @ 2023-11-13 13:11 UTC (permalink / raw)
  To: Frank.Li, vkoul; +Cc: imx, dmaengine, linux-kernel

Add judgment on enabling round robin arbitration to avoid
exceptions if this function is not supported.

Call trace:
 fsl_edma_resume_early+0x1d4/0x208
 dpm_run_callback+0xd4/0x304
 device_resume_early+0xb0/0x208
 dpm_resume_early+0x224/0x528
 suspend_devices_and_enter+0x3e4/0xd00
 pm_suspend+0x3c4/0x910
 state_store+0x90/0x124
 kobj_attr_store+0x48/0x64
 sysfs_kf_write+0x84/0xb4
 kernfs_fop_write_iter+0x19c/0x264
 vfs_write+0x664/0x858
 ksys_write+0xc8/0x180
 __arm64_sys_write+0x44/0x58
 invoke_syscall+0x5c/0x178
 el0_svc_common.constprop.0+0x11c/0x14c
 do_el0_svc+0x30/0x40
 el0_svc+0x58/0xa8
 el0t_64_sync_handler+0xc0/0xc4
 el0t_64_sync+0x190/0x194

Fixes: 82d149b86d31 ("dmaengine: fsl-edma: add PM suspend/resume support")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
 drivers/dma/fsl-edma-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 52577fffc62b..aea7a703dda7 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -665,7 +665,8 @@ static int fsl_edma_resume_early(struct device *dev)
 			fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true);
 	}
 
-	edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
+	if (!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_SPLIT_REG))
+		edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
 
 	return 0;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] dmaengine: fsl-edma: Add judgment on enabling round robin arbitration
  2023-11-13 13:11 ` [PATCH 2/2] dmaengine: fsl-edma: Add judgment on enabling round robin arbitration Xiaolei Wang
@ 2023-11-13 15:15   ` Frank Li
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Li @ 2023-11-13 15:15 UTC (permalink / raw)
  To: Xiaolei Wang; +Cc: vkoul, imx, dmaengine, linux-kernel

On Mon, Nov 13, 2023 at 09:11:05PM +0800, Xiaolei Wang wrote:
> Add judgment on enabling round robin arbitration to avoid
> exceptions if this function is not supported.
> 
> Call trace:
>  fsl_edma_resume_early+0x1d4/0x208
>  dpm_run_callback+0xd4/0x304
>  device_resume_early+0xb0/0x208
>  dpm_resume_early+0x224/0x528
>  suspend_devices_and_enter+0x3e4/0xd00
>  pm_suspend+0x3c4/0x910
>  state_store+0x90/0x124
>  kobj_attr_store+0x48/0x64
>  sysfs_kf_write+0x84/0xb4
>  kernfs_fop_write_iter+0x19c/0x264
>  vfs_write+0x664/0x858
>  ksys_write+0xc8/0x180
>  __arm64_sys_write+0x44/0x58
>  invoke_syscall+0x5c/0x178
>  el0_svc_common.constprop.0+0x11c/0x14c
>  do_el0_svc+0x30/0x40
>  el0_svc+0x58/0xa8
>  el0t_64_sync_handler+0xc0/0xc4
>  el0t_64_sync+0x190/0x194
> 
> Fixes: 82d149b86d31 ("dmaengine: fsl-edma: add PM suspend/resume support")

It should be 
Fixes: 72f5801a4e2b7 ("dmaengine: fsl-edma: integrate v3 support")

FSL_EDMA_DRV_SPLIT_REG is added at above commit.

The same to the second patch.

Frank

> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
> ---
>  drivers/dma/fsl-edma-main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index 52577fffc62b..aea7a703dda7 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -665,7 +665,8 @@ static int fsl_edma_resume_early(struct device *dev)
>  			fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true);
>  	}
>  
> -	edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
> +	if (!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_SPLIT_REG))
> +		edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
>  
>  	return 0;
>  }
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-13 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13 13:11 [PATCH 1/2] dmaengine: fsl-edma: Do not suspend and resume the masked dma channel when the system is sleeping Xiaolei Wang
2023-11-13 13:11 ` [PATCH 2/2] dmaengine: fsl-edma: Add judgment on enabling round robin arbitration Xiaolei Wang
2023-11-13 15:15   ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox