Re: [PATCH 07/21] dma-iommu: move the arm64 wrappers to common code

From: Christoph Hellwig
Date: Tue Apr 09 2019 - 13:15:27 EST


On Tue, Apr 09, 2019 at 04:07:02PM +0100, Robin Murphy wrote:
>> +static void iommu_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
>> + size_t size, enum dma_data_direction dir, unsigned long attrs)
>> +{
>> + if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
>> + iommu_dma_sync_single_for_cpu(dev, dma_handle, size, dir);
>> + __iommu_dma_unmap(iommu_get_domain_for_dev(dev), dma_handle, size);
>
> That wants to be iommu_get_dma_domain() there to minimise the overhead. In
> fact, I guess this could now be streamlined a bit in the style of
> iommu_dma_map_page() above - i.e. avoid doing a second domain lookup in the
> sync case - but that can happen later (if indeed you haven't already).

Yes, this should be iommu_get_dma_domain - this got lost during
a rebase to the kernel version that changed to the iommu_get_dma_domain
calls.

I don't think I've optimized to remove the additional call, but
I can easily throw in another patch to do that.