All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] iio: buffer-dmaengine: fix dma_vec building for coalesced sg tables
@ 2026-08-28 10:46 Nuno Sá
  2026-08-28 10:46 ` [PATCH v2 1/2] iio: buffer-dmaengine: fix sg entry iteration when building dma_vecs Nuno Sá
  2026-08-28 10:46 ` [PATCH v2 2/2] iio: buffer-dmaengine: drop dead max_size computation Nuno Sá
  0 siblings, 2 replies; 4+ messages in thread
From: Nuno Sá @ 2026-08-28 10:46 UTC (permalink / raw)
  To: linux-iio; +Cc: Paul Cercueil, Jonathan Cameron, David Lechner, Andy Shevchenko

Patch 1 fixes iio_dmaengine_buffer_submit_block() mixing up the CPU and the
DMA view of a DMABUF's scatterlist: it counted entries with
sg_nents_for_len() (CPU lengths) but consumed sg_dma_address()/sg_dma_len(),
which are only valid for the first sgt->nents entries. With an IOMMU
coalescing the mapping, the loop walks past the mapped set and hands a
garbage vec to the DMA engine, which wedges the buffer.

Patch 2 is the cleanup Jonathan spotted while reviewing v1: the max_size
computation at the top of the same function is dead, as only the fileio
branch consumes it and that branch computes it again where it is used.

---
Changes in v2:
- Patch 1:
  - Size the vec array with sgt->nents instead of sg_nents_for_dma().
  - Cut the new comment down to the invariant a reader needs.
  - Moved 'nents = i' up to right after the fill loop.
  - MOved `sgl = block->sg_table->sgl` to the place where we need sgl.
- Patch 2:
  - New patch dropping the dead max_size computation at the top of
    iio_dmaengine_buffer_submit_block() (Jonathan).
- Link to v1: https://patch.msgid.link/20260818-iio-buffer-dmabuf-iommu-fic-v1-1-4ff1e44a5073@analog.com

---
Michael Hennerich (1):
      iio: buffer-dmaengine: fix sg entry iteration when building dma_vecs

Nuno Sá (1):
      iio: buffer-dmaengine: drop dead max_size computation

 drivers/iio/buffer/industrialio-buffer-dmaengine.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
---
base-commit: b756b143e5391151e577ae645b1378a43f93c2f5
change-id: 20260818-iio-buffer-dmabuf-iommu-fic-1b281f15e5a4
--

Thanks!
- Nuno Sá


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-30  0:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 10:46 [PATCH v2 0/2] iio: buffer-dmaengine: fix dma_vec building for coalesced sg tables Nuno Sá
2026-08-28 10:46 ` [PATCH v2 1/2] iio: buffer-dmaengine: fix sg entry iteration when building dma_vecs Nuno Sá
2026-08-30  0:23   ` Jonathan Cameron
2026-08-28 10:46 ` [PATCH v2 2/2] iio: buffer-dmaengine: drop dead max_size computation Nuno Sá

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.