Hi Jason, On Tue, 28 Mar 2023 13:19:11 -0300, Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > On Tue, Mar 28, 2023 at 08:48:22AM -0700, Jacob Pan wrote: > > > > Agree. The kernel driver managing the device wants to get the current > > > domain of the device then iommu_get_domain_for_dev() is the right > > > interface. It knows the domain is the dma domain. > > This goes back to v1 then :) > > > > I thought the comments from v1 is that we don't want to check the domain > > type is DMA domain returned by iommu_get_domain_for_dev() > > > > If the driver "knows" the domain is dma domain, why can't it use > > iommu_get_dma_domain()? seems paradoxical. > > Huh? > > The DMA API operates on the current domain of the device, be it > IDENTITY or UNMANAGED. > > You have to copy whatever the current domain is to the PASID and you > should definately not check if it is DMA or something. > right, the PASID works for IOVA, passthrough. I misunderstood the v1 review comments. I will go back to use iommu_get_domain_for_dev() but w/o checking domain types. Thanks all, Jacob