[PATCH 0/5] dmaengine: sf-pdma: critical fixes and FU740 support
From: Max Hsu
Date: Fri Feb 20 2026 - 14:44:20 EST
This series addresses critical bugs in the SiFive Platform DMA (PDMA)
driver and adds support for the FU740 SoC.
The first three patches fix serious issues in the existing sf-pdma driver:
1. Missing PDMA base offset (0x80000) in register calculations. While
the hardware provides an alias at offset 0x0, the driver should use
the canonical offset 0x80000 as documented in the specification to
ensure consistency and maintainability.
2. Race condition between done and error interrupts on SMP systems. Per
the FU540-C000 and FU740-C000 specs, both DONE and ERROR interrupt
bits are set simultaneously when a DMA error occurs, which can cause
concurrent execution of done_isr and err_isr on different CPUs,
leading to undefined behavior.
3. NULL pointer dereferences in both error and done tasklets due to race
conditions during channel termination. Both tasklets unconditionally
dereference chan->desc, which can be NULL during legitimate scenarios
like sf_pdma_terminate_all() or when interrupts fire after channel
cleanup. The fix adds NULL checks in both tasklets, protected by
vchan.lock to ensure atomicity.
These three fixes are tagged for stable as they address bugs present
since the driver's introduction in commit 6973886ad58e ("dmaengine:
sf-pdma: add platform DMA support for HiFive Unleashed A00").
The last two patches add FU740 support:
4. Add "sifive,fu740-c000-pdma" compatible string to the dt-bindings.
5. Add PDMA device node to the FU740 device tree to enable DMA support.
All patches have been tested on HiFive Unmatched (FU740-C000) hardware.
Signed-off-by: Max Hsu <max.hsu@xxxxxxxxxx>
---
Max Hsu (5):
dmaengine: sf-pdma: add missing PDMA base offset to register calculations
dmaengine: sf-pdma: fix race between done and error interrupts
dmaengine: sf-pdma: fix NULL pointer dereference in error and done handlers
dt-bindings: dma: sifive,fu540-c000-pdma: add fu740 support
riscv: dts: sifive: fu740: add PDMA device node
.../bindings/dma/sifive,fu540-c000-pdma.yaml | 1 +
arch/riscv/boot/dts/sifive/fu740-c000.dtsi | 9 ++++
drivers/dma/sf-pdma/sf-pdma.c | 63 +++++++++++++++++-----
drivers/dma/sf-pdma/sf-pdma.h | 4 +-
4 files changed, 63 insertions(+), 14 deletions(-)
---
base-commit: 8bf22c33e7a172fbc72464f4cc484d23a6b412ba
change-id: 20260111-pdma-0421b0e48a10
Best regards,
--
Max Hsu <max.hsu@xxxxxxxxxx>