RE: [RFC PATCH] dma-mapping: create iommu mapping for newly allocated dma coherent mem

From: Laurentiu Tudor
Date: Tue Apr 23 2019 - 18:10:02 EST


Hello,

> -----Original Message-----
> From: Christoph Hellwig <hch@xxxxxx>
> Sent: Monday, April 22, 2019 9:11 PM
>
> On Mon, Apr 22, 2019 at 07:51:25PM +0300, laurentiu.tudor@xxxxxxx wrote:
> > From: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>
> >
> > If possible / available call into the DMA API to get a proper iommu
> > mapping and a dma address for the newly allocated coherent dma memory.
>
> I don't think this is so simple. The original use case of
> dma_declare_coherent_memory was memory that is local to a device, where
> we copy in data through a MMIO mapping and the device can then access
> it. This use case still seems to be alive in the ohci-sm501 and
> ohci-tmio drivers. Going through the iommu in those cases would be
> counter productive.

I had a feeling that I didn't get the whole story and something isn't quite right with this patch. ð But I'm happy that we have a discussion started on the topic and, I must say, I'm very interested in getting to the bottom of it (I have some patches enabling SMMU on a couple of NXP chips and depend on resolving this).
I'll try to understand what you're planning but in the meantime please let me know if you think I can be of any help.

---
Thanks & Best Regards, Laurentiu