[PATCH 0/4] dma: catch mistakes with CONFIG_DMA_API_DEBUG

Sascha Hauer sha at pengutronix.de
Mon Dec 4 23:52:00 PST 2023


On Wed, Nov 29, 2023 at 07:17:54AM +0100, Ahmad Fatoum wrote:
> 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

Applied, thanks

Sascha

> 
>  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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list