|
1 | | -From git@z Thu Jan 1 00:00:00 1970 |
2 | | -Subject: [PATCH] dmaengine: mmp_pdma: fix DMA mask handling |
| 1 | +From 88ebb29d3244e515a92c2331434bb73fef7efdc6 Mon Sep 17 00:00:00 2001 |
3 | 2 | From: Guodong Xu < [email protected]> |
4 | 3 | Date: Thu, 18 Sep 2025 22:27:27 +0800 |
5 | | -Message-Id: <20250918-mmp-pdma-simplify-dma-addressing-v1-1-5c2be2b85696@riscstar.com> |
6 | | -MIME-Version: 1.0 |
7 | | -Content-Type: text/plain; charset="utf-8" |
8 | | -Content-Transfer-Encoding: 7bit |
| 4 | +Subject: dmaengine: mmp_pdma: fix DMA mask handling |
9 | 5 |
|
10 | 6 | The driver's existing logic for setting the DMA mask for "marvell,pdma-1.0" |
11 | 7 | was flawed. It incorrectly relied on pdev->dev->coherent_dma_mask instead |
|
36 | 32 | Closes: https://lore.kernel.org/lkml/CA+G9fYsPcMfW-e_0_TRqu4cnwqOqYF3aJOeKUYk6Z4qRStdFvg@mail.gmail.com |
37 | 33 | Suggested-by: Arnd Bergmann < [email protected]> |
38 | 34 | Signed-off-by: Guodong Xu < [email protected]> |
39 | | -Tested-by: Naresh Kamboju < [email protected]> |
40 | | -Tested-by: Nathan Chancellor < [email protected]> # build |
41 | 35 | Reviewed-by: Arnd Bergmann < [email protected]> |
42 | | -Link: https://patch.msgid.link/20250918-mmp-pdma-simplify-dma-addressing-v1-1-5c2be2b85696@riscstar.com |
| 36 | +Tested-by: Nathan Chancellor < [email protected]> # build |
| 37 | +Tested-by: Naresh Kamboju < [email protected]> |
| 38 | +Signed-off-by: Vinod Koul < [email protected]> |
43 | 39 | --- |
44 | | -Hi Vinod, Arnd, and all, |
45 | | - |
46 | | -This patch fixes a build failure in the mmp_pdma driver when using |
47 | | -clang-20, as reported by Naresh Kamboju [1]. The error, |
48 | | -a -Wshift-count-overflow warning, is caused by a known issue in the clang |
49 | | -compiler. When the DMA_BIT_MASK(64) macro is used in a static initializer, |
50 | | -it triggers a long-standing bug in how clang evaluates compile-time |
51 | | -constants [2, 3]. Thanks to Nathan Chancellor for providing these links. |
52 | | - |
53 | | -While investigating this, Arnd Bergmann pointed out that the driver's |
54 | | -logic for setting the DMA mask was unnecessarily complex. This logic, |
55 | | -which was inherited from the original Marvel PDMA driver when adding |
56 | | -support for SpacemiT K1 DMA, could be simplified. A better solution is to |
57 | | -set each device's DMA mask directly based on its hardware capability. |
58 | | - |
59 | | -This patch implements Arnd's suggestion. It refactors the driver to store |
60 | | -the controller's DMA width (either 32 or 64 bits) and generates the mask |
61 | | -at runtime within the probe() function. |
62 | | - |
63 | | -This approach also avoids the clang false error reporting. |
64 | | - |
65 | | -This patch is based on dmaengine.git next [4]. |
66 | | - |
67 | | -Thanks, |
68 | | -Guodong Xu |
69 | | - |
70 | | -[1] https://lore.kernel.org/lkml/CA+G9fYsPcMfW-e_0_TRqu4cnwqOqYF3aJOeKUYk6Z4qRStdFvg@mail.gmail.com/ |
71 | | -[2] https://github.com/ClangBuiltLinux/linux/issues/92 |
72 | | -[3] https://github.com/llvm/llvm-project/issues/38137 |
73 | | -[4] https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/log/?h=next |
| 40 | +Link: https://git.kernel.org/vkoul/dmaengine/p/88ebb29d3244e515a92c2331434bb73fef7efdc6 |
74 | 41 | --- |
75 | 42 | drivers/dma/mmp_pdma.c | 20 ++++++++------------ |
76 | 43 | 1 file changed, 8 insertions(+), 12 deletions(-) |
77 | 44 |
|
78 | 45 | diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c |
79 | | -index d07229a748868b8115892c63c54c16130d88e326..86661eb3cde1ff6d6d8f02b6f0d4142878b5a890 100644 |
| 46 | +index d07229a748868b..86661eb3cde1ff 100644 |
80 | 47 | --- a/drivers/dma/mmp_pdma.c |
81 | 48 | +++ b/drivers/dma/mmp_pdma.c |
82 | 49 | @@ -152,8 +152,8 @@ struct mmp_pdma_phy { |
@@ -134,12 +101,6 @@ index d07229a748868b8115892c63c54c16130d88e326..86661eb3cde1ff6d6d8f02b6f0d41428 |
134 | 101 |
|
135 | 102 | ret = dma_async_device_register(&pdev->device); |
136 | 103 | if (ret) { |
137 | | - |
138 | | ---- |
139 | | -base-commit: cc0bacac6de7763a038550cf43cb94634d8be9cd |
140 | | -change-id: 20250904-mmp-pdma-simplify-dma-addressing-f6aef03e07c3 |
141 | | - |
142 | | -Best regards, |
143 | 104 | -- |
144 | | - |
| 105 | +cgit 1.2.3-korg |
145 | 106 |
|
0 commit comments