Messages in this thread | | | From | Tomasz Figa <> | Date | Wed, 30 Aug 2023 18:28:21 +0900 | Subject | Re: [PATCH] media: videobuf2-dma-sg: limit the sg segment size |
| |
On Wed, Aug 30, 2023 at 5:50 PM Hui Fang <hui.fang@nxp.com> wrote: > > On Mon, Aug 28, 2023 at 8:57 AM Anle Pan <anle.pan@nxp.com> wrote: > > > > When allocating from pages, the size of the sg segment is unlimited and the > > default is UINT_MAX. This will cause the DMA stream mapping failed later > > with a "swiotlb buffer full" error. The default maximum mapping size is 128 > > slots x 2K = 256K, determined by "IO_TLB_SEGSIZE". > > To fix the issue, limit the sg segment size according to > > "dma_max_mapping_size" to match the mapping limit. > > I wonder if only NXP met the "swiotlb buffer full" issue. In theory, > when format is YUYV, those resolutions no greater than 320x240 (153600 bytes, > which less than the max mapping size 256K ) can't meet the issue. > But resolutions no less than 640x480 (307200 bytes), may have chances to > trigger the issue.
I think a combination of a device that can support scatter-gather, but requires swiotlb is kind of rare. Most drivers would require a single contiguous DMA address (and thus use videobuf2-dma-contig) and physical discontinuity would be handled by an IOMMU (transparently to vb2).
I guess one thing to ask you about your specific setup is whether it's expected that the swiotlb ends up being used at all?
Best regards, Tomasz
| |