Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iommu: Tidy domain for iommu_setup_dma_ops()

This function can only be called on the default_domain. Trivally pass it
in. In all three existing cases, the default domain was just attached to
the device.

This avoids iommu_setup_dma_ops() calling iommu_get_domain_for_dev() that
will be used by external callers.

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

authored by

Nicolin Chen and committed by
Joerg Roedel
4a73abb9 5d5388b0

+7 -8
+1 -3
drivers/iommu/dma-iommu.c
··· 2097 2097 } 2098 2098 EXPORT_SYMBOL_GPL(dma_iova_destroy); 2099 2099 2100 - void iommu_setup_dma_ops(struct device *dev) 2100 + void iommu_setup_dma_ops(struct device *dev, struct iommu_domain *domain) 2101 2101 { 2102 - struct iommu_domain *domain = iommu_get_domain_for_dev(dev); 2103 - 2104 2102 if (dev_is_pci(dev)) 2105 2103 dev->iommu->pci_32bit_workaround = !iommu_dma_forcedac; 2106 2104
+3 -2
drivers/iommu/dma-iommu.h
··· 9 9 10 10 #ifdef CONFIG_IOMMU_DMA 11 11 12 - void iommu_setup_dma_ops(struct device *dev); 12 + void iommu_setup_dma_ops(struct device *dev, struct iommu_domain *domain); 13 13 14 14 int iommu_get_dma_cookie(struct iommu_domain *domain); 15 15 void iommu_put_dma_cookie(struct iommu_domain *domain); ··· 26 26 27 27 #else /* CONFIG_IOMMU_DMA */ 28 28 29 - static inline void iommu_setup_dma_ops(struct device *dev) 29 + static inline void iommu_setup_dma_ops(struct device *dev, 30 + struct iommu_domain *domain) 30 31 { 31 32 } 32 33
+3 -3
drivers/iommu/iommu.c
··· 661 661 } 662 662 663 663 if (group->default_domain) 664 - iommu_setup_dma_ops(dev); 664 + iommu_setup_dma_ops(dev, group->default_domain); 665 665 666 666 mutex_unlock(&group->mutex); 667 667 ··· 1949 1949 return ret; 1950 1950 } 1951 1951 for_each_group_device(group, gdev) 1952 - iommu_setup_dma_ops(gdev->dev); 1952 + iommu_setup_dma_ops(gdev->dev, group->default_domain); 1953 1953 mutex_unlock(&group->mutex); 1954 1954 1955 1955 /* ··· 3155 3155 3156 3156 /* Make sure dma_ops is appropriatley set */ 3157 3157 for_each_group_device(group, gdev) 3158 - iommu_setup_dma_ops(gdev->dev); 3158 + iommu_setup_dma_ops(gdev->dev, group->default_domain); 3159 3159 3160 3160 out_unlock: 3161 3161 mutex_unlock(&group->mutex);