]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
iommu: Remove the ->map_sg indirection
authorChristoph Hellwig <hch@lst.de>
Mon, 30 Jul 2018 07:36:26 +0000 (09:36 +0200)
committerJoerg Roedel <jroedel@suse.de>
Wed, 8 Aug 2018 09:06:20 +0000 (11:06 +0200)
All iommu drivers use the default_iommu_map_sg implementation, and there
is no good reason to ever override it.  Just expose it as iommu_map_sg
directly and remove the indirection, specially in our post-spectre world
where indirect calls are horribly expensive.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
16 files changed:
drivers/iommu/amd_iommu.c
drivers/iommu/arm-smmu-v3.c
drivers/iommu/arm-smmu.c
drivers/iommu/exynos-iommu.c
drivers/iommu/intel-iommu.c
drivers/iommu/iommu.c
drivers/iommu/ipmmu-vmsa.c
drivers/iommu/msm_iommu.c
drivers/iommu/mtk_iommu.c
drivers/iommu/mtk_iommu_v1.c
drivers/iommu/omap-iommu.c
drivers/iommu/qcom_iommu.c
drivers/iommu/rockchip-iommu.c
drivers/iommu/tegra-gart.c
drivers/iommu/tegra-smmu.c
include/linux/iommu.h

index 596b95c50051dcb75adb67496579af4b501d0ace..a23c6a4014a58f7c27a81fd0bd7a84df4f61c821 100644 (file)
@@ -3192,7 +3192,6 @@ const struct iommu_ops amd_iommu_ops = {
        .detach_dev = amd_iommu_detach_device,
        .map = amd_iommu_map,
        .unmap = amd_iommu_unmap,
-       .map_sg = default_iommu_map_sg,
        .iova_to_phys = amd_iommu_iova_to_phys,
        .add_device = amd_iommu_add_device,
        .remove_device = amd_iommu_remove_device,
index 1d647104bccc49fd7af44985b3797bdb69aa1150..f1dc294f8e08a3010d96df4ba8017124b240e8e9 100644 (file)
@@ -1997,7 +1997,6 @@ static struct iommu_ops arm_smmu_ops = {
        .attach_dev             = arm_smmu_attach_dev,
        .map                    = arm_smmu_map,
        .unmap                  = arm_smmu_unmap,
-       .map_sg                 = default_iommu_map_sg,
        .flush_iotlb_all        = arm_smmu_iotlb_sync,
        .iotlb_sync             = arm_smmu_iotlb_sync,
        .iova_to_phys           = arm_smmu_iova_to_phys,
index f7a96bcf94a62e12d40cf38639b84b68bfb52437..644fd7ec8ac7f0215e5bb2c83907e20b52e49dce 100644 (file)
@@ -1562,7 +1562,6 @@ static struct iommu_ops arm_smmu_ops = {
        .attach_dev             = arm_smmu_attach_dev,
        .map                    = arm_smmu_map,
        .unmap                  = arm_smmu_unmap,
-       .map_sg                 = default_iommu_map_sg,
        .flush_iotlb_all        = arm_smmu_iotlb_sync,
        .iotlb_sync             = arm_smmu_iotlb_sync,
        .iova_to_phys           = arm_smmu_iova_to_phys,
index 85879cfec52fada1f4d2f6307e98aa2512a2825d..19e55cf6a9ddee11e57e4709c1c158deb36128e9 100644 (file)
@@ -1332,7 +1332,6 @@ static const struct iommu_ops exynos_iommu_ops = {
        .detach_dev = exynos_iommu_detach_device,
        .map = exynos_iommu_map,
        .unmap = exynos_iommu_unmap,
-       .map_sg = default_iommu_map_sg,
        .iova_to_phys = exynos_iommu_iova_to_phys,
        .device_group = generic_device_group,
        .add_device = exynos_iommu_add_device,
index 14e4b37224284976a1cb8890e5d13ae5337350cc..afb6c872f20389d360ae6087dd1ede43630a229d 100644 (file)
@@ -5308,7 +5308,6 @@ const struct iommu_ops intel_iommu_ops = {
        .detach_dev             = intel_iommu_detach_device,
        .map                    = intel_iommu_map,
        .unmap                  = intel_iommu_unmap,
-       .map_sg                 = default_iommu_map_sg,
        .iova_to_phys           = intel_iommu_iova_to_phys,
        .add_device             = intel_iommu_add_device,
        .remove_device          = intel_iommu_remove_device,
index f3698006cb5391bf8ef61bf84356af0f6628764c..8c15c598029934484e26520aa4aa7aa703a04ca3 100644 (file)
@@ -1673,8 +1673,8 @@ size_t iommu_unmap_fast(struct iommu_domain *domain,
 }
 EXPORT_SYMBOL_GPL(iommu_unmap_fast);
 
-size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
-                        struct scatterlist *sg, unsigned int nents, int prot)
+size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
+                   struct scatterlist *sg, unsigned int nents, int prot)
 {
        struct scatterlist *s;
        size_t mapped = 0;
@@ -1714,7 +1714,7 @@ out_err:
        return 0;
 
 }
-EXPORT_SYMBOL_GPL(default_iommu_map_sg);
+EXPORT_SYMBOL_GPL(iommu_map_sg);
 
 int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
                               phys_addr_t paddr, u64 size, int prot)
index 40ae6e87cb8802232b58d7b29f84d3f82930d7c2..c9ce27cfa7e8b834bdf965b57c0a355a38741955 100644 (file)
@@ -889,7 +889,6 @@ static const struct iommu_ops ipmmu_ops = {
        .unmap = ipmmu_unmap,
        .flush_iotlb_all = ipmmu_iotlb_sync,
        .iotlb_sync = ipmmu_iotlb_sync,
-       .map_sg = default_iommu_map_sg,
        .iova_to_phys = ipmmu_iova_to_phys,
        .add_device = ipmmu_add_device,
        .remove_device = ipmmu_remove_device,
index 0d3350463a3f48fe783e8fb6821e92ff1163f0b4..cdf6ab22ede953f6ddf9f67fa9214e903c37d470 100644 (file)
@@ -708,7 +708,6 @@ static struct iommu_ops msm_iommu_ops = {
        .detach_dev = msm_iommu_detach_dev,
        .map = msm_iommu_map,
        .unmap = msm_iommu_unmap,
-       .map_sg = default_iommu_map_sg,
        .iova_to_phys = msm_iommu_iova_to_phys,
        .add_device = msm_iommu_add_device,
        .remove_device = msm_iommu_remove_device,
index f2832a10fcea29befea161da78adda8e3ae3472c..f9f69f7111a91e99c1552e16533afac7d0d5f275 100644 (file)
@@ -495,7 +495,6 @@ static struct iommu_ops mtk_iommu_ops = {
        .detach_dev     = mtk_iommu_detach_device,
        .map            = mtk_iommu_map,
        .unmap          = mtk_iommu_unmap,
-       .map_sg         = default_iommu_map_sg,
        .flush_iotlb_all = mtk_iommu_iotlb_sync,
        .iotlb_sync     = mtk_iommu_iotlb_sync,
        .iova_to_phys   = mtk_iommu_iova_to_phys,
index a7c2a973784f3d4209d9b34de328a66102fee75f..676c029494e44cc4a8eaf9af26e47d5e9ba40e02 100644 (file)
@@ -531,7 +531,6 @@ static struct iommu_ops mtk_iommu_ops = {
        .detach_dev     = mtk_iommu_detach_device,
        .map            = mtk_iommu_map,
        .unmap          = mtk_iommu_unmap,
-       .map_sg         = default_iommu_map_sg,
        .iova_to_phys   = mtk_iommu_iova_to_phys,
        .add_device     = mtk_iommu_add_device,
        .remove_device  = mtk_iommu_remove_device,
index af4a8e7fcd27453f160788c93c660f7cf39ff3ab..86d64ff507fae3b322bd61e8696181f9443c37f2 100644 (file)
@@ -1548,7 +1548,6 @@ static const struct iommu_ops omap_iommu_ops = {
        .detach_dev     = omap_iommu_detach_dev,
        .map            = omap_iommu_map,
        .unmap          = omap_iommu_unmap,
-       .map_sg         = default_iommu_map_sg,
        .iova_to_phys   = omap_iommu_iova_to_phys,
        .add_device     = omap_iommu_add_device,
        .remove_device  = omap_iommu_remove_device,
index fe88a4880d3af0fbd3eaa2953ffbc8f9f07fc23b..6e914b3a2b4b6d2c04110982bc228b33062a0146 100644 (file)
@@ -590,7 +590,6 @@ static const struct iommu_ops qcom_iommu_ops = {
        .detach_dev     = qcom_iommu_detach_dev,
        .map            = qcom_iommu_map,
        .unmap          = qcom_iommu_unmap,
-       .map_sg         = default_iommu_map_sg,
        .flush_iotlb_all = qcom_iommu_iotlb_sync,
        .iotlb_sync     = qcom_iommu_iotlb_sync,
        .iova_to_phys   = qcom_iommu_iova_to_phys,
index 054cd2c8e9c8a670ee2c4fc23fe9ae3a6f78e41a..90625cdd3b6684e81533aa9d6c7a9d401761bb64 100644 (file)
@@ -1110,7 +1110,6 @@ static const struct iommu_ops rk_iommu_ops = {
        .detach_dev = rk_iommu_detach_device,
        .map = rk_iommu_map,
        .unmap = rk_iommu_unmap,
-       .map_sg = default_iommu_map_sg,
        .add_device = rk_iommu_add_device,
        .remove_device = rk_iommu_remove_device,
        .iova_to_phys = rk_iommu_iova_to_phys,
index a004f6da35f21f0d751eeefce10c65de3a3c08a0..7b1361d57a17f043c809d5515591d1f1568862bc 100644 (file)
@@ -377,7 +377,6 @@ static const struct iommu_ops gart_iommu_ops = {
        .remove_device  = gart_iommu_remove_device,
        .device_group   = generic_device_group,
        .map            = gart_iommu_map,
-       .map_sg         = default_iommu_map_sg,
        .unmap          = gart_iommu_unmap,
        .iova_to_phys   = gart_iommu_iova_to_phys,
        .pgsize_bitmap  = GART_IOMMU_PGSIZES,
index 44d40bc771b516d52b91928f5441748918b557fa..0d03341317c466be5f71d6dd7cae5d53939eef26 100644 (file)
@@ -876,7 +876,6 @@ static const struct iommu_ops tegra_smmu_ops = {
        .device_group = tegra_smmu_device_group,
        .map = tegra_smmu_map,
        .unmap = tegra_smmu_unmap,
-       .map_sg = default_iommu_map_sg,
        .iova_to_phys = tegra_smmu_iova_to_phys,
        .of_xlate = tegra_smmu_of_xlate,
        .pgsize_bitmap = SZ_4K,
index 7447b0b0579a97c2e7eec12c15fb435f1f025ab6..87994c265bf5068cc31381623629521f59cf4aa2 100644 (file)
@@ -166,8 +166,6 @@ struct iommu_resv_region {
  * @detach_dev: detach device from an iommu domain
  * @map: map a physically contiguous memory region to an iommu domain
  * @unmap: unmap a physically contiguous memory region from an iommu domain
- * @map_sg: map a scatter-gather list of physically contiguous memory chunks
- *          to an iommu domain
  * @flush_tlb_all: Synchronously flush all hardware TLBs for this domain
  * @tlb_range_add: Add a given iova range to the flush queue for this domain
  * @tlb_sync: Flush all queued ranges from the hardware TLBs and empty flush
@@ -201,8 +199,6 @@ struct iommu_ops {
                   phys_addr_t paddr, size_t size, int prot);
        size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
                     size_t size);
-       size_t (*map_sg)(struct iommu_domain *domain, unsigned long iova,
-                        struct scatterlist *sg, unsigned int nents, int prot);
        void (*flush_iotlb_all)(struct iommu_domain *domain);
        void (*iotlb_range_add)(struct iommu_domain *domain,
                                unsigned long iova, size_t size);
@@ -303,9 +299,8 @@ extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
                          size_t size);
 extern size_t iommu_unmap_fast(struct iommu_domain *domain,
                               unsigned long iova, size_t size);
-extern size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
-                               struct scatterlist *sg,unsigned int nents,
-                               int prot);
+extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
+                          struct scatterlist *sg,unsigned int nents, int prot);
 extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
 extern void iommu_set_fault_handler(struct iommu_domain *domain,
                        iommu_fault_handler_t handler, void *token);
@@ -378,13 +373,6 @@ static inline void iommu_tlb_sync(struct iommu_domain *domain)
                domain->ops->iotlb_sync(domain);
 }
 
-static inline size_t iommu_map_sg(struct iommu_domain *domain,
-                                 unsigned long iova, struct scatterlist *sg,
-                                 unsigned int nents, int prot)
-{
-       return domain->ops->map_sg(domain, iova, sg, nents, prot);
-}
-
 /* PCI device grouping function */
 extern struct iommu_group *pci_device_group(struct device *dev);
 /* Generic device grouping function */