On Thu, Jan 09, 2025 at 01:56:02AM +0800, Xu Yilun wrote: > > > > 5) iommufd and kvm are both using CPU addresses without DMA. No > > > > exporter mapping is possible > > > > > > We have customers using both KVM and XEN with DMA-buf, so I can clearly > > > confirm that this isn't true. > > > > Today they are mmaping the dma-buf into a VMA and then using KVM's > > follow_pfn() flow to extract the CPU pfn from the PTE. Any mmapable > > dma-buf must have a CPU PFN. > > Yes, the final target for KVM is still the CPU PFN, just with the help > of CPU mapping table. > > I also found the xen gntdev-dmabuf is calculating pfn from mapped > sgt. See the comment, it's ok because it's a fake device with fake iommu and the xen code has special knowledge to peek behind the curtain. -Sima > From Christion's point, I assume only sgl->dma_address should be > used by importers but in fact not. More importers are 'abusing' sg dma > helpers. > > That said there are existing needs for importers to know more about the > real buffer resource, for mapping, or even more than mapping, > e.g. dmabuf_imp_grant_foreign_access() -- Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch