* [RFC] videobuf2-dma-contig broken for IOMMU + USERPTR buffers without struct page mapping
@ 2014-03-10 13:27 Laurent Pinchart
0 siblings, 0 replies; only message in thread
From: Laurent Pinchart @ 2014-03-10 13:27 UTC (permalink / raw)
To: linux-media; +Cc: Pawel Osciak, Marek Szyprowski, Kyungmin Park
Hello,
On some platforms (namely ARM) IOMMUs are handled transparently by the DMA
mapping implementation. This requires mapping and unmapping all USERPTR
buffers for DMA, regardless of whether they're backed by struct page or not.
videobuf2-dma-contig is broken in that regard, as it call dma_map_sg() and
dma_unmap_sg() only for buffers backed with struct page.
The page-less USERPTR dma-contig support was mostly intended (if I'm not
mistaken) to support "exporters" (in the dmabuf sense, but through mmap() on
the exporter side and USERPTR on the V4L2 side) that required large physically
contiguous buffers. Allocating such buffers required reserving memory at boot
time and resulted in no struct page mappings for that memory.
Now that CMA is available I believe that most (if not all) drivers have been
converted to CMA using the dma_alloc_* API. My original test case for page-
less USERPTR buffers with the OMAP3 ISP, capturing to mmap()ed fbdev memory,
now has the memory backed by struct page.
I wonder whether we should drop support for this broken feature altogether, or
fix it. A fix won't be easy, given that dma_map_sg() assumes that the memory
is backed by struct page at least on some platforms. On ARM, for instance, it
calls page_to_phys(sg_page()) on sglist entries.
Does anyone still have a test case for this features ?
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-03-10 13:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10 13:27 [RFC] videobuf2-dma-contig broken for IOMMU + USERPTR buffers without struct page mapping Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox