Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
From git@z Thu Jan 1 00:00:00 1970
Subject: [PATCH] dmaengine: mmp_pdma: fix DMA mask handling
From 88ebb29d3244e515a92c2331434bb73fef7efdc6 Mon Sep 17 00:00:00 2001
From: Guodong Xu <[email protected]>
Date: Thu, 18 Sep 2025 22:27:27 +0800
Message-Id: <20250918-mmp-pdma-simplify-dma-addressing-v1-1-5c2be2b85696@riscstar.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Subject: dmaengine: mmp_pdma: fix DMA mask handling

The driver's existing logic for setting the DMA mask for "marvell,pdma-1.0"
was flawed. It incorrectly relied on pdev->dev->coherent_dma_mask instead
Expand Down Expand Up @@ -36,47 +32,18 @@ Reported-by: Naresh Kamboju <[email protected]>
Closes: https://lore.kernel.org/lkml/CA+G9fYsPcMfW-e_0_TRqu4cnwqOqYF3aJOeKUYk6Z4qRStdFvg@mail.gmail.com
Suggested-by: Arnd Bergmann <[email protected]>
Signed-off-by: Guodong Xu <[email protected]>
Tested-by: Naresh Kamboju <[email protected]>
Tested-by: Nathan Chancellor <[email protected]> # build
Reviewed-by: Arnd Bergmann <[email protected]>
Link: https://patch.msgid.link/20250918-mmp-pdma-simplify-dma-addressing-v1-1-5c2be2b85696@riscstar.com
Tested-by: Nathan Chancellor <[email protected]> # build
Tested-by: Naresh Kamboju <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
---
Hi Vinod, Arnd, and all,

This patch fixes a build failure in the mmp_pdma driver when using
clang-20, as reported by Naresh Kamboju [1]. The error,
a -Wshift-count-overflow warning, is caused by a known issue in the clang
compiler. When the DMA_BIT_MASK(64) macro is used in a static initializer,
it triggers a long-standing bug in how clang evaluates compile-time
constants [2, 3]. Thanks to Nathan Chancellor for providing these links.

While investigating this, Arnd Bergmann pointed out that the driver's
logic for setting the DMA mask was unnecessarily complex. This logic,
which was inherited from the original Marvel PDMA driver when adding
support for SpacemiT K1 DMA, could be simplified. A better solution is to
set each device's DMA mask directly based on its hardware capability.

This patch implements Arnd's suggestion. It refactors the driver to store
the controller's DMA width (either 32 or 64 bits) and generates the mask
at runtime within the probe() function.

This approach also avoids the clang false error reporting.

This patch is based on dmaengine.git next [4].

Thanks,
Guodong Xu

[1] https://lore.kernel.org/lkml/CA+G9fYsPcMfW-e_0_TRqu4cnwqOqYF3aJOeKUYk6Z4qRStdFvg@mail.gmail.com/
[2] https://github.com/ClangBuiltLinux/linux/issues/92
[3] https://github.com/llvm/llvm-project/issues/38137
[4] https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/log/?h=next
Link: https://git.kernel.org/vkoul/dmaengine/p/88ebb29d3244e515a92c2331434bb73fef7efdc6
---
drivers/dma/mmp_pdma.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index d07229a748868b8115892c63c54c16130d88e326..86661eb3cde1ff6d6d8f02b6f0d4142878b5a890 100644
index d07229a748868b..86661eb3cde1ff 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -152,8 +152,8 @@ struct mmp_pdma_phy {
Expand Down Expand Up @@ -134,12 +101,6 @@ index d07229a748868b8115892c63c54c16130d88e326..86661eb3cde1ff6d6d8f02b6f0d41428

ret = dma_async_device_register(&pdev->device);
if (ret) {

---
base-commit: cc0bacac6de7763a038550cf43cb94634d8be9cd
change-id: 20250904-mmp-pdma-simplify-dma-addressing-f6aef03e07c3

Best regards,
--
Guodong Xu <[email protected]>
cgit 1.2.3-korg

88 changes: 0 additions & 88 deletions patches/mainline/c710de671789388b3af1046c7091685594ec44d9.patch

This file was deleted.

3 changes: 1 addition & 2 deletions patches/mainline/series
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
20250918_guodong_dmaengine_mmp_pdma_fix_dma_mask_handling.patch
c710de671789388b3af1046c7091685594ec44d9.patch
88ebb29d3244e515a92c2331434bb73fef7efdc6.patch