[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAFQd5DYtmWna91HYYJP_8_xEGm9faggM7ejPC7sbbPso=xvow@mail.gmail.com>
Date: Mon, 1 Mar 2021 19:26:01 +0900
From: Tomasz Figa <tfiga@...omium.org>
To: Stanimir Varbanov <stanimir.varbanov@...aro.org>
Cc: Alexandre Courbot <acourbot@...omium.org>,
Fritz Koenig <frkoenig@...omium.org>,
Linux Media Mailing List <linux-media@...r.kernel.org>,
Nicolas Dufresne <nicolas@...fresne.ca>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
Robin Murphy <robin.murphy@....com>
Subject: Re: [PATCH] media: venus: use contig vb2 ops
On Mon, Mar 1, 2021 at 7:22 PM Stanimir Varbanov
<stanimir.varbanov@...aro.org> wrote:
>
>
>
> On 3/1/21 11:23 AM, Tomasz Figa wrote:
> > Hi Alex, Stanimir,
> >
> > On Wed, Dec 16, 2020 at 12:15 PM Tomasz Figa <tfiga@...omium.org> wrote:
> >>
> >> On Wed, Dec 16, 2020 at 4:21 AM Nicolas Dufresne <nicolas@...fresne.ca> wrote:
> >>>
> >>> Le mardi 15 décembre 2020 à 15:54 +0200, Stanimir Varbanov a écrit :
> >>>> Hi Tomasz,
> >>>>
> >>>> On 12/15/20 1:47 PM, Tomasz Figa wrote:
> >>>>> On Tue, Dec 15, 2020 at 8:16 PM Stanimir Varbanov
> >>>>> <stanimir.varbanov@...aro.org> wrote:
> >>>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> Cc: Robin
> >>>>>>
> >>>>>> On 12/14/20 2:57 PM, Alexandre Courbot wrote:
> >>>>>>> This driver uses the SG vb2 ops, but effectively only ever accesses the
> >>>>>>> first entry of the SG table, indicating that it expects a flat layout.
> >>>>>>> Switch it to use the contiguous ops to make sure this expected invariant
> >>>>>>
> >>>>>> Under what circumstances the sg table will has nents > 1? I came down to
> >>>>>> [1] but not sure I got it right.
> >>>>>>
> >>>>>> I'm afraid that for systems with low amount of system memory and when
> >>>>>> the memory become fragmented, the driver will not work. That's why I
> >>>>>> started with sg allocator.
> >>>>>
> >>>>> It is exactly the opposite. The vb2-dma-contig allocator is "contig"
> >>>>> in terms of the DMA (aka IOVA) address space. In other words, it
> >>>>> guarantees that having one DMA address and length fully describes the
> >>>>
> >>>> Ahh, I missed that part. Looks like I misunderstood videobu2 contig
> >>>> allocator.
> >>>
> >>> I'm learning everyday too, but I'm surprised I don't see a call to
> >>> vb2_dma_contig_set_max_seg_size() in this driver (I could also just have missed
> >>> a patch when overlooking this thread) ?
> >>>
> >>> The reason I'm asking, doc says it should be called by driver supporting IOMMU,
> >>> which seems to be the case for such drivers (MFC, exynos4-is, exynos-gsc, mtk-
> >>> mdp, s5p-g2d, hantro, rkvdec, zoran, ti-vpe, ..). I posting it, worst case it's
> >>> all covered and we are good, otherwise perhaps a downstream patch didn't make it
> >>> ?
> >>>
> >>> /**
> >>> * vb2_dma_contig_set_max_seg_size() - configure DMA max segment size
> >>> * @dev: device for configuring DMA parameters
> >>> * @size: size of DMA max segment size to set
> >>> *
> >>> * To allow mapping the scatter-list into a single chunk in the DMA
> >>> * address space, the device is required to have the DMA max segment
> >>> * size parameter set to a value larger than the buffer size. Otherwise,
> >>> * the DMA-mapping subsystem will split the mapping into max segment
> >>> * size chunks. This function sets the DMA max segment size
> >>> * parameter to let DMA-mapping map a buffer as a single chunk in DMA
> >>> * address space.
> >>> * This code assumes that the DMA-mapping subsystem will merge all
> >>> * scatterlist segments if this is really possible (for example when
> >>> * an IOMMU is available and enabled).
> >>> * Ideally, this parameter should be set by the generic bus code, but it
> >>> * is left with the default 64KiB value due to historical litmiations in
> >>> * other subsystems (like limited USB host drivers) and there no good
> >>> * place to set it to the proper value.
> >>> * This function should be called from the drivers, which are known to
> >>> * operate on platforms with IOMMU and provide access to shared buffers
> >>> * (either USERPTR or DMABUF). This should be done before initializing
> >>> * videobuf2 queue.
> >>> */
> >>
> >> It does call dma_set_max_seg_size() directly:
> >> https://elixir.bootlin.com/linux/latest/source/drivers/media/platform/qcom/venus/core.c#L230
> >>
> >> Actually, why do we even need a vb2 helper for this?
> >>
> >
> > What's the plan for this patch?
>
> It will be part of v5.12.
Great, thanks!
Powered by blists - more mailing lists