lkml.org 
[lkml]   [2019]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] dma-direct: Export dma_direct_alloc() and dma_direct_free()
On Tue, Feb 05, 2019 at 05:38:37PM +0100, Christoph Hellwig wrote:
> On Tue, Feb 05, 2019 at 05:20:57PM +0100, Thierry Reding wrote:
> > The problem is that if I use dma_alloc_coherent(), then the memory will
> > already be mapped via the SMMU at that point and then the driver, not
> > knowing that memory has already been mapped, will attempt to map an IOVA
> > which will cause an SMMU fault when the host1x tries to access the
> > memory.
> >
> > I didn't find an equivalent to arm_iommu_detach_device() for non-ARM,
> > but then stumbled across this and thought it was rather convenient for
> > these cases. If there's a better way to deal with this situation, I'd be
> > happy to do so.
>
> So you basically do a dma_direct_alloc + iommu_map? Can you send me
> a pointer to your code? Maybe we need to add a proper IOMMU-layer
> API for that.

Sure, here you go:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/host1x/cdma.c#n106

Thierry
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-02-05 18:56    [W:0.055 / U:3.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site