From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: Tomasz Figa <tfiga@chromium.org>,
Alexandre Courbot <acourbot@chromium.org>
Cc: Fritz Koenig <frkoenig@chromium.org>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
Nicolas Dufresne <nicolas@ndufresne.ca>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH] media: venus: use contig vb2 ops
Date: Mon, 1 Mar 2021 12:22:14 +0200 [thread overview]
Message-ID: <b62575fd-7aac-57fe-b6f7-cf1e94f909f2@linaro.org> (raw)
In-Reply-To: <CAAFQd5BAT2Xe+_swAe+hMqm_cQVbWJUzkH3dS+8-QHknV=KTjw@mail.gmail.com>
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@chromium.org> wrote:
>>
>> On Wed, Dec 16, 2020 at 4:21 AM Nicolas Dufresne <nicolas@ndufresne.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@linaro.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.
--
regards,
Stan
next prev parent reply other threads:[~2021-03-01 10:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 12:57 Alexandre Courbot
2020-12-15 9:02 ` Tomasz Figa
2020-12-15 11:16 ` Stanimir Varbanov
2020-12-15 11:34 ` Robin Murphy
2020-12-15 11:47 ` Tomasz Figa
2020-12-15 13:32 ` Robin Murphy
2020-12-15 13:54 ` Stanimir Varbanov
2020-12-15 19:21 ` Nicolas Dufresne
2020-12-16 3:15 ` Tomasz Figa
2021-03-01 9:23 ` Tomasz Figa
2021-03-01 10:22 ` Stanimir Varbanov [this message]
2021-03-01 10:26 ` Tomasz Figa
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=b62575fd-7aac-57fe-b6f7-cf1e94f909f2@linaro.org \
--to=stanimir.varbanov@linaro.org \
--cc=acourbot@chromium.org \
--cc=frkoenig@chromium.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=nicolas@ndufresne.ca \
--cc=robin.murphy@arm.com \
--cc=tfiga@chromium.org \
/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
all inboxes | Powered by JetHome®