linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] IOMMU: Some IOVA code tidy-up
@ 2020-12-03 18:34 John Garry
  2020-12-03 18:34 ` [PATCH 1/3] iommu: Delete split_and_remove_iova() John Garry
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: John Garry @ 2020-12-03 18:34 UTC (permalink / raw)
  To: joro, will
  Cc: iommu, linux-kernel, linuxarm, 0x7f454c46, robin.murphy, 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/6e09d847-fb7f-1ec1-02bf-f0c8b315845f@huawei.com/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(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] iommu: Delete split_and_remove_iova()
  2020-12-03 18:34 [PATCH 0/3] IOMMU: Some IOVA code tidy-up John Garry
@ 2020-12-03 18:34 ` John Garry
  2020-12-03 18:34 ` [PATCH 2/3] iommu: Stop exporting alloc_iova_mem() John Garry
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: John Garry @ 2020-12-03 18:34 UTC (permalink / raw)
  To: joro, will
  Cc: iommu, linux-kernel, linuxarm, 0x7f454c46, robin.murphy, John Garry

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.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/iommu/iova.c | 41 -----------------------------------------
 include/linux/iova.h | 10 ----------
 2 files changed, 51 deletions(-)

diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index ea04a88c673d..4803bd83447d 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -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
diff --git a/include/linux/iova.h b/include/linux/iova.h
index a0637abffee8..a77add571c50 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -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)
 {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] iommu: Stop exporting alloc_iova_mem()
  2020-12-03 18:34 [PATCH 0/3] IOMMU: Some IOVA code tidy-up John Garry
  2020-12-03 18:34 ` [PATCH 1/3] iommu: Delete split_and_remove_iova() John Garry
@ 2020-12-03 18:34 ` John Garry
  2020-12-03 18:34 ` [PATCH 3/3] iommu: Stop exporting free_iova_mem() John Garry
  2020-12-08 15:54 ` [PATCH 0/3] IOMMU: Some IOVA code tidy-up Will Deacon
  3 siblings, 0 replies; 5+ messages in thread
From: John Garry @ 2020-12-03 18:34 UTC (permalink / raw)
  To: joro, will
  Cc: iommu, linux-kernel, linuxarm, 0x7f454c46, robin.murphy, John Garry

It is not used outside iova.c

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/iommu/iova.c | 3 +--
 include/linux/iova.h | 6 ------
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index 4803bd83447d..9fed0b040747 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -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)
 {
diff --git a/include/linux/iova.h b/include/linux/iova.h
index a77add571c50..d8c011b6d4ed 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -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)
 {
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] iommu: Stop exporting free_iova_mem()
  2020-12-03 18:34 [PATCH 0/3] IOMMU: Some IOVA code tidy-up John Garry
  2020-12-03 18:34 ` [PATCH 1/3] iommu: Delete split_and_remove_iova() John Garry
  2020-12-03 18:34 ` [PATCH 2/3] iommu: Stop exporting alloc_iova_mem() John Garry
@ 2020-12-03 18:34 ` John Garry
  2020-12-08 15:54 ` [PATCH 0/3] IOMMU: Some IOVA code tidy-up Will Deacon
  3 siblings, 0 replies; 5+ messages in thread
From: John Garry @ 2020-12-03 18:34 UTC (permalink / raw)
  To: joro, will
  Cc: iommu, linux-kernel, linuxarm, 0x7f454c46, robin.murphy, John Garry

It has no user outside iova.c

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/iommu/iova.c | 3 +--
 include/linux/iova.h | 5 -----
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index 9fed0b040747..f68fe4c0df28 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -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)
 {
diff --git a/include/linux/iova.h b/include/linux/iova.h
index d8c011b6d4ed..76e16ae20729 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -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)
 {
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] IOMMU: Some IOVA code tidy-up
  2020-12-03 18:34 [PATCH 0/3] IOMMU: Some IOVA code tidy-up John Garry
                   ` (2 preceding siblings ...)
  2020-12-03 18:34 ` [PATCH 3/3] iommu: Stop exporting free_iova_mem() John Garry
@ 2020-12-08 15:54 ` Will Deacon
  3 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2020-12-08 15:54 UTC (permalink / raw)
  To: joro, John Garry
  Cc: catalin.marinas, kernel-team, Will Deacon, linuxarm, iommu,
	robin.murphy, linux-kernel, 0x7f454c46

On Fri, 4 Dec 2020 02:34:49 +0800, John Garry wrote:
> This series contains some minor tidy-ups by deleting an unreferenced
> function and unexporting some functions, highlighted by:
> https://lore.kernel.org/linux-iommu/6e09d847-fb7f-1ec1-02bf-f0c8b315845f@huawei.com/T/#med5a019f9d3835c162c16a48f34d05cc0111b0ca
> 
> John Garry (3):
>   iommu: Delete split_and_remove_iova()
>   iommu: Stop exporting alloc_iova_mem()
>   iommu: Stop exporting free_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,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-08 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 18:34 [PATCH 0/3] IOMMU: Some IOVA code tidy-up John Garry
2020-12-03 18:34 ` [PATCH 1/3] iommu: Delete split_and_remove_iova() John Garry
2020-12-03 18:34 ` [PATCH 2/3] iommu: Stop exporting alloc_iova_mem() John Garry
2020-12-03 18:34 ` [PATCH 3/3] iommu: Stop exporting free_iova_mem() John Garry
2020-12-08 15:54 ` [PATCH 0/3] IOMMU: Some IOVA code tidy-up Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).