| #
307b9ddb |
| 19-Aug-2026 |
Linus Torvalds <torvalds@linux-foundation.org> |
Merge tag 'spi-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "Along with a lot of driver specific work we've got a couple of core features h
Merge tag 'spi-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "Along with a lot of driver specific work we've got a couple of core features here. The bigger one is that we've now got support for instantiating devices from sysfs similarly to how it's already done for I2C, this is used with development boards with non-enumerable expansion headers since SPI devices need to be manually specified. We also have support for the DQS signal on higher end flash devices.
- Support for instantiating devices from sysfs, useful for development boards with non-enumerable plugin modules, from Vishwaroop A.
- Support for DQS in spi-mem, an additional signal used by flash devices to avoid clock skew from Miquel Raynal.
- Support for more advanced SPI modes on DesignWare controllers from Sudip Mukherjee.
- Changes from Jisheng Zhang to update to modern methods of specifying the PM callbacks.
- Fixes for DMA mapping error handling, plus KUnit tests for this, from Honghui Jiang.
- Substantial cleanup and performance work in the nxp-spi driver.
- Support for Microchip LAN969x, Nuvoton MA35D1 QSPI, Qualcomm SA8255p and SA8797P, and StarFive JHB100 SFC"
* tag 'spi-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (132 commits) spi: Add KUnit coverage for DMA mapping error paths spi: Clear current DMA devices when unmapping a message spi: Move __spi_unmap_msg() before __spi_map_msg() spi: Fix DMA mapping ownership on partial map failure spi: dt-bindings: sun6i: Add compatibles for A733's SPI controllers spi: ma35d1-qspi: Use the existing update helper spi: ma35d1-qspi: Add DTR support spi: ma35d1-qspi: Allow several command bytes spi: ma35d1-qspi: Move speed setting to bus configuration spi: ma35d1-qspi: Remove redundant reset operation spi: dw: Remove shadowed dws in dw_spi_setup() spi: img-spfi: don't disable runtime PM on DMA deferred probe spi: mtk-nor: Propagate errors from IRQ request spi: mtk-nor: Propagate errors from optional IRQ lookup spi: spi-qpic-snand: Handle Macronix quad read opcode 0x6b spi: spi-qpic-snand: add quad mode support spi: spi-qpic-snand: move command mapping helper spi: hisi-sfc-v3xx: Propagate errors from optional IRQ lookup spi: meson-spifc: use devm_pm_runtime_set_active_enabled spi: sprd-adi: Fix probe succeeding without registering the controller ...
show more ...
|
| #
23688feb |
| 14-Aug-2026 |
Mark Brown <broonie@kernel.org> |
spi: Fix DMA mapping ownership on partial map failure
Honghui Jiang <jiang_hh2019@163.com> says:
A partial DMA mapping failure can leave per-transfer mapping flags set while cur_{tx,rx}_dma_dev are
spi: Fix DMA mapping ownership on partial map failure
Honghui Jiang <jiang_hh2019@163.com> says:
A partial DMA mapping failure can leave per-transfer mapping flags set while cur_{tx,rx}_dma_dev are NULL or still refer to the devices used for an earlier message. The subsequent cleanup may then unmap a transfer with a NULL or stale device.
Before commit e289df82344f ("spi: Rework per message DMA mapped flag to be per transfer"), partial-failure handling was already incomplete, but __spi_unmap_msg() was gated by cur_msg_mapped, which was set only after the whole message mapped successfully. Earlier mappings could leak, but cleanup could not unmap them with an unpublished device. The per-transfer conversion removed that gate: mapping flags can now remain set while cur_{tx,rx}_dma_dev are still unpublished, turning the leak into a NULL- or stale-device unmap regression.
Patch 1 publishes the mapping devices before the loop and unwinds every failure through __spi_unmap_msg(). It keeps the forward declaration so it is independently buildable and straightforward to backport. Patch 2 then removes the declaration by moving __spi_unmap_msg() above __spi_map_msg(). Patch 3 clears the current DMA device pointers once the message has been unmapped, while leaving them intact during partial-map unwind and DMA-to-PIO fallback. Patch 4 adds the DMA mapping KUnit suite as a separate translation unit.
Only patch 1 is a stable candidate; patches 2 through 4 are follow-up cleanup and test changes for mainline.
Testing:
- Patch 1 builds independently with the x86_64 reproducer configuration. - The spi_dma KUnit suite passes all four cases on x86_64 and UML. Moving the DMA device assignments back after the mapping loop makes both failure-path cases fail. - The default and all-tests KUnit configurations both select the suite. - All four reproducer cases complete without an oops when run as the first message, and map/unmap counts are balanced after a successful first message. - After message cleanup, cur_{tx,rx}_dma_dev are NULL.
v1: https://lore.kernel.org/r/20260805151456.756579-1-jiang_hh2019@163.com
Link: https://patch.msgid.link/20260814031419.43378-1-jiang_hh2019@163.com
show more ...
|
| #
9b81a87c |
| 14-Aug-2026 |
Honghui Jiang <jiang_hh2019@163.com> |
spi: Add KUnit coverage for DMA mapping error paths
Add KUnit tests for the __spi_map_msg() error paths. The tests verify that a later TX or RX mapping failure clears the mapping state of earlier tr
spi: Add KUnit coverage for DMA mapping error paths
Add KUnit tests for the __spi_map_msg() error paths. The tests verify that a later TX or RX mapping failure clears the mapping state of earlier transfers and leaves cur_{tx,rx}_dma_dev identifying the current mapping device.
A zero-length transfer causes sg_alloc_table() to return -EINVAL, providing deterministic failure injection without test hooks. Additional cases cover successful map/unmap and a message which requires no mapping.
Build the DMA suite as a separate translation unit, exposing the two internal mapping helpers only for KUnit through the local internal header. Enable SPI in the default and all-tests KUnit configurations so the suite is exercised there.
Signed-off-by: Honghui Jiang <jiang_hh2019@163.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20260814031419.43378-5-jiang_hh2019@163.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|