diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 7990f65db16d..6f0ba38aaeea 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -1267,13 +1267,6 @@ void iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size) dev->dma_ops = &iommu_dma_ops; } - if (domain->type == IOMMU_DOMAIN_DMA) { - struct iommu_dma_cookie *cookie = domain->iova_cookie; - struct iova_domain *iovad = &cookie->iovad; - - init_iova_domain_procfs(iovad, dev_name(dev)); - } - return; out_err: pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n", diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index 9d05beba3e6c..95c9f79b8c1f 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -11,8 +11,6 @@ #include #include #include -#include -#include /* The anchor node sits above the top of the usable address space */ #define IOVA_ANCHOR ~0UL @@ -27,66 +25,6 @@ static void init_iova_rcaches(struct iova_domain *iovad); static void free_iova_rcaches(struct iova_domain *iovad); static void fq_destroy_all_entries(struct iova_domain *iovad); static void fq_flush_timeout(struct timer_list *t); -static void iova_dump(struct iova_domain *iovad); - -static int iova_used_show(struct seq_file *s, void *v) -{ - struct iova_domain *iovad = s->private; - struct iova *iova, *t; - unsigned long flags; - unsigned long used_pfn = 0; - unsigned int cpu; - int i = 0; - - for_each_online_cpu(cpu) - free_cpu_cached_iovas(cpu, iovad); - free_global_cached_iovas(iovad); - - spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); - rbtree_postorder_for_each_entry_safe(iova, t, &iovad->rbroot, node) { - dma_addr_t start = iova->pfn_lo << iova_shift(iovad); - dma_addr_t end = iova->pfn_hi << iova_shift(iovad); - unsigned long pfn = iova->pfn_hi + 1 - iova->pfn_lo; - - if ((iova->pfn_hi == IOVA_ANCHOR) || (iova->pfn_lo == IOVA_ANCHOR)) - continue; - - seq_printf(s, "%4d: [%pad..%pad] %6luKiB (%4lu - %4lu)MiB\n", - i++, &start, &end, - pfn << (PAGE_SHIFT - 10), - iova->pfn_lo >> (20 - PAGE_SHIFT), - (iova->pfn_hi + 1) >> (20 - PAGE_SHIFT)); - used_pfn += pfn; - } - spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); - seq_printf(s, "used: %lu MiB\n", used_pfn >> (20 - PAGE_SHIFT)); - - return 0; -} - -static struct proc_dir_entry *iova_dir; - -void init_iova_domain_procfs(struct iova_domain *iovad, const char *name) -{ - struct proc_dir_entry *root; - - remove_proc_subtree(name, iova_dir); - root = proc_mkdir(name, iova_dir); - if (!root) - return; - - proc_create_single_data("used", 0, root, iova_used_show, iovad); -} -EXPORT_SYMBOL_GPL(init_iova_domain_procfs); - -static int __init iova_procfs_create(void) -{ - if (!iova_dir) - iova_dir = proc_mkdir("iova", NULL); - - return 0; -} -subsys_initcall(iova_procfs_create); void init_iova_domain(struct iova_domain *iovad, unsigned long granule, @@ -585,10 +523,8 @@ retry: if (!new_iova) { unsigned int cpu; - if (!flush_rcache) { - iova_dump(iovad); + if (!flush_rcache) return 0; - } /* Try replenishing IOVAs by flushing rcache. */ flush_rcache = false; @@ -951,32 +887,6 @@ struct iova_cpu_rcache { struct iova_magazine *prev; }; -static void iova_dump(struct iova_domain *iovad) -{ - struct iova *iova, *t; - unsigned long flags; - unsigned long used_pfn = 0; - int i = 0; - - spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); - rbtree_postorder_for_each_entry_safe(iova, t, &iovad->rbroot, node) { - dma_addr_t start = iova->pfn_lo << iova_shift(iovad); - dma_addr_t end = iova->pfn_hi << iova_shift(iovad); - unsigned long pfn = iova->pfn_hi + 1 - iova->pfn_lo; - - if (iova->pfn_lo == IOVA_ANCHOR) - continue; - - pr_info("%4d: [%pad..%pad] (%4lu - %4lu)MiB\n", - i++, &start, &end, - iova->pfn_lo >> (20 - PAGE_SHIFT), - iova->pfn_hi >> (20 - PAGE_SHIFT)); - used_pfn += pfn; - } - spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); - pr_info("used: %lu MiB\n", used_pfn >> (20 - PAGE_SHIFT)); -} - static struct iova_magazine *iova_magazine_alloc(gfp_t flags) { return kzalloc(sizeof(struct iova_magazine), flags); diff --git a/include/linux/iova.h b/include/linux/iova.h index 95f5cbf3ab3c..0394d44f726e 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h @@ -156,7 +156,6 @@ struct iova *reserve_iova(struct iova_domain *iovad, unsigned long pfn_lo, void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to); void init_iova_domain(struct iova_domain *iovad, unsigned long granule, unsigned long start_pfn); -void init_iova_domain_procfs(struct iova_domain *iovad, const char *name); bool has_iova_flush_queue(struct iova_domain *iovad); int init_iova_flush_queue(struct iova_domain *iovad, iova_flush_cb flush_cb, iova_entry_dtor entry_dtor); @@ -239,11 +238,6 @@ static inline void init_iova_domain(struct iova_domain *iovad, { } -static inline void -init_iova_domain_procfs(struct iova_domain *iovad, const char *name) -{ -} - static inline bool has_iova_flush_queue(struct iova_domain *iovad) { return false;