Re: IOVA allocation dependency between firmware buffer and remaining buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 24, 2020 at 12:41:29PM +0200, Marek Szyprowski wrote:
> Hi Thierry,
> 
> On 24.09.2020 12:16, Thierry Reding wrote:
> > On Thu, Sep 24, 2020 at 10:46:46AM +0200, Marek Szyprowski wrote:
> >> On 24.09.2020 10:28, Joerg Roedel wrote:
> >>> On Wed, Sep 23, 2020 at 08:48:26AM +0200, Marek Szyprowski wrote:
> >>>> It allows to remap given buffer at the specific IOVA address, although
> >>>> it doesn't guarantee that those specific addresses won't be later used
> >>>> by the IOVA allocator. Probably it would make sense to add an API for
> >>>> generic IOMMU-DMA framework to mark the given IOVA range as
> >>>> reserved/unused to protect them.
> >>> There is an API for that, the IOMMU driver can return IOVA reserved
> >>> regions per device and the IOMMU core code will take care of mapping
> >>> these regions and reserving them in the IOVA allocator, so that
> >>> DMA-IOMMU code will not use it for allocations.
> >>>
> >>> Have a look at the iommu_ops->get_resv_regions() and
> >>> iommu_ops->put_resv_regions().
> >> I know about the reserved regions IOMMU API, but the main problem here,
> >> in case of Exynos, is that those reserved regions won't be created by
> >> the IOMMU driver but by the IOMMU client device. It is just a result how
> >> the media drivers manages their IOVA space. They simply have to load
> >> firmware at the IOVA address lower than the any address of the used
> >> buffers.
> > I've been working on adding a way to automatically add direct mappings
> > using reserved-memory regions parsed from device tree, see:
> >
> >      https://lore.kernel.org/lkml/20200904130000.691933-1-thierry.reding@xxxxxxxxx/
> >
> > Perhaps this can be of use? With that you should be able to add a
> > reserved-memory region somewhere in the lower range that you need for
> > firmware images and have that automatically added as a direct mapping
> > so that it won't be reused later on for dynamic allocations.
> 
> Frankly, using that would be even bigger hack than what I've proposed in 
> my workaround. I see no point polluting DT with such artificial regions 
> just to ensure specific IOVA space layout.

I think I misunderstood the requirements that you have. Sounds like
there are no actual restrictions for where exactly the memory resides
for the firmware, it just has to be lower than any of the buffer
allocations. I agree, in that case using reserved memory regions does
not make sense at all.

Thierry

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux