IOMMU: Some IOVA code tidy-up
Subsystems (2)
cover IOMMU: Some IOVA code tidy-up
This series contains some minor tidy-ups by deleting an unreferenced function and unexporting some functions, highlighted by:
https://lore.kernel.org/linux-iommu/[email protected]/T/#med5a019f9d3835c162c16a48f34d05cc0111b0ca
John Garry (3):
iommu: Delete split_and_remove_iova()
iommu: Stop exporting alloc_iova_mem()
iommu: Stop exporting free_iova_mem()
drivers/iommu/iova.c | 47 ++------------------------------------------ include/linux/iova.h | 21 -------------------- 2 files changed, 2 insertions(+), 66 deletions(-)
Signature · 6 lines
2.26.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 1/3 iommu: Delete split_and_remove_iova()
Function split_and_remove_iova() has not been referenced since commit e70b081c6f37 ("iommu/vt-d: Remove IOVA handling code from the non-dma_ops path"), so delete it.
--- drivers/iommu/iova.c | 41 ----------------------------------------- include/linux/iova.h | 10 ---------- 2 files changed, 51 deletions(-)
drivers/iommu/iova.c +0 -41
@@ -738,47 +738,6 @@ copy_reserved_iova(struct iova_domain *from, struct iova_domain *to) }EXPORT_SYMBOL_GPL (copy_reserved_iova); -struct iova * -split_and_remove_iova (struct iova_domain *iovad,struct iova *iova, -unsigned long pfn_lo,unsigned long pfn_hi) -{ -unsigned long flags; -struct iova *prev =NULL , *next =NULL ; - -spin_lock_irqsave (&iovad->iova_rbtree_lock, flags); -if (iova->pfn_lo < pfn_lo) { - prev =alloc_and_init_iova (iova->pfn_lo, pfn_lo -1 ); -if (prev ==NULL ) - goto error; - } -if (iova->pfn_hi > pfn_hi) { - next =alloc_and_init_iova (pfn_hi +1 , iova->pfn_hi); -if (next ==NULL ) - goto error; - } - -__cached_rbnode_delete_update (iovad, iova); -rb_erase (&iova->node, &iovad->rbroot); - -if (prev) { -iova_insert_rbtree (&iovad->rbroot, prev,NULL ); - iova->pfn_lo = pfn_lo; - } -if (next) { -iova_insert_rbtree (&iovad->rbroot, next,NULL ); - iova->pfn_hi = pfn_hi; - } -spin_unlock_irqrestore (&iovad->iova_rbtree_lock, flags); - -return iova; - -error: -spin_unlock_irqrestore (&iovad->iova_rbtree_lock, flags); -if (prev) -free_iova_mem (prev); -return NULL ; -} -/* * Magazine caches for IOVA ranges. For an introduction to magazines, * see the USENIX 2001 paper "Magazines and Vmem: Extending the Slab
include/linux/iova.h +0 -10
@@ -160,8 +160,6 @@ int init_iova_flush_queue(struct iova_domain *iovad, iova_flush_cb flush_cb, iova_entry_dtor entry_dtor);struct iova *find_iova (struct iova_domain *iovad,unsigned long pfn);void put_iova_domain (struct iova_domain *iovad); -struct iova *split_and_remove_iova (struct iova_domain *iovad, -struct iova *iova,unsigned long pfn_lo,unsigned long pfn_hi);void free_cpu_cached_iovas (unsigned int cpu,struct iova_domain *iovad);#else static inline int iova_cache_get (void )
@@ -258,14 +256,6 @@ static inline void put_iova_domain(struct iova_domain *iovad) { } -static inline struct iova *split_and_remove_iova (struct iova_domain *iovad, -struct iova *iova, -unsigned long pfn_lo, -unsigned long pfn_hi) -{ -return NULL ; -} -static inline void free_cpu_cached_iovas (unsigned int cpu,struct iova_domain *iovad) {
Signature · 6 lines
2.26.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 2/3 iommu: Stop exporting alloc_iova_mem()
In reply to John GarryIt is not used outside iova.c
--- drivers/iommu/iova.c | 3 +-- include/linux/iova.h | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-)
drivers/iommu/iova.c +1 -2
@@ -243,11 +243,10 @@ static struct kmem_cache *iova_cache;static unsigned int iova_cache_users;static DEFINE_MUTEX (iova_cache_mutex); -struct iova *alloc_iova_mem (void ) +static struct iova *alloc_iova_mem (void ) {return kmem_cache_zalloc (iova_cache,GFP_ATOMIC | __GFP_NOWARN); } -EXPORT_SYMBOL (alloc_iova_mem);void free_iova_mem (struct iova *iova) {
include/linux/iova.h +0 -6
@@ -136,7 +136,6 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova)int iova_cache_get (void );void iova_cache_put (void ); -struct iova *alloc_iova_mem (void );void free_iova_mem (struct iova *iova);void free_iova (struct iova_domain *iovad,unsigned long pfn);void __free_iova (struct iova_domain *iovad,struct iova *iova);
@@ -171,11 +170,6 @@ static inline void iova_cache_put(void) { } -static inline struct iova *alloc_iova_mem (void ) -{ -return NULL ; -} -static inline void free_iova_mem (struct iova *iova) { }
Signature · 6 lines
2.26.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 3/3 iommu: Stop exporting free_iova_mem()
In reply to John GarryIt has no user outside iova.c
--- drivers/iommu/iova.c | 3 +-- include/linux/iova.h | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-)
drivers/iommu/iova.c +1 -2
@@ -248,12 +248,11 @@ static struct iova *alloc_iova_mem(void)return kmem_cache_zalloc (iova_cache,GFP_ATOMIC | __GFP_NOWARN); } -void free_iova_mem (struct iova *iova) +static void free_iova_mem (struct iova *iova) {if (iova->pfn_lo !=IOVA_ANCHOR )kmem_cache_free (iova_cache, iova); } -EXPORT_SYMBOL (free_iova_mem);int iova_cache_get (void ) {
include/linux/iova.h +0 -5
@@ -136,7 +136,6 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova)int iova_cache_get (void );void iova_cache_put (void ); -void free_iova_mem (struct iova *iova);void free_iova (struct iova_domain *iovad,unsigned long pfn);void __free_iova (struct iova_domain *iovad,struct iova *iova); struct iova *alloc_iova(struct iova_domain *iovad, unsigned long size,
@@ -170,10 +169,6 @@ static inline void iova_cache_put(void) { } -static inline void free_iova_mem (struct iova *iova) -{ -} -static inline void free_iova (struct iova_domain *iovad,unsigned long pfn) { }
Signature · 6 lines
2.26.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 10 lines · John Garry
This series contains some minor tidy-ups by deleting an unreferenced function and unexporting some functions, highlighted by:
https://lore.kernel.org/linux-iommu/[email protected]/T/#med5a019f9d3835c162c16a48f34d05cc0111b0caJohn Garry (3):
iommu: Deletesplit_and_remove_iova()
iommu: Stop exportingalloc_iova_mem()
iommu: Stop exportingfree_iova_mem()[...]
Applied to arm64 (for-next/iommu/iova), thanks!
[1/3] iommu: Delete split_and_remove_iova()
https://git.kernel.org/arm64/c/2f24dfb71208 [2/3] iommu: Stop exporting alloc_iova_mem() https://git.kernel.org/arm64/c/51b70b817b18 [3/3] iommu: Stop exporting free_iova_mem() https://git.kernel.org/arm64/c/176cfc187c24
Cheers,
Signature · 9 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu