All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] dmaengine: dw-edma: Fix unaligned 64bit access
@ 2022-02-25 12:02 Herve Codina
  2022-04-11 14:24 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Herve Codina @ 2022-02-25 12:02 UTC (permalink / raw)
  To: Gustavo Pimentel, Vinod Koul
  Cc: dmaengine, linux-kernel, Thomas Petazzoni, Herve Codina

On some arch (ie aarch64 iMX8MM) unaligned PCIe accesses are
not allowed and lead to a kernel Oops.
  [ 1911.668835] Unable to handle kernel paging request at virtual address ffff80001bc00a8c
  [ 1911.668841] Mem abort info:
  [ 1911.668844]   ESR = 0x96000061
  [ 1911.668847]   EC = 0x25: DABT (current EL), IL = 32 bits
  [ 1911.668850]   SET = 0, FnV = 0
  [ 1911.668852]   EA = 0, S1PTW = 0
  [ 1911.668853] Data abort info:
  [ 1911.668855]   ISV = 0, ISS = 0x00000061
  [ 1911.668857]   CM = 0, WnR = 1
  [ 1911.668861] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000040ff4000
  [ 1911.668864] [ffff80001bc00a8c] pgd=00000000bffff003, pud=00000000bfffe003, pmd=0068000018400705
  [ 1911.668872] Internal error: Oops: 96000061 [#1] PREEMPT SMP
  ...

The llp register present in the channel group registers is not
aligned on 64bit.

Fix unaligned 64bit access using two 32bit accesses

Fixes: 04e0a39fc10f ("dmaengine: dw-edma: Add writeq() and readq() for 64 bits architectures")
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 drivers/dma/dw-edma/dw-edma-v0-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c
index 329fc2e57b70..b5b8f8181e77 100644
--- a/drivers/dma/dw-edma/dw-edma-v0-core.c
+++ b/drivers/dma/dw-edma/dw-edma-v0-core.c
@@ -415,8 +415,11 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
 			  (DW_EDMA_V0_CCS | DW_EDMA_V0_LLE));
 		/* Linked list */
 		#ifdef CONFIG_64BIT
-			SET_CH_64(dw, chan->dir, chan->id, llp.reg,
-				  chunk->ll_region.paddr);
+			/* llp is not aligned on 64bit -> keep 32bit accesses */
+			SET_CH_32(dw, chan->dir, chan->id, llp.lsb,
+				  lower_32_bits(chunk->ll_region.paddr));
+			SET_CH_32(dw, chan->dir, chan->id, llp.msb,
+				  upper_32_bits(chunk->ll_region.paddr));
 		#else /* CONFIG_64BIT */
 			SET_CH_32(dw, chan->dir, chan->id, llp.lsb,
 				  lower_32_bits(chunk->ll_region.paddr));
-- 
2.35.1


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

* Re: [PATCH 1/1] dmaengine: dw-edma: Fix unaligned 64bit access
  2022-02-25 12:02 [PATCH 1/1] dmaengine: dw-edma: Fix unaligned 64bit access Herve Codina
@ 2022-04-11 14:24 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2022-04-11 14:24 UTC (permalink / raw)
  To: Herve Codina; +Cc: Gustavo Pimentel, dmaengine, linux-kernel, Thomas Petazzoni

On 25-02-22, 13:02, Herve Codina wrote:
> On some arch (ie aarch64 iMX8MM) unaligned PCIe accesses are
> not allowed and lead to a kernel Oops.
>   [ 1911.668835] Unable to handle kernel paging request at virtual address ffff80001bc00a8c
>   [ 1911.668841] Mem abort info:
>   [ 1911.668844]   ESR = 0x96000061
>   [ 1911.668847]   EC = 0x25: DABT (current EL), IL = 32 bits
>   [ 1911.668850]   SET = 0, FnV = 0
>   [ 1911.668852]   EA = 0, S1PTW = 0
>   [ 1911.668853] Data abort info:
>   [ 1911.668855]   ISV = 0, ISS = 0x00000061
>   [ 1911.668857]   CM = 0, WnR = 1
>   [ 1911.668861] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000040ff4000
>   [ 1911.668864] [ffff80001bc00a8c] pgd=00000000bffff003, pud=00000000bfffe003, pmd=0068000018400705
>   [ 1911.668872] Internal error: Oops: 96000061 [#1] PREEMPT SMP
>   ...
> 
> The llp register present in the channel group registers is not
> aligned on 64bit.
> 
> Fix unaligned 64bit access using two 32bit accesses

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2022-04-11 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 12:02 [PATCH 1/1] dmaengine: dw-edma: Fix unaligned 64bit access Herve Codina
2022-04-11 14:24 ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.