mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Denis Orlov <denorl2009@gmail.com>,
	str@pengutronix.de, lst@pengutronix.de
Subject: [PATCH 0/4] dma: catch mistakes with CONFIG_DMA_API_DEBUG
Date: Wed, 29 Nov 2023 07:17:54 +0100	[thread overview]
Message-ID: <20231129061758.1781732-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2023-11-29  6:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29  6:17 Ahmad Fatoum [this message]
2023-11-29  6:17 ` [PATCH 1/4] dma: factor out dma map generic implementations into file Ahmad Fatoum
2023-12-05  8:37   ` Sascha Hauer
2023-12-05  8:42     ` Ahmad Fatoum
2023-11-29  6:17 ` [PATCH 2/4] dma: add DMA API debugging support Ahmad Fatoum
2023-11-29  6:17 ` [PATCH 3/4] mci: core: remove broken, unneeded write bounce buffer Ahmad Fatoum
2023-11-29  6:17 ` [PATCH 4/4] mci: stm32_sdmmc2: correct usage of DMA API Ahmad Fatoum
2023-12-05  7:52 ` [PATCH 0/4] dma: catch mistakes with CONFIG_DMA_API_DEBUG Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231129061758.1781732-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=denorl2009@gmail.com \
    --cc=lst@pengutronix.de \
    --cc=str@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox