iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up
@ 2021-01-06 13:35 John Garry
  2021-01-06 13:35 ` [PATCH v2 1/6] iova: Make has_iova_flush_queue() private John Garry
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: John Garry @ 2021-01-06 13:35 UTC (permalink / raw)
  To: joro, will; +Cc: iommu, robin.murphy, linux-kernel

Just some tidy-up to IOVA and core code.

Based on v5.11-rc2

Differences to v1:
- Add core IOMMU patches

John Garry (6):
  iova: Make has_iova_flush_queue() private
  iova: Delete copy_reserved_iova()
  iova: Stop exporting some more functions
  iommu: Stop exporting iommu_map_sg_atomic()
  iommu: Delete iommu_domain_window_disable()
  iommu: Delete iommu_dev_has_feature()

 drivers/iommu/iommu.c | 21 ---------------------
 drivers/iommu/iova.c  | 36 +-----------------------------------
 include/linux/iommu.h | 13 -------------
 include/linux/iova.h  | 12 ------------
 4 files changed, 1 insertion(+), 81 deletions(-)

-- 
2.26.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* [PATCH v2 1/6] iova: Make has_iova_flush_queue() private
  2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
@ 2021-01-06 13:35 ` John Garry
  2021-01-06 13:35 ` [PATCH v2 2/6] iova: Delete copy_reserved_iova() John Garry
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2021-01-06 13:35 UTC (permalink / raw)
  To: joro, will; +Cc: iommu, robin.murphy, linux-kernel

Function has_iova_flush_queue() has no users outside iova.c, so make it
private.

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

diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index 4bb3293ae4d7..0a758ec2a1c4 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -55,7 +55,7 @@ init_iova_domain(struct iova_domain *iovad, unsigned long granule,
 }
 EXPORT_SYMBOL_GPL(init_iova_domain);
 
-bool has_iova_flush_queue(struct iova_domain *iovad)
+static bool has_iova_flush_queue(struct iova_domain *iovad)
 {
 	return !!iovad->fq;
 }
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 76e16ae20729..2b76e0be1c5b 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -153,7 +153,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);
-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);
 struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn);
@@ -223,11 +222,6 @@ static inline void init_iova_domain(struct iova_domain *iovad,
 {
 }
 
-static inline bool has_iova_flush_queue(struct iova_domain *iovad)
-{
-	return false;
-}
-
 static inline int init_iova_flush_queue(struct iova_domain *iovad,
 					iova_flush_cb flush_cb,
 					iova_entry_dtor entry_dtor)
-- 
2.26.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* [PATCH v2 2/6] iova: Delete copy_reserved_iova()
  2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
  2021-01-06 13:35 ` [PATCH v2 1/6] iova: Make has_iova_flush_queue() private John Garry
@ 2021-01-06 13:35 ` John Garry
  2021-01-06 13:35 ` [PATCH v2 3/6] iova: Stop exporting some more functions John Garry
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2021-01-06 13:35 UTC (permalink / raw)
  To: joro, will; +Cc: iommu, robin.murphy, linux-kernel

Since commit c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the
iommu ops"), function copy_reserved_iova() is not referenced, so delete
it.

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

diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index 0a758ec2a1c4..04f0a3ae1c63 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -710,36 +710,6 @@ reserve_iova(struct iova_domain *iovad,
 }
 EXPORT_SYMBOL_GPL(reserve_iova);
 
-/**
- * copy_reserved_iova - copies the reserved between domains
- * @from: - source doamin from where to copy
- * @to: - destination domin where to copy
- * This function copies reserved iova's from one doamin to
- * other.
- */
-void
-copy_reserved_iova(struct iova_domain *from, struct iova_domain *to)
-{
-	unsigned long flags;
-	struct rb_node *node;
-
-	spin_lock_irqsave(&from->iova_rbtree_lock, flags);
-	for (node = rb_first(&from->rbroot); node; node = rb_next(node)) {
-		struct iova *iova = rb_entry(node, struct iova, node);
-		struct iova *new_iova;
-
-		if (iova->pfn_lo == IOVA_ANCHOR)
-			continue;
-
-		new_iova = reserve_iova(to, iova->pfn_lo, iova->pfn_hi);
-		if (!new_iova)
-			pr_err("Reserve iova range %lx@%lx failed\n",
-			       iova->pfn_lo, iova->pfn_lo);
-	}
-	spin_unlock_irqrestore(&from->iova_rbtree_lock, flags);
-}
-EXPORT_SYMBOL_GPL(copy_reserved_iova);
-
 /*
  * 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 2b76e0be1c5b..c834c01c0a5b 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -150,7 +150,6 @@ unsigned long alloc_iova_fast(struct iova_domain *iovad, unsigned long size,
 			      unsigned long limit_pfn, bool flush_rcache);
 struct iova *reserve_iova(struct iova_domain *iovad, unsigned long pfn_lo,
 	unsigned long pfn_hi);
-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);
 int init_iova_flush_queue(struct iova_domain *iovad,
@@ -211,11 +210,6 @@ static inline struct iova *reserve_iova(struct iova_domain *iovad,
 	return NULL;
 }
 
-static inline void copy_reserved_iova(struct iova_domain *from,
-				      struct iova_domain *to)
-{
-}
-
 static inline void init_iova_domain(struct iova_domain *iovad,
 				    unsigned long granule,
 				    unsigned long start_pfn)
-- 
2.26.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* [PATCH v2 3/6] iova: Stop exporting some more functions
  2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
  2021-01-06 13:35 ` [PATCH v2 1/6] iova: Make has_iova_flush_queue() private John Garry
  2021-01-06 13:35 ` [PATCH v2 2/6] iova: Delete copy_reserved_iova() John Garry
@ 2021-01-06 13:35 ` John Garry
  2021-01-06 13:35 ` [PATCH v2 4/6] iommu: Stop exporting iommu_map_sg_atomic() John Garry
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2021-01-06 13:35 UTC (permalink / raw)
  To: joro, will; +Cc: iommu, robin.murphy, linux-kernel

The following functions are not referenced outside dma-iommu.c (and
iova.c), which can only be built-in:
- init_iova_flush_queue()
- free_iova_fast()
- queue_iova()
- alloc_iova_fast()

So stop exporting them.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/iommu/iova.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index 04f0a3ae1c63..f9c35852018d 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -112,7 +112,6 @@ int init_iova_flush_queue(struct iova_domain *iovad,
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(init_iova_flush_queue);
 
 static struct rb_node *
 __get_cached_rbnode(struct iova_domain *iovad, unsigned long limit_pfn)
@@ -451,7 +450,6 @@ alloc_iova_fast(struct iova_domain *iovad, unsigned long size,
 
 	return new_iova->pfn_lo;
 }
-EXPORT_SYMBOL_GPL(alloc_iova_fast);
 
 /**
  * free_iova_fast - free iova pfn range into rcache
@@ -469,7 +467,6 @@ free_iova_fast(struct iova_domain *iovad, unsigned long pfn, unsigned long size)
 
 	free_iova(iovad, pfn);
 }
-EXPORT_SYMBOL_GPL(free_iova_fast);
 
 #define fq_ring_for_each(i, fq) \
 	for ((i) = (fq)->head; (i) != (fq)->tail; (i) = ((i) + 1) % IOVA_FQ_SIZE)
@@ -598,7 +595,6 @@ void queue_iova(struct iova_domain *iovad,
 		mod_timer(&iovad->fq_timer,
 			  jiffies + msecs_to_jiffies(IOVA_FQ_TIMEOUT));
 }
-EXPORT_SYMBOL_GPL(queue_iova);
 
 /**
  * put_iova_domain - destroys the iova doamin
-- 
2.26.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* [PATCH v2 4/6] iommu: Stop exporting iommu_map_sg_atomic()
  2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
                   ` (2 preceding siblings ...)
  2021-01-06 13:35 ` [PATCH v2 3/6] iova: Stop exporting some more functions John Garry
@ 2021-01-06 13:35 ` John Garry
  2021-01-06 13:35 ` [PATCH v2 5/6] iommu: Delete iommu_domain_window_disable() John Garry
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2021-01-06 13:35 UTC (permalink / raw)
  To: joro, will; +Cc: iommu, robin.murphy, linux-kernel

Function iommu_map_sg_atomic() is only referenced in dma-iommu.c, which
can only be built-in, so stop exporting.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/iommu/iommu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index ffeebda8d6de..4f4edb087ce6 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2586,7 +2586,6 @@ size_t iommu_map_sg_atomic(struct iommu_domain *domain, unsigned long iova,
 {
 	return __iommu_map_sg(domain, iova, sg, nents, prot, GFP_ATOMIC);
 }
-EXPORT_SYMBOL_GPL(iommu_map_sg_atomic);
 
 int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
 			       phys_addr_t paddr, u64 size, int prot)
-- 
2.26.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* [PATCH v2 5/6] iommu: Delete iommu_domain_window_disable()
  2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
                   ` (3 preceding siblings ...)
  2021-01-06 13:35 ` [PATCH v2 4/6] iommu: Stop exporting iommu_map_sg_atomic() John Garry
@ 2021-01-06 13:35 ` John Garry
  2021-01-06 13:35 ` [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature() John Garry
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2021-01-06 13:35 UTC (permalink / raw)
  To: joro, will; +Cc: iommu, robin.murphy, linux-kernel

Function iommu_domain_window_disable() is not referenced in the tree, so
delete it.

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

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 4f4edb087ce6..20201ef97b8f 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2598,15 +2598,6 @@ int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
 }
 EXPORT_SYMBOL_GPL(iommu_domain_window_enable);
 
-void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr)
-{
-	if (unlikely(domain->ops->domain_window_disable == NULL))
-		return;
-
-	return domain->ops->domain_window_disable(domain, wnd_nr);
-}
-EXPORT_SYMBOL_GPL(iommu_domain_window_disable);
-
 /**
  * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
  * @domain: the iommu domain where the fault has happened
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index b3f0e2018c62..72059fcfa108 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -514,7 +514,6 @@ extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
 extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
 				      phys_addr_t offset, u64 size,
 				      int prot);
-extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr);
 
 extern int report_iommu_fault(struct iommu_domain *domain, struct device *dev,
 			      unsigned long iova, int flags);
@@ -746,11 +745,6 @@ static inline int iommu_domain_window_enable(struct iommu_domain *domain,
 	return -ENODEV;
 }
 
-static inline void iommu_domain_window_disable(struct iommu_domain *domain,
-					       u32 wnd_nr)
-{
-}
-
 static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
 {
 	return 0;
-- 
2.26.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()
  2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
                   ` (4 preceding siblings ...)
  2021-01-06 13:35 ` [PATCH v2 5/6] iommu: Delete iommu_domain_window_disable() John Garry
@ 2021-01-06 13:35 ` John Garry
  2021-01-07  1:18   ` Lu Baolu
  2021-01-18 11:21 ` [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up Will Deacon
  2021-01-27 11:29 ` Joerg Roedel
  7 siblings, 1 reply; 12+ messages in thread
From: John Garry @ 2021-01-06 13:35 UTC (permalink / raw)
  To: joro, will; +Cc: iommu, robin.murphy, linux-kernel

Function iommu_dev_has_feature() has never been referenced in the tree,
and there does not appear to be anything coming soon to use it, so delete
it.

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

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 20201ef97b8f..91f7871f5a37 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2853,17 +2853,6 @@ EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids);
 /*
  * Per device IOMMU features.
  */
-bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat)
-{
-	const struct iommu_ops *ops = dev->bus->iommu_ops;
-
-	if (ops && ops->dev_has_feat)
-		return ops->dev_has_feat(dev, feat);
-
-	return false;
-}
-EXPORT_SYMBOL_GPL(iommu_dev_has_feature);
-
 int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
 {
 	const struct iommu_ops *ops = dev->bus->iommu_ops;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 72059fcfa108..91d94c014f47 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -626,7 +626,6 @@ static inline void dev_iommu_priv_set(struct device *dev, void *priv)
 int iommu_probe_device(struct device *dev);
 void iommu_release_device(struct device *dev);
 
-bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features f);
 int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f);
 int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f);
 bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features f);
@@ -975,12 +974,6 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
 	return NULL;
 }
 
-static inline bool
-iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat)
-{
-	return false;
-}
-
 static inline bool
 iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
 {
-- 
2.26.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()
  2021-01-06 13:35 ` [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature() John Garry
@ 2021-01-07  1:18   ` Lu Baolu
  2021-01-07  9:13     ` John Garry
  2021-01-09  9:09     ` Christoph Hellwig
  0 siblings, 2 replies; 12+ messages in thread
From: Lu Baolu @ 2021-01-07  1:18 UTC (permalink / raw)
  To: John Garry, joro, will; +Cc: iommu, robin.murphy, linux-kernel

On 1/6/21 9:35 PM, John Garry wrote:
> Function iommu_dev_has_feature() has never been referenced in the tree,
> and there does not appear to be anything coming soon to use it, so delete
> it.

It will be used by the device driver which want to support the aux-
domain capability, for example, below series is under discussion.

https://lore.kernel.org/linux-pci/160408357912.912050.17005584526266191420.stgit@djiang5-desk3.ch.intel.com/

The typical use case is

         if (iommu_dev_has_feature(dev, IOMMU_DEV_FEAT_AUX)) {
                 rc = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_AUX);
                 if (rc < 0) {
                         dev_warn(dev, "Failed to enable aux-domain: 
%d\n", rc);
                         return rc;
                 }
         }

So please don't remove it.

Best regards,
baolu

> 
> Signed-off-by: John Garry <john.garry@huawei.com>
> ---
>   drivers/iommu/iommu.c | 11 -----------
>   include/linux/iommu.h |  7 -------
>   2 files changed, 18 deletions(-)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 20201ef97b8f..91f7871f5a37 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2853,17 +2853,6 @@ EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids);
>   /*
>    * Per device IOMMU features.
>    */
> -bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat)
> -{
> -	const struct iommu_ops *ops = dev->bus->iommu_ops;
> -
> -	if (ops && ops->dev_has_feat)
> -		return ops->dev_has_feat(dev, feat);
> -
> -	return false;
> -}
> -EXPORT_SYMBOL_GPL(iommu_dev_has_feature);
> -
>   int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
>   {
>   	const struct iommu_ops *ops = dev->bus->iommu_ops;
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index 72059fcfa108..91d94c014f47 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -626,7 +626,6 @@ static inline void dev_iommu_priv_set(struct device *dev, void *priv)
>   int iommu_probe_device(struct device *dev);
>   void iommu_release_device(struct device *dev);
>   
> -bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features f);
>   int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f);
>   int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f);
>   bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features f);
> @@ -975,12 +974,6 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
>   	return NULL;
>   }
>   
> -static inline bool
> -iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat)
> -{
> -	return false;
> -}
> -
>   static inline bool
>   iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
>   {
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()
  2021-01-07  1:18   ` Lu Baolu
@ 2021-01-07  9:13     ` John Garry
  2021-01-09  9:09     ` Christoph Hellwig
  1 sibling, 0 replies; 12+ messages in thread
From: John Garry @ 2021-01-07  9:13 UTC (permalink / raw)
  To: Lu Baolu, joro, will; +Cc: iommu, robin.murphy, linux-kernel

On 07/01/2021 01:18, Lu Baolu wrote:
> On 1/6/21 9:35 PM, John Garry wrote:
>> Function iommu_dev_has_feature() has never been referenced in the tree,
>> and there does not appear to be anything coming soon to use it, so delete
>> it.
> 

Hi baolu,

> It will be used by the device driver which want to support the aux-
> domain capability, for example, below series is under discussion.
> 
> https://lore.kernel.org/linux-pci/160408357912.912050.17005584526266191420.stgit@djiang5-desk3.ch.intel.com/ 
> 

So I did check linux-iommu lore for recent references, above, but did 
not see this one - that really should have cc'ed linux-iommu list (which 
it didn't).

> 
> The typical use case is
> 
>          if (iommu_dev_has_feature(dev, IOMMU_DEV_FEAT_AUX)) {
>                  rc = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_AUX);
>                  if (rc < 0) {
>                          dev_warn(dev, "Failed to enable aux-domain: 
> %d\n", rc);
>                          return rc;
>                  }
>          }
> 
> So please don't remove it.
> 

ok, fine. It also seems that this API has not had a user since it was 
introduced in v5.2.

Thanks,
John

Ps. I suppose a v3 series is not needed ATM - this patch can just be 
dropped.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()
  2021-01-07  1:18   ` Lu Baolu
  2021-01-07  9:13     ` John Garry
@ 2021-01-09  9:09     ` Christoph Hellwig
  1 sibling, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2021-01-09  9:09 UTC (permalink / raw)
  To: Lu Baolu; +Cc: will, linux-kernel, iommu, robin.murphy

On Thu, Jan 07, 2021 at 09:18:06AM +0800, Lu Baolu wrote:
> The typical use case is
> 
>         if (iommu_dev_has_feature(dev, IOMMU_DEV_FEAT_AUX)) {
>                 rc = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_AUX);
>                 if (rc < 0) {
>                         dev_warn(dev, "Failed to enable aux-domain: %d\n",
> rc);
>                         return rc;
>                 }
>         }
> 
> So please don't remove it.

This doesn't have an upstream user, and did not have for years!  If
new users show up they can add it back.  Note that the above API with
a separate has vs enable is horrible anyway - the right way is to just
enable and fail it with a specific error code if not supported.

We have a general rule that APIs should only be introduced with their
users, and this example just confirms the reasons of why that rule is in
place once again.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up
  2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
                   ` (5 preceding siblings ...)
  2021-01-06 13:35 ` [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature() John Garry
@ 2021-01-18 11:21 ` Will Deacon
  2021-01-27 11:29 ` Joerg Roedel
  7 siblings, 0 replies; 12+ messages in thread
From: Will Deacon @ 2021-01-18 11:21 UTC (permalink / raw)
  To: John Garry; +Cc: robin.murphy, iommu, linux-kernel

On Wed, Jan 06, 2021 at 09:35:05PM +0800, John Garry wrote:
> Just some tidy-up to IOVA and core code.
> 
> Based on v5.11-rc2
> 
> Differences to v1:
> - Add core IOMMU patches
> 
> John Garry (6):
>   iova: Make has_iova_flush_queue() private
>   iova: Delete copy_reserved_iova()
>   iova: Stop exporting some more functions
>   iommu: Stop exporting iommu_map_sg_atomic()
>   iommu: Delete iommu_domain_window_disable()
>   iommu: Delete iommu_dev_has_feature()
> 
>  drivers/iommu/iommu.c | 21 ---------------------
>  drivers/iommu/iova.c  | 36 +-----------------------------------
>  include/linux/iommu.h | 13 -------------
>  include/linux/iova.h  | 12 ------------
>  4 files changed, 1 insertion(+), 81 deletions(-)

For the series:

Acked-by: Will Deacon <will@kernel.org>

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up
  2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
                   ` (6 preceding siblings ...)
  2021-01-18 11:21 ` [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up Will Deacon
@ 2021-01-27 11:29 ` Joerg Roedel
  7 siblings, 0 replies; 12+ messages in thread
From: Joerg Roedel @ 2021-01-27 11:29 UTC (permalink / raw)
  To: John Garry; +Cc: robin.murphy, iommu, will, linux-kernel

On Wed, Jan 06, 2021 at 09:35:05PM +0800, John Garry wrote:
> Just some tidy-up to IOVA and core code.
> 
> Based on v5.11-rc2
> 
> Differences to v1:
> - Add core IOMMU patches
> 
> John Garry (6):
>   iova: Make has_iova_flush_queue() private
>   iova: Delete copy_reserved_iova()
>   iova: Stop exporting some more functions
>   iommu: Stop exporting iommu_map_sg_atomic()
>   iommu: Delete iommu_domain_window_disable()
>   iommu: Delete iommu_dev_has_feature()

Applied, thanks.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

end of thread, other threads:[~2021-01-27 11:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 13:35 [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up John Garry
2021-01-06 13:35 ` [PATCH v2 1/6] iova: Make has_iova_flush_queue() private John Garry
2021-01-06 13:35 ` [PATCH v2 2/6] iova: Delete copy_reserved_iova() John Garry
2021-01-06 13:35 ` [PATCH v2 3/6] iova: Stop exporting some more functions John Garry
2021-01-06 13:35 ` [PATCH v2 4/6] iommu: Stop exporting iommu_map_sg_atomic() John Garry
2021-01-06 13:35 ` [PATCH v2 5/6] iommu: Delete iommu_domain_window_disable() John Garry
2021-01-06 13:35 ` [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature() John Garry
2021-01-07  1:18   ` Lu Baolu
2021-01-07  9:13     ` John Garry
2021-01-09  9:09     ` Christoph Hellwig
2021-01-18 11:21 ` [PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up Will Deacon
2021-01-27 11:29 ` Joerg Roedel

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).