diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-11-29 07:17:56 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-12-05 09:35:54 +0100 |
commit | 3254bf23f400e627529a8a195ce38603271a86b8 (patch) | |
tree | 0d7b4c5ec08df85582713448d228314c93621369 /common/Kconfig | |
parent | f9acac190e33cd9bbc6aea6940900505c5bc436a (diff) | |
download | barebox-3254bf23f400e627529a8a195ce38603271a86b8.tar.gz barebox-3254bf23f400e627529a8a195ce38603271a86b8.tar.xz |
dma: add DMA API debugging support
For DMA_FROM_DEVICE, calling dma_sync_single_for_cpu
before arch_sync_dma_for_device has been called is wrong:
- Memory region is dirty in CPU cache
- Device writes packet into region
- CPU cache lines are written back
- Buffer memory is corrupted
In order to spot such issues, let's add a new CONFIG_DMA_API_DEBUG
that will warn about mismatch in order.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20231129061758.1781732-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/Kconfig')
-rw-r--r-- | common/Kconfig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/Kconfig b/common/Kconfig index 76b28ceaaf..c423f37677 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1685,6 +1685,20 @@ config DEBUG_PROBES Most consoles do not implement a remove callback to remain operable until the very end. Consoles using DMA, however, must be removed. +config DMA_API_DEBUG + bool "Enable debugging of DMA-API usage" + depends on HAS_DMA + help + Enable this option to debug the use of the DMA API by device drivers. + With this option you will be able to detect common bugs in device + drivers like double-freeing of DMA mappings or freeing mappings that + were never allocated. + + This option causes a performance degradation. Use only if you want to + debug device drivers and dma interactions. + + If unsure, say N. + config PBL_BREAK bool "Execute software break on pbl start" depends on ARM && (!CPU_32v4T && !ARCH_TEGRA) |