lede/target/linux/bcm27xx/patches-6.12/950-0913-dmaengine-dw-axi-dmac-Fix-alignment-checks.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

43 lines
1.4 KiB
Diff

From 8d53a07ee6031596466a02169712ed2324e8a077 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 20 Mar 2025 16:41:14 +0000
Subject: [PATCH] dmaengine: dw-axi-dmac: Fix alignment checks
Remove a bogus memory alignment check - transfers will be run bytewise
if needed - and add a check that the overall length is multiple of the
register size, otherwise there is residue.
See: https://github.com/raspberrypi/linux/issues/6733
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -750,11 +750,6 @@ static int dw_axi_dma_set_hw_desc(struct
mem_width = __ffs(data_width | mem_addr | len);
- if (!IS_ALIGNED(mem_addr, 4)) {
- dev_err(chan->chip->dev, "invalid buffer alignment\n");
- return -EINVAL;
- }
-
/* Use a reasonable upper limit otherwise residue reporting granularity grows large */
mem_burst_msize = axi_dma_encode_msize(16);
@@ -799,6 +794,11 @@ static int dw_axi_dma_set_hw_desc(struct
return -EINVAL;
}
+ if (len % (1 << reg_width)) {
+ dev_err_ratelimited(chan->chip->dev, "length %ld not aligned to device width %d\n", len, 1 << reg_width);
+ return -EINVAL;
+ }
+
if (block_ts > axi_block_ts)
return -EINVAL;