[PATCH 0/4] dma: catch mistakes with CONFIG_DMA_API_DEBUG
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Nov 28 22:17:54 PST 2023
Cache invalidation issues around DMA accesses can be difficult to debug.
Motivated by recent fixes to the macb driver[1], let's add some optional
sanity checking to the DMA API inspired by the Linux CONFIG_DMA_API_DEBUG
option.
This would have caught the issue fixed by [1] in the macb driver and it
already caught a misuse of the API on the STM32MP system I tested it on.
Usage is simple: just enable it and ensure no warnings are printed.
All warnings are printed alongside the extents of the DMA buffer in
question and a stack trace at the time the check failed.
[1]: https://lore.barebox.org/barebox/20231128-v2023-08-0-topic-macb-v1-0-9faff73bc990@pengutronix.de/T/#t
Ahmad Fatoum (4):
dma: factor out dma map generic implementations into file
dma: add DMA API debugging support
mci: core: remove broken, unneeded write bounce buffer
mci: stm32_sdmmc2: correct usage of DMA API
common/Kconfig | 14 +++
drivers/dma/Makefile | 2 +
drivers/dma/debug.c | 183 +++++++++++++++++++++++++++++++++++++
drivers/dma/debug.h | 56 ++++++++++++
drivers/dma/map.c | 43 +++++++++
drivers/mci/mci-core.c | 10 +-
drivers/mci/stm32_sdmmc2.c | 41 +++++----
include/dma.h | 61 ++++---------
8 files changed, 340 insertions(+), 70 deletions(-)
create mode 100644 drivers/dma/debug.c
create mode 100644 drivers/dma/debug.h
create mode 100644 drivers/dma/map.c
--
2.39.2
More information about the barebox
mailing list