All of lore.kernel.org
 help / color / mirror / Atom feed
* remove dead iommu code v2
@ 2022-07-08  8:06 Christoph Hellwig
  2022-07-08  8:06 ` [PATCH 1/4] iommu: remove the unused dev_has_feat method Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Christoph Hellwig @ 2022-07-08  8:06 UTC (permalink / raw)
  To: Joerg Roedel, Sven Peter, David Woodhouse, Will Deacon,
	Robin Murphy, Lu Baolu, Yong Wu, Jean-Philippe Brucker
  Cc: iommu, linux-arm-kernel

Hi all,

this removes a bit of dead code and methods from the iommu code and the
cleans up the arm-smmu-v3 driver a little bit based on that.

Changes since v1:
 - rebased to the latest iommu/core branch
 - don't accidentally change an error code in arm_smmu_dev_enable_feature
 - add a kerneldoc comment to iommu_put_resv_regions

Diffstat:
 drivers/iommu/amd/iommu.c                   |    1 
 drivers/iommu/apple-dart.c                  |    1 
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |   58 ++++++----------------------
 drivers/iommu/arm/arm-smmu/arm-smmu.c       |    1 
 drivers/iommu/intel/iommu.c                 |    1 
 drivers/iommu/iommu.c                       |   34 +---------------
 drivers/iommu/mtk_iommu.c                   |    1 
 drivers/iommu/virtio-iommu.c                |    5 --
 include/linux/iommu.h                       |   17 --------
 9 files changed, 21 insertions(+), 98 deletions(-)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/4] iommu: remove the unused dev_has_feat method
  2022-07-08  8:06 remove dead iommu code v2 Christoph Hellwig
@ 2022-07-08  8:06 ` Christoph Hellwig
  2022-07-08  8:43   ` Baolu Lu
  2022-07-08  8:06 ` [PATCH 2/4] iommu: remove iommu_dev_feature_enabled Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2022-07-08  8:06 UTC (permalink / raw)
  To: Joerg Roedel, Sven Peter, David Woodhouse, Will Deacon,
	Robin Murphy, Lu Baolu, Yong Wu, Jean-Philippe Brucker
  Cc: iommu, linux-arm-kernel

This method is never actually called.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 -
 include/linux/iommu.h                       | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index d9c1623ec1a9a..1b6c17dd81ee4 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2853,7 +2853,6 @@ static struct iommu_ops arm_smmu_ops = {
 	.of_xlate		= arm_smmu_of_xlate,
 	.get_resv_regions	= arm_smmu_get_resv_regions,
 	.put_resv_regions	= generic_iommu_put_resv_regions,
-	.dev_has_feat		= arm_smmu_dev_has_feature,
 	.dev_feat_enabled	= arm_smmu_dev_feature_enabled,
 	.dev_enable_feat	= arm_smmu_dev_enable_feature,
 	.dev_disable_feat	= arm_smmu_dev_disable_feature,
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index e6abd998dbe73..a3acdb46b9391 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -164,8 +164,7 @@ struct iommu_iort_rmr_data {
  *			 supported, this feature must be enabled before and
  *			 disabled after %IOMMU_DEV_FEAT_SVA.
  *
- * Device drivers query whether a feature is supported using
- * iommu_dev_has_feature(), and enable it using iommu_dev_enable_feature().
+ * Device drivers enable a feature using iommu_dev_enable_feature().
  */
 enum iommu_dev_features {
 	IOMMU_DEV_FEAT_SVA,
@@ -248,7 +247,6 @@ struct iommu_ops {
 	bool (*is_attach_deferred)(struct device *dev);
 
 	/* Per device IOMMU features */
-	bool (*dev_has_feat)(struct device *dev, enum iommu_dev_features f);
 	bool (*dev_feat_enabled)(struct device *dev, enum iommu_dev_features f);
 	int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f);
 	int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f);
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/4] iommu: remove iommu_dev_feature_enabled
  2022-07-08  8:06 remove dead iommu code v2 Christoph Hellwig
  2022-07-08  8:06 ` [PATCH 1/4] iommu: remove the unused dev_has_feat method Christoph Hellwig
@ 2022-07-08  8:06 ` Christoph Hellwig
  2022-07-08  8:47   ` Baolu Lu
  2022-07-08  8:06 ` [PATCH 3/4] iommu: remove the put_resv_regions method Christoph Hellwig
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2022-07-08  8:06 UTC (permalink / raw)
  To: Joerg Roedel, Sven Peter, David Woodhouse, Will Deacon,
	Robin Murphy, Lu Baolu, Yong Wu, Jean-Philippe Brucker
  Cc: iommu, linux-arm-kernel

Remove the unused iommu_dev_feature_enabled function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  1 -
 drivers/iommu/iommu.c                       | 13 -------------
 include/linux/iommu.h                       |  9 ---------
 3 files changed, 23 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 1b6c17dd81ee4..4d30a8d2bc236 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2853,7 +2853,6 @@ static struct iommu_ops arm_smmu_ops = {
 	.of_xlate		= arm_smmu_of_xlate,
 	.get_resv_regions	= arm_smmu_get_resv_regions,
 	.put_resv_regions	= generic_iommu_put_resv_regions,
-	.dev_feat_enabled	= arm_smmu_dev_feature_enabled,
 	.dev_enable_feat	= arm_smmu_dev_enable_feature,
 	.dev_disable_feat	= arm_smmu_dev_disable_feature,
 	.sva_bind		= arm_smmu_sva_bind,
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 0aa141646bdf4..1bb016a6a2aa1 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2760,19 +2760,6 @@ int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
 }
 EXPORT_SYMBOL_GPL(iommu_dev_disable_feature);
 
-bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
-{
-	if (dev->iommu && dev->iommu->iommu_dev) {
-		const struct iommu_ops *ops = dev->iommu->iommu_dev->ops;
-
-		if (ops->dev_feat_enabled)
-			return ops->dev_feat_enabled(dev, feat);
-	}
-
-	return false;
-}
-EXPORT_SYMBOL_GPL(iommu_dev_feature_enabled);
-
 /**
  * iommu_sva_bind_device() - Bind a process address space to a device
  * @dev: the device
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a3acdb46b9391..0bc2eb14b0262 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -215,7 +215,6 @@ struct iommu_iotlb_gather {
  *                      driver init to device driver init (default no)
  * @dev_has/enable/disable_feat: per device entries to check/enable/disable
  *                               iommu specific features.
- * @dev_feat_enabled: check enabled feature
  * @sva_bind: Bind process address space to device
  * @sva_unbind: Unbind process address space from device
  * @sva_get_pasid: Get PASID associated to a SVA handle
@@ -247,7 +246,6 @@ struct iommu_ops {
 	bool (*is_attach_deferred)(struct device *dev);
 
 	/* Per device IOMMU features */
-	bool (*dev_feat_enabled)(struct device *dev, enum iommu_dev_features f);
 	int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f);
 	int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f);
 
@@ -670,7 +668,6 @@ void iommu_release_device(struct device *dev);
 
 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);
 
 struct iommu_sva *iommu_sva_bind_device(struct device *dev,
 					struct mm_struct *mm,
@@ -997,12 +994,6 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
 	return NULL;
 }
 
-static inline bool
-iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
-{
-	return false;
-}
-
 static inline int
 iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
 {
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-07-08  8:06 remove dead iommu code v2 Christoph Hellwig
  2022-07-08  8:06 ` [PATCH 1/4] iommu: remove the unused dev_has_feat method Christoph Hellwig
  2022-07-08  8:06 ` [PATCH 2/4] iommu: remove iommu_dev_feature_enabled Christoph Hellwig
@ 2022-07-08  8:06 ` Christoph Hellwig
  2022-07-08  9:00   ` Baolu Lu
  2022-07-08 10:12   ` Will Deacon
  2022-07-08  8:06 ` [PATCH 4/4] iommu/arm-smmu-v3: cleanup arm_smmu_dev_{enable,disable}_feature Christoph Hellwig
  2022-07-15  8:14 ` remove dead iommu code v2 Joerg Roedel
  4 siblings, 2 replies; 19+ messages in thread
From: Christoph Hellwig @ 2022-07-08  8:06 UTC (permalink / raw)
  To: Joerg Roedel, Sven Peter, David Woodhouse, Will Deacon,
	Robin Murphy, Lu Baolu, Yong Wu, Jean-Philippe Brucker
  Cc: iommu, linux-arm-kernel

All drivers that implement get_resv_regions just use
generic_put_resv_regions to implement the put side.  Remove the
indirections and document the allocations constraints.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/iommu/amd/iommu.c                   |  1 -
 drivers/iommu/apple-dart.c                  |  1 -
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  1 -
 drivers/iommu/arm/arm-smmu/arm-smmu.c       |  1 -
 drivers/iommu/intel/iommu.c                 |  1 -
 drivers/iommu/iommu.c                       | 21 ++++-----------------
 drivers/iommu/mtk_iommu.c                   |  1 -
 drivers/iommu/virtio-iommu.c                |  5 ++---
 include/linux/iommu.h                       |  4 ----
 9 files changed, 6 insertions(+), 30 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 840831d5d2ad9..e66e071e8c3b9 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2280,7 +2280,6 @@ const struct iommu_ops amd_iommu_ops = {
 	.probe_finalize = amd_iommu_probe_finalize,
 	.device_group = amd_iommu_device_group,
 	.get_resv_regions = amd_iommu_get_resv_regions,
-	.put_resv_regions = generic_iommu_put_resv_regions,
 	.is_attach_deferred = amd_iommu_is_attach_deferred,
 	.pgsize_bitmap	= AMD_IOMMU_PGSIZES,
 	.def_domain_type = amd_iommu_def_domain_type,
diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index e87d3cf54ed68..1b17257592626 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -768,7 +768,6 @@ static const struct iommu_ops apple_dart_iommu_ops = {
 	.of_xlate = apple_dart_of_xlate,
 	.def_domain_type = apple_dart_def_domain_type,
 	.get_resv_regions = apple_dart_get_resv_regions,
-	.put_resv_regions = generic_iommu_put_resv_regions,
 	.pgsize_bitmap = -1UL, /* Restricted during dart probe */
 	.owner = THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 4d30a8d2bc236..4a5e435567f17 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2852,7 +2852,6 @@ static struct iommu_ops arm_smmu_ops = {
 	.device_group		= arm_smmu_device_group,
 	.of_xlate		= arm_smmu_of_xlate,
 	.get_resv_regions	= arm_smmu_get_resv_regions,
-	.put_resv_regions	= generic_iommu_put_resv_regions,
 	.dev_enable_feat	= arm_smmu_dev_enable_feature,
 	.dev_disable_feat	= arm_smmu_dev_disable_feature,
 	.sva_bind		= arm_smmu_sva_bind,
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 588929bed1bc3..2d4129a4ccfc0 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -1584,7 +1584,6 @@ static struct iommu_ops arm_smmu_ops = {
 	.device_group		= arm_smmu_device_group,
 	.of_xlate		= arm_smmu_of_xlate,
 	.get_resv_regions	= arm_smmu_get_resv_regions,
-	.put_resv_regions	= generic_iommu_put_resv_regions,
 	.def_domain_type	= arm_smmu_def_domain_type,
 	.pgsize_bitmap		= -1UL, /* Restricted during device attach */
 	.owner			= THIS_MODULE,
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 44016594831de..49d616aa21489 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -4911,7 +4911,6 @@ const struct iommu_ops intel_iommu_ops = {
 	.probe_finalize		= intel_iommu_probe_finalize,
 	.release_device		= intel_iommu_release_device,
 	.get_resv_regions	= intel_iommu_get_resv_regions,
-	.put_resv_regions	= generic_iommu_put_resv_regions,
 	.device_group		= intel_iommu_device_group,
 	.dev_enable_feat	= intel_iommu_dev_enable_feat,
 	.dev_disable_feat	= intel_iommu_dev_disable_feat,
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 1bb016a6a2aa1..f53f8b2d27a54 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2579,27 +2579,14 @@ void iommu_get_resv_regions(struct device *dev, struct list_head *list)
 		ops->get_resv_regions(dev, list);
 }
 
-void iommu_put_resv_regions(struct device *dev, struct list_head *list)
-{
-	const struct iommu_ops *ops = dev_iommu_ops(dev);
-
-	if (ops->put_resv_regions)
-		ops->put_resv_regions(dev, list);
-}
-
 /**
- * generic_iommu_put_resv_regions - Reserved region driver helper
+ * iommu_put_resv_regions - release resered regions
  * @dev: device for which to free reserved regions
  * @list: reserved region list for device
  *
- * IOMMU drivers can use this to implement their .put_resv_regions() callback
- * for simple reservations. If a per region callback is provided that will be
- * used to free all memory allocations associated with the reserved region or
- * else just free up the memory for the regions. If an IOMMU driver allocates
- * additional resources per region, it is going to have to implement a custom
- * callback.
+ * This releases a reserved region list acquired by iommu_get_resv_regions().
  */
-void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list)
+void iommu_put_resv_regions(struct device *dev, struct list_head *list)
 {
 	struct iommu_resv_region *entry, *next;
 
@@ -2610,7 +2597,7 @@ void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list)
 			kfree(entry);
 	}
 }
-EXPORT_SYMBOL(generic_iommu_put_resv_regions);
+EXPORT_SYMBOL(iommu_put_resv_regions);
 
 struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start,
 						  size_t length, int prot,
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5c3d9366c25c7..95fd21c7207a3 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -928,7 +928,6 @@ static const struct iommu_ops mtk_iommu_ops = {
 	.device_group	= mtk_iommu_device_group,
 	.of_xlate	= mtk_iommu_of_xlate,
 	.get_resv_regions = mtk_iommu_get_resv_regions,
-	.put_resv_regions = generic_iommu_put_resv_regions,
 	.pgsize_bitmap	= SZ_4K | SZ_64K | SZ_1M | SZ_16M,
 	.owner		= THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 55337796a5f82..feeb5fde72a3b 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -964,7 +964,7 @@ static struct iommu_device *viommu_probe_device(struct device *dev)
 	return &viommu->iommu;
 
 err_free_dev:
-	generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
+	iommu_put_resv_regions(dev, &vdev->resv_regions);
 	kfree(vdev);
 
 	return ERR_PTR(ret);
@@ -983,7 +983,7 @@ static void viommu_release_device(struct device *dev)
 {
 	struct viommu_endpoint *vdev = dev_iommu_priv_get(dev);
 
-	generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
+	iommu_put_resv_regions(dev, &vdev->resv_regions);
 	kfree(vdev);
 }
 
@@ -1007,7 +1007,6 @@ static struct iommu_ops viommu_ops = {
 	.release_device		= viommu_release_device,
 	.device_group		= viommu_device_group,
 	.get_resv_regions	= viommu_get_resv_regions,
-	.put_resv_regions	= generic_iommu_put_resv_regions,
 	.of_xlate		= viommu_of_xlate,
 	.owner			= THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 0bc2eb14b0262..ea30f00dc1459 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -209,7 +209,6 @@ struct iommu_iotlb_gather {
  *                  group and attached to the groups domain
  * @device_group: find iommu group for a particular device
  * @get_resv_regions: Request list of reserved regions for a device
- * @put_resv_regions: Free list of reserved regions for a device
  * @of_xlate: add OF master IDs to iommu grouping
  * @is_attach_deferred: Check if domain attach should be deferred from iommu
  *                      driver init to device driver init (default no)
@@ -240,7 +239,6 @@ struct iommu_ops {
 
 	/* Request/Free a list of reserved regions for a device */
 	void (*get_resv_regions)(struct device *dev, struct list_head *list);
-	void (*put_resv_regions)(struct device *dev, struct list_head *list);
 
 	int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
 	bool (*is_attach_deferred)(struct device *dev);
@@ -454,8 +452,6 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain,
 
 extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
 extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
-extern void generic_iommu_put_resv_regions(struct device *dev,
-					   struct list_head *list);
 extern void iommu_set_default_passthrough(bool cmd_line);
 extern void iommu_set_default_translated(bool cmd_line);
 extern bool iommu_default_passthrough(void);
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 4/4] iommu/arm-smmu-v3: cleanup arm_smmu_dev_{enable,disable}_feature
  2022-07-08  8:06 remove dead iommu code v2 Christoph Hellwig
                   ` (2 preceding siblings ...)
  2022-07-08  8:06 ` [PATCH 3/4] iommu: remove the put_resv_regions method Christoph Hellwig
@ 2022-07-08  8:06 ` Christoph Hellwig
  2022-07-08 10:33   ` Will Deacon
  2022-07-15  8:14 ` remove dead iommu code v2 Joerg Roedel
  4 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2022-07-08  8:06 UTC (permalink / raw)
  To: Joerg Roedel, Sven Peter, David Woodhouse, Will Deacon,
	Robin Murphy, Lu Baolu, Yong Wu, Jean-Philippe Brucker
  Cc: iommu, linux-arm-kernel

Fold the arm_smmu_dev_has_feature arm_smmu_dev_feature_enabled into
the main methods.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 55 ++++++---------------
 1 file changed, 14 insertions(+), 41 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 4a5e435567f17..d32b02336411d 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2765,58 +2765,27 @@ static void arm_smmu_get_resv_regions(struct device *dev,
 	iommu_dma_get_resv_regions(dev, head);
 }
 
-static bool arm_smmu_dev_has_feature(struct device *dev,
-				     enum iommu_dev_features feat)
-{
-	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
-
-	if (!master)
-		return false;
-
-	switch (feat) {
-	case IOMMU_DEV_FEAT_IOPF:
-		return arm_smmu_master_iopf_supported(master);
-	case IOMMU_DEV_FEAT_SVA:
-		return arm_smmu_master_sva_supported(master);
-	default:
-		return false;
-	}
-}
-
-static bool arm_smmu_dev_feature_enabled(struct device *dev,
-					 enum iommu_dev_features feat)
-{
-	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
-
-	if (!master)
-		return false;
-
-	switch (feat) {
-	case IOMMU_DEV_FEAT_IOPF:
-		return master->iopf_enabled;
-	case IOMMU_DEV_FEAT_SVA:
-		return arm_smmu_master_sva_enabled(master);
-	default:
-		return false;
-	}
-}
-
 static int arm_smmu_dev_enable_feature(struct device *dev,
 				       enum iommu_dev_features feat)
 {
 	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
 
-	if (!arm_smmu_dev_has_feature(dev, feat))
+	if (!master)
 		return -ENODEV;
 
-	if (arm_smmu_dev_feature_enabled(dev, feat))
-		return -EBUSY;
-
 	switch (feat) {
 	case IOMMU_DEV_FEAT_IOPF:
+		if (!arm_smmu_master_iopf_supported(master))
+			return -EINVAL;
+		if (master->iopf_enabled)
+			return -EBUSY;
 		master->iopf_enabled = true;
 		return 0;
 	case IOMMU_DEV_FEAT_SVA:
+		if (!arm_smmu_master_sva_supported(master))
+			return -EINVAL;
+		if (arm_smmu_master_sva_enabled(master))
+			return -EBUSY;
 		return arm_smmu_master_enable_sva(master);
 	default:
 		return -EINVAL;
@@ -2828,16 +2797,20 @@ static int arm_smmu_dev_disable_feature(struct device *dev,
 {
 	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
 
-	if (!arm_smmu_dev_feature_enabled(dev, feat))
+	if (!master)
 		return -EINVAL;
 
 	switch (feat) {
 	case IOMMU_DEV_FEAT_IOPF:
+		if (!master->iopf_enabled)
+			return -EINVAL;
 		if (master->sva_enabled)
 			return -EBUSY;
 		master->iopf_enabled = false;
 		return 0;
 	case IOMMU_DEV_FEAT_SVA:
+		if (!arm_smmu_master_sva_enabled(master))
+			return -EINVAL;
 		return arm_smmu_master_disable_sva(master);
 	default:
 		return -EINVAL;
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/4] iommu: remove the unused dev_has_feat method
  2022-07-08  8:06 ` [PATCH 1/4] iommu: remove the unused dev_has_feat method Christoph Hellwig
@ 2022-07-08  8:43   ` Baolu Lu
  0 siblings, 0 replies; 19+ messages in thread
From: Baolu Lu @ 2022-07-08  8:43 UTC (permalink / raw)
  To: Christoph Hellwig, Joerg Roedel, Sven Peter, David Woodhouse,
	Will Deacon, Robin Murphy, Yong Wu, Jean-Philippe Brucker
  Cc: baolu.lu, iommu, linux-arm-kernel

On 2022/7/8 16:06, Christoph Hellwig wrote:
> This method is never actually called.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

Best regards,
baolu

> ---
>   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 -
>   include/linux/iommu.h                       | 4 +---
>   2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index d9c1623ec1a9a..1b6c17dd81ee4 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -2853,7 +2853,6 @@ static struct iommu_ops arm_smmu_ops = {
>   	.of_xlate		= arm_smmu_of_xlate,
>   	.get_resv_regions	= arm_smmu_get_resv_regions,
>   	.put_resv_regions	= generic_iommu_put_resv_regions,
> -	.dev_has_feat		= arm_smmu_dev_has_feature,
>   	.dev_feat_enabled	= arm_smmu_dev_feature_enabled,
>   	.dev_enable_feat	= arm_smmu_dev_enable_feature,
>   	.dev_disable_feat	= arm_smmu_dev_disable_feature,
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index e6abd998dbe73..a3acdb46b9391 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -164,8 +164,7 @@ struct iommu_iort_rmr_data {
>    *			 supported, this feature must be enabled before and
>    *			 disabled after %IOMMU_DEV_FEAT_SVA.
>    *
> - * Device drivers query whether a feature is supported using
> - * iommu_dev_has_feature(), and enable it using iommu_dev_enable_feature().
> + * Device drivers enable a feature using iommu_dev_enable_feature().
>    */
>   enum iommu_dev_features {
>   	IOMMU_DEV_FEAT_SVA,
> @@ -248,7 +247,6 @@ struct iommu_ops {
>   	bool (*is_attach_deferred)(struct device *dev);
>   
>   	/* Per device IOMMU features */
> -	bool (*dev_has_feat)(struct device *dev, enum iommu_dev_features f);
>   	bool (*dev_feat_enabled)(struct device *dev, enum iommu_dev_features f);
>   	int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f);
>   	int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/4] iommu: remove iommu_dev_feature_enabled
  2022-07-08  8:06 ` [PATCH 2/4] iommu: remove iommu_dev_feature_enabled Christoph Hellwig
@ 2022-07-08  8:47   ` Baolu Lu
  0 siblings, 0 replies; 19+ messages in thread
From: Baolu Lu @ 2022-07-08  8:47 UTC (permalink / raw)
  To: Christoph Hellwig, Joerg Roedel, Sven Peter, David Woodhouse,
	Will Deacon, Robin Murphy, Yong Wu, Jean-Philippe Brucker
  Cc: baolu.lu, iommu, linux-arm-kernel

On 2022/7/8 16:06, Christoph Hellwig wrote:
> Remove the unused iommu_dev_feature_enabled function.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

A nit comment below, anyway

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

> ---
>   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  1 -
>   drivers/iommu/iommu.c                       | 13 -------------
>   include/linux/iommu.h                       |  9 ---------
>   3 files changed, 23 deletions(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 1b6c17dd81ee4..4d30a8d2bc236 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -2853,7 +2853,6 @@ static struct iommu_ops arm_smmu_ops = {
>   	.of_xlate		= arm_smmu_of_xlate,
>   	.get_resv_regions	= arm_smmu_get_resv_regions,
>   	.put_resv_regions	= generic_iommu_put_resv_regions,
> -	.dev_feat_enabled	= arm_smmu_dev_feature_enabled,
>   	.dev_enable_feat	= arm_smmu_dev_enable_feature,
>   	.dev_disable_feat	= arm_smmu_dev_disable_feature,
>   	.sva_bind		= arm_smmu_sva_bind,
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 0aa141646bdf4..1bb016a6a2aa1 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2760,19 +2760,6 @@ int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
>   }
>   EXPORT_SYMBOL_GPL(iommu_dev_disable_feature);
>   
> -bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
> -{
> -	if (dev->iommu && dev->iommu->iommu_dev) {
> -		const struct iommu_ops *ops = dev->iommu->iommu_dev->ops;
> -
> -		if (ops->dev_feat_enabled)
> -			return ops->dev_feat_enabled(dev, feat);
> -	}
> -
> -	return false;
> -}
> -EXPORT_SYMBOL_GPL(iommu_dev_feature_enabled);
> -
>   /**
>    * iommu_sva_bind_device() - Bind a process address space to a device
>    * @dev: the device
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index a3acdb46b9391..0bc2eb14b0262 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -215,7 +215,6 @@ struct iommu_iotlb_gather {
>    *                      driver init to device driver init (default no)
>    * @dev_has/enable/disable_feat: per device entries to check/enable/disable
             ^^^

dev_has_feat() has been removed by the previous patch.

>    *                               iommu specific features.
> - * @dev_feat_enabled: check enabled feature
>    * @sva_bind: Bind process address space to device
>    * @sva_unbind: Unbind process address space from device
>    * @sva_get_pasid: Get PASID associated to a SVA handle
> @@ -247,7 +246,6 @@ struct iommu_ops {
>   	bool (*is_attach_deferred)(struct device *dev);
>   
>   	/* Per device IOMMU features */
> -	bool (*dev_feat_enabled)(struct device *dev, enum iommu_dev_features f);
>   	int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f);
>   	int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f);
>   
> @@ -670,7 +668,6 @@ void iommu_release_device(struct device *dev);
>   
>   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);
>   
>   struct iommu_sva *iommu_sva_bind_device(struct device *dev,
>   					struct mm_struct *mm,
> @@ -997,12 +994,6 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
>   	return NULL;
>   }
>   
> -static inline bool
> -iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
> -{
> -	return false;
> -}
> -
>   static inline int
>   iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
>   {

Best regards,
baolu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-07-08  8:06 ` [PATCH 3/4] iommu: remove the put_resv_regions method Christoph Hellwig
@ 2022-07-08  9:00   ` Baolu Lu
  2022-07-08  9:33     ` Christoph Hellwig
  2022-07-08 10:12   ` Will Deacon
  1 sibling, 1 reply; 19+ messages in thread
From: Baolu Lu @ 2022-07-08  9:00 UTC (permalink / raw)
  To: Christoph Hellwig, Joerg Roedel, Sven Peter, David Woodhouse,
	Will Deacon, Robin Murphy, Yong Wu, Jean-Philippe Brucker
  Cc: baolu.lu, iommu, linux-arm-kernel

On 2022/7/8 16:06, Christoph Hellwig wrote:
> -void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list)
> +void iommu_put_resv_regions(struct device *dev, struct list_head *list)
>   {
>   	struct iommu_resv_region *entry, *next;
>   
> @@ -2610,7 +2597,7 @@ void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list)
>   			kfree(entry);
>   	}
>   }
> -EXPORT_SYMBOL(generic_iommu_put_resv_regions);
> +EXPORT_SYMBOL(iommu_put_resv_regions);

Do we really need to export this symbol? It is not used beyond the iommu
core code.

Best regards,
baolu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-07-08  9:00   ` Baolu Lu
@ 2022-07-08  9:33     ` Christoph Hellwig
  2022-07-08 10:03       ` Baolu Lu
  0 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2022-07-08  9:33 UTC (permalink / raw)
  To: Baolu Lu
  Cc: Christoph Hellwig, Joerg Roedel, Sven Peter, David Woodhouse,
	Will Deacon, Robin Murphy, Yong Wu, Jean-Philippe Brucker, iommu,
	linux-arm-kernel

On Fri, Jul 08, 2022 at 05:00:59PM +0800, Baolu Lu wrote:
> Do we really need to export this symbol? It is not used beyond the iommu
> core code.

virtio-iommu calls it and can be modular.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-07-08  9:33     ` Christoph Hellwig
@ 2022-07-08 10:03       ` Baolu Lu
  0 siblings, 0 replies; 19+ messages in thread
From: Baolu Lu @ 2022-07-08 10:03 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: baolu.lu, Joerg Roedel, Sven Peter, David Woodhouse, Will Deacon,
	Robin Murphy, Yong Wu, Jean-Philippe Brucker, iommu,
	linux-arm-kernel

On 2022/7/8 17:33, Christoph Hellwig wrote:
> On Fri, Jul 08, 2022 at 05:00:59PM +0800, Baolu Lu wrote:
>> Do we really need to export this symbol? It is not used beyond the iommu
>> core code.
> 
> virtio-iommu calls it and can be modular.

Yes. Thanks for the explanation.

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

Best regards,
baolu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-07-08  8:06 ` [PATCH 3/4] iommu: remove the put_resv_regions method Christoph Hellwig
  2022-07-08  9:00   ` Baolu Lu
@ 2022-07-08 10:12   ` Will Deacon
  2022-07-08 10:19     ` Christoph Hellwig
  1 sibling, 1 reply; 19+ messages in thread
From: Will Deacon @ 2022-07-08 10:12 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Joerg Roedel, Sven Peter, David Woodhouse, Robin Murphy,
	Lu Baolu, Yong Wu, Jean-Philippe Brucker, iommu,
	linux-arm-kernel

On Fri, Jul 08, 2022 at 10:06:15AM +0200, Christoph Hellwig wrote:
> All drivers that implement get_resv_regions just use
> generic_put_resv_regions to implement the put side.  Remove the
> indirections and document the allocations constraints.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/iommu/amd/iommu.c                   |  1 -
>  drivers/iommu/apple-dart.c                  |  1 -
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  1 -
>  drivers/iommu/arm/arm-smmu/arm-smmu.c       |  1 -
>  drivers/iommu/intel/iommu.c                 |  1 -
>  drivers/iommu/iommu.c                       | 21 ++++-----------------
>  drivers/iommu/mtk_iommu.c                   |  1 -
>  drivers/iommu/virtio-iommu.c                |  5 ++---
>  include/linux/iommu.h                       |  4 ----
>  9 files changed, 6 insertions(+), 30 deletions(-)

Heads up, but I think this might collide (trivially?) with:

https://lore.kernel.org/r/20220615101044.1972-1-shameerali.kolothum.thodi@huawei.com

which Joerg has queued up already. It looks like the cleanup still makes
sense though, so that's good.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-07-08 10:12   ` Will Deacon
@ 2022-07-08 10:19     ` Christoph Hellwig
  2022-07-08 10:32       ` Will Deacon
  0 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2022-07-08 10:19 UTC (permalink / raw)
  To: Will Deacon
  Cc: Christoph Hellwig, Joerg Roedel, Sven Peter, David Woodhouse,
	Robin Murphy, Lu Baolu, Yong Wu, Jean-Philippe Brucker, iommu,
	linux-arm-kernel

On Fri, Jul 08, 2022 at 11:12:45AM +0100, Will Deacon wrote:
> Heads up, but I think this might collide (trivially?) with:
> 
> https://lore.kernel.org/r/20220615101044.1972-1-shameerali.kolothum.thodi@huawei.com
> 
> which Joerg has queued up already. It looks like the cleanup still makes
> sense though, so that's good.

This series sits on top of that one - I waited for it to hit the IOMMU
tree before resending to avoid the conflict.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-07-08 10:19     ` Christoph Hellwig
@ 2022-07-08 10:32       ` Will Deacon
  0 siblings, 0 replies; 19+ messages in thread
From: Will Deacon @ 2022-07-08 10:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Joerg Roedel, Sven Peter, David Woodhouse, Robin Murphy,
	Lu Baolu, Yong Wu, Jean-Philippe Brucker, iommu,
	linux-arm-kernel

On Fri, Jul 08, 2022 at 12:19:51PM +0200, Christoph Hellwig wrote:
> On Fri, Jul 08, 2022 at 11:12:45AM +0100, Will Deacon wrote:
> > Heads up, but I think this might collide (trivially?) with:
> > 
> > https://lore.kernel.org/r/20220615101044.1972-1-shameerali.kolothum.thodi@huawei.com
> > 
> > which Joerg has queued up already. It looks like the cleanup still makes
> > sense though, so that's good.
> 
> This series sits on top of that one - I waited for it to hit the IOMMU
> tree before resending to avoid the conflict.

Ah brill, sorry for the noise.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 4/4] iommu/arm-smmu-v3: cleanup arm_smmu_dev_{enable,disable}_feature
  2022-07-08  8:06 ` [PATCH 4/4] iommu/arm-smmu-v3: cleanup arm_smmu_dev_{enable,disable}_feature Christoph Hellwig
@ 2022-07-08 10:33   ` Will Deacon
  0 siblings, 0 replies; 19+ messages in thread
From: Will Deacon @ 2022-07-08 10:33 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Joerg Roedel, Sven Peter, David Woodhouse, Robin Murphy,
	Lu Baolu, Yong Wu, Jean-Philippe Brucker, iommu,
	linux-arm-kernel

On Fri, Jul 08, 2022 at 10:06:16AM +0200, Christoph Hellwig wrote:
> Fold the arm_smmu_dev_has_feature arm_smmu_dev_feature_enabled into
> the main methods.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 55 ++++++---------------
>  1 file changed, 14 insertions(+), 41 deletions(-)

Thanks for the cleanup:

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

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: remove dead iommu code v2
  2022-07-08  8:06 remove dead iommu code v2 Christoph Hellwig
                   ` (3 preceding siblings ...)
  2022-07-08  8:06 ` [PATCH 4/4] iommu/arm-smmu-v3: cleanup arm_smmu_dev_{enable,disable}_feature Christoph Hellwig
@ 2022-07-15  8:14 ` Joerg Roedel
  4 siblings, 0 replies; 19+ messages in thread
From: Joerg Roedel @ 2022-07-15  8:14 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Sven Peter, David Woodhouse, Will Deacon, Robin Murphy, Lu Baolu,
	Yong Wu, Jean-Philippe Brucker, iommu, linux-arm-kernel

On Fri, Jul 08, 2022 at 10:06:12AM +0200, Christoph Hellwig wrote:
> Diffstat:
>  drivers/iommu/amd/iommu.c                   |    1 
>  drivers/iommu/apple-dart.c                  |    1 
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |   58 ++++++----------------------
>  drivers/iommu/arm/arm-smmu/arm-smmu.c       |    1 
>  drivers/iommu/intel/iommu.c                 |    1 
>  drivers/iommu/iommu.c                       |   34 +---------------
>  drivers/iommu/mtk_iommu.c                   |    1 
>  drivers/iommu/virtio-iommu.c                |    5 --
>  include/linux/iommu.h                       |   17 --------
>  9 files changed, 21 insertions(+), 98 deletions(-)

Applied, thanks.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-04-07 10:18   ` Robin Murphy
@ 2022-04-07 13:24     ` Christoph Hellwig
  0 siblings, 0 replies; 19+ messages in thread
From: Christoph Hellwig @ 2022-04-07 13:24 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Jean-Philippe Brucker, iommu, David Woodhouse, Christoph Hellwig

On Thu, Apr 07, 2022 at 11:18:20AM +0100, Robin Murphy wrote:
> On 2022-04-07 07:26, Christoph Hellwig wrote:
>> All drivers that implement get_resv_regions just use
>> generic_put_resv_regions to implement the put side.  Remove the
>> indirections and document the allocations constraints.
>
> Unfortunately we need to keep this one for now, as the belated IORT RMR 
> support will finally be the first real user[1][2].
>
> Robin.
>
> [1] 
> https://lore.kernel.org/linux-iommu/20220404124209.1086-6-shameerali.kolothum.thodi@huawei.com/
> [2] 
> https://lore.kernel.org/linux-iommu/20220404124209.1086-7-shameerali.kolothum.thodi@huawei.com/

What these patches to looks wrong to me.  I'll comment there.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-04-07  6:26 ` [PATCH 3/4] iommu: remove the put_resv_regions method Christoph Hellwig
  2022-04-07  8:04   ` Tian, Kevin
@ 2022-04-07 10:18   ` Robin Murphy
  2022-04-07 13:24     ` Christoph Hellwig
  1 sibling, 1 reply; 19+ messages in thread
From: Robin Murphy @ 2022-04-07 10:18 UTC (permalink / raw)
  To: Christoph Hellwig, Joerg Roedel, Sven Peter, David Woodhouse,
	Lu Baolu, Yong Wu, Jean-Philippe Brucker, iommu

On 2022-04-07 07:26, Christoph Hellwig wrote:
> All drivers that implement get_resv_regions just use
> generic_put_resv_regions to implement the put side.  Remove the
> indirections and document the allocations constraints.

Unfortunately we need to keep this one for now, as the belated IORT RMR 
support will finally be the first real user[1][2].

Robin.

[1] 
https://lore.kernel.org/linux-iommu/20220404124209.1086-6-shameerali.kolothum.thodi@huawei.com/
[2] 
https://lore.kernel.org/linux-iommu/20220404124209.1086-7-shameerali.kolothum.thodi@huawei.com/

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/iommu/amd/iommu.c                   |  1 -
>   drivers/iommu/apple-dart.c                  |  1 -
>   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  1 -
>   drivers/iommu/arm/arm-smmu/arm-smmu.c       |  1 -
>   drivers/iommu/intel/iommu.c                 |  1 -
>   drivers/iommu/iommu.c                       | 20 +-------------------
>   drivers/iommu/mtk_iommu.c                   |  1 -
>   drivers/iommu/virtio-iommu.c                |  5 ++---
>   include/linux/iommu.h                       |  4 ----
>   9 files changed, 3 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index a1ada7bff44e61..7011b46022dcbb 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2279,7 +2279,6 @@ const struct iommu_ops amd_iommu_ops = {
>   	.probe_finalize = amd_iommu_probe_finalize,
>   	.device_group = amd_iommu_device_group,
>   	.get_resv_regions = amd_iommu_get_resv_regions,
> -	.put_resv_regions = generic_iommu_put_resv_regions,
>   	.is_attach_deferred = amd_iommu_is_attach_deferred,
>   	.pgsize_bitmap	= AMD_IOMMU_PGSIZES,
>   	.def_domain_type = amd_iommu_def_domain_type,
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index decafb07ad0831..a45ad9ade0dba6 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -771,7 +771,6 @@ static const struct iommu_ops apple_dart_iommu_ops = {
>   	.of_xlate = apple_dart_of_xlate,
>   	.def_domain_type = apple_dart_def_domain_type,
>   	.get_resv_regions = apple_dart_get_resv_regions,
> -	.put_resv_regions = generic_iommu_put_resv_regions,
>   	.pgsize_bitmap = -1UL, /* Restricted during dart probe */
>   	.default_domain_ops = &(const struct iommu_domain_ops) {
>   		.attach_dev	= apple_dart_attach_dev,
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 36461fb46d436c..1ea184bbf750a6 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -2847,7 +2847,6 @@ static struct iommu_ops arm_smmu_ops = {
>   	.device_group		= arm_smmu_device_group,
>   	.of_xlate		= arm_smmu_of_xlate,
>   	.get_resv_regions	= arm_smmu_get_resv_regions,
> -	.put_resv_regions	= generic_iommu_put_resv_regions,
>   	.dev_enable_feat	= arm_smmu_dev_enable_feature,
>   	.dev_disable_feat	= arm_smmu_dev_disable_feature,
>   	.sva_bind		= arm_smmu_sva_bind,
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> index 568cce590ccc13..41da1275689ebd 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> @@ -1589,7 +1589,6 @@ static struct iommu_ops arm_smmu_ops = {
>   	.device_group		= arm_smmu_device_group,
>   	.of_xlate		= arm_smmu_of_xlate,
>   	.get_resv_regions	= arm_smmu_get_resv_regions,
> -	.put_resv_regions	= generic_iommu_put_resv_regions,
>   	.def_domain_type	= arm_smmu_def_domain_type,
>   	.pgsize_bitmap		= -1UL, /* Restricted during device attach */
>   	.owner			= THIS_MODULE,
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index df5c62ecf942b8..cafe50cb484cd5 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -4875,7 +4875,6 @@ const struct iommu_ops intel_iommu_ops = {
>   	.probe_finalize		= intel_iommu_probe_finalize,
>   	.release_device		= intel_iommu_release_device,
>   	.get_resv_regions	= intel_iommu_get_resv_regions,
> -	.put_resv_regions	= generic_iommu_put_resv_regions,
>   	.device_group		= intel_iommu_device_group,
>   	.dev_enable_feat	= intel_iommu_dev_enable_feat,
>   	.dev_disable_feat	= intel_iommu_dev_disable_feat,
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 6ce73f35c43aac..2e1f7d1cf74793 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2584,31 +2584,13 @@ void iommu_get_resv_regions(struct device *dev, struct list_head *list)
>   }
>   
>   void iommu_put_resv_regions(struct device *dev, struct list_head *list)
> -{
> -	const struct iommu_ops *ops = dev_iommu_ops(dev);
> -
> -	if (ops->put_resv_regions)
> -		ops->put_resv_regions(dev, list);
> -}
> -
> -/**
> - * generic_iommu_put_resv_regions - Reserved region driver helper
> - * @dev: device for which to free reserved regions
> - * @list: reserved region list for device
> - *
> - * IOMMU drivers can use this to implement their .put_resv_regions() callback
> - * for simple reservations. Memory allocated for each reserved region will be
> - * freed. If an IOMMU driver allocates additional resources per region, it is
> - * going to have to implement a custom callback.
> - */
> -void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list)
>   {
>   	struct iommu_resv_region *entry, *next;
>   
>   	list_for_each_entry_safe(entry, next, list, list)
>   		kfree(entry);
>   }
> -EXPORT_SYMBOL(generic_iommu_put_resv_regions);
> +EXPORT_SYMBOL(iommu_put_resv_regions);
>   
>   struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start,
>   						  size_t length, int prot,
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index 6fd75a60abd678..d970fd301e8f31 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -688,7 +688,6 @@ static const struct iommu_ops mtk_iommu_ops = {
>   	.device_group	= mtk_iommu_device_group,
>   	.of_xlate	= mtk_iommu_of_xlate,
>   	.get_resv_regions = mtk_iommu_get_resv_regions,
> -	.put_resv_regions = generic_iommu_put_resv_regions,
>   	.pgsize_bitmap	= SZ_4K | SZ_64K | SZ_1M | SZ_16M,
>   	.owner		= THIS_MODULE,
>   	.default_domain_ops = &(const struct iommu_domain_ops) {
> diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
> index 25be4b822aa07f..36385b3deb8981 100644
> --- a/drivers/iommu/virtio-iommu.c
> +++ b/drivers/iommu/virtio-iommu.c
> @@ -964,7 +964,7 @@ static struct iommu_device *viommu_probe_device(struct device *dev)
>   	return &viommu->iommu;
>   
>   err_free_dev:
> -	generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
> +	iommu_put_resv_regions(dev, &vdev->resv_regions);
>   	kfree(vdev);
>   
>   	return ERR_PTR(ret);
> @@ -989,7 +989,7 @@ static void viommu_release_device(struct device *dev)
>   
>   	vdev = dev_iommu_priv_get(dev);
>   
> -	generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
> +	iommu_put_resv_regions(dev, &vdev->resv_regions);
>   	kfree(vdev);
>   }
>   
> @@ -1013,7 +1013,6 @@ static struct iommu_ops viommu_ops = {
>   	.release_device		= viommu_release_device,
>   	.device_group		= viommu_device_group,
>   	.get_resv_regions	= viommu_get_resv_regions,
> -	.put_resv_regions	= generic_iommu_put_resv_regions,
>   	.of_xlate		= viommu_of_xlate,
>   	.owner			= THIS_MODULE,
>   	.default_domain_ops = &(const struct iommu_domain_ops) {
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index a2d3562a501d3e..fed4c09e8e7cfe 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -198,7 +198,6 @@ struct iommu_iotlb_gather {
>    *                  group and attached to the groups domain
>    * @device_group: find iommu group for a particular device
>    * @get_resv_regions: Request list of reserved regions for a device
> - * @put_resv_regions: Free list of reserved regions for a device
>    * @of_xlate: add OF master IDs to iommu grouping
>    * @is_attach_deferred: Check if domain attach should be deferred from iommu
>    *                      driver init to device driver init (default no)
> @@ -229,7 +228,6 @@ struct iommu_ops {
>   
>   	/* Request/Free a list of reserved regions for a device */
>   	void (*get_resv_regions)(struct device *dev, struct list_head *list);
> -	void (*put_resv_regions)(struct device *dev, struct list_head *list);
>   
>   	int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
>   	bool (*is_attach_deferred)(struct device *dev);
> @@ -445,8 +443,6 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain,
>   
>   extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
>   extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
> -extern void generic_iommu_put_resv_regions(struct device *dev,
> -					   struct list_head *list);
>   extern void iommu_set_default_passthrough(bool cmd_line);
>   extern void iommu_set_default_translated(bool cmd_line);
>   extern bool iommu_default_passthrough(void);
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* RE: [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-04-07  6:26 ` [PATCH 3/4] iommu: remove the put_resv_regions method Christoph Hellwig
@ 2022-04-07  8:04   ` Tian, Kevin
  2022-04-07 10:18   ` Robin Murphy
  1 sibling, 0 replies; 19+ messages in thread
From: Tian, Kevin @ 2022-04-07  8:04 UTC (permalink / raw)
  To: Christoph Hellwig, Joerg Roedel, Sven Peter, David Woodhouse,
	Lu Baolu, Yong Wu, Jean-Philippe Brucker, iommu

> From: Christoph Hellwig
> Sent: Thursday, April 7, 2022 2:26 PM
> 
> All drivers that implement get_resv_regions just use
> generic_put_resv_regions to implement the put side.  Remove the
> indirections and document the allocations constraints.
> 

Looks no document after removal:

>  void iommu_put_resv_regions(struct device *dev, struct list_head *list)
> -{
> -	const struct iommu_ops *ops = dev_iommu_ops(dev);
> -
> -	if (ops->put_resv_regions)
> -		ops->put_resv_regions(dev, list);
> -}
> -
> -/**
> - * generic_iommu_put_resv_regions - Reserved region driver helper
> - * @dev: device for which to free reserved regions
> - * @list: reserved region list for device
> - *
> - * IOMMU drivers can use this to implement their .put_resv_regions()
> callback
> - * for simple reservations. Memory allocated for each reserved region will
> be
> - * freed. If an IOMMU driver allocates additional resources per region, it is
> - * going to have to implement a custom callback.
> - */
> -void generic_iommu_put_resv_regions(struct device *dev, struct list_head
> *list)
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* [PATCH 3/4] iommu: remove the put_resv_regions method
  2022-04-07  6:26 remve dead iommu code Christoph Hellwig
@ 2022-04-07  6:26 ` Christoph Hellwig
  2022-04-07  8:04   ` Tian, Kevin
  2022-04-07 10:18   ` Robin Murphy
  0 siblings, 2 replies; 19+ messages in thread
From: Christoph Hellwig @ 2022-04-07  6:26 UTC (permalink / raw)
  To: Joerg Roedel, Sven Peter, David Woodhouse, Lu Baolu, Yong Wu,
	Jean-Philippe Brucker, iommu

All drivers that implement get_resv_regions just use
generic_put_resv_regions to implement the put side.  Remove the
indirections and document the allocations constraints.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/iommu/amd/iommu.c                   |  1 -
 drivers/iommu/apple-dart.c                  |  1 -
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  1 -
 drivers/iommu/arm/arm-smmu/arm-smmu.c       |  1 -
 drivers/iommu/intel/iommu.c                 |  1 -
 drivers/iommu/iommu.c                       | 20 +-------------------
 drivers/iommu/mtk_iommu.c                   |  1 -
 drivers/iommu/virtio-iommu.c                |  5 ++---
 include/linux/iommu.h                       |  4 ----
 9 files changed, 3 insertions(+), 32 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index a1ada7bff44e61..7011b46022dcbb 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2279,7 +2279,6 @@ const struct iommu_ops amd_iommu_ops = {
 	.probe_finalize = amd_iommu_probe_finalize,
 	.device_group = amd_iommu_device_group,
 	.get_resv_regions = amd_iommu_get_resv_regions,
-	.put_resv_regions = generic_iommu_put_resv_regions,
 	.is_attach_deferred = amd_iommu_is_attach_deferred,
 	.pgsize_bitmap	= AMD_IOMMU_PGSIZES,
 	.def_domain_type = amd_iommu_def_domain_type,
diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index decafb07ad0831..a45ad9ade0dba6 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -771,7 +771,6 @@ static const struct iommu_ops apple_dart_iommu_ops = {
 	.of_xlate = apple_dart_of_xlate,
 	.def_domain_type = apple_dart_def_domain_type,
 	.get_resv_regions = apple_dart_get_resv_regions,
-	.put_resv_regions = generic_iommu_put_resv_regions,
 	.pgsize_bitmap = -1UL, /* Restricted during dart probe */
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= apple_dart_attach_dev,
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 36461fb46d436c..1ea184bbf750a6 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2847,7 +2847,6 @@ static struct iommu_ops arm_smmu_ops = {
 	.device_group		= arm_smmu_device_group,
 	.of_xlate		= arm_smmu_of_xlate,
 	.get_resv_regions	= arm_smmu_get_resv_regions,
-	.put_resv_regions	= generic_iommu_put_resv_regions,
 	.dev_enable_feat	= arm_smmu_dev_enable_feature,
 	.dev_disable_feat	= arm_smmu_dev_disable_feature,
 	.sva_bind		= arm_smmu_sva_bind,
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 568cce590ccc13..41da1275689ebd 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -1589,7 +1589,6 @@ static struct iommu_ops arm_smmu_ops = {
 	.device_group		= arm_smmu_device_group,
 	.of_xlate		= arm_smmu_of_xlate,
 	.get_resv_regions	= arm_smmu_get_resv_regions,
-	.put_resv_regions	= generic_iommu_put_resv_regions,
 	.def_domain_type	= arm_smmu_def_domain_type,
 	.pgsize_bitmap		= -1UL, /* Restricted during device attach */
 	.owner			= THIS_MODULE,
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index df5c62ecf942b8..cafe50cb484cd5 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -4875,7 +4875,6 @@ const struct iommu_ops intel_iommu_ops = {
 	.probe_finalize		= intel_iommu_probe_finalize,
 	.release_device		= intel_iommu_release_device,
 	.get_resv_regions	= intel_iommu_get_resv_regions,
-	.put_resv_regions	= generic_iommu_put_resv_regions,
 	.device_group		= intel_iommu_device_group,
 	.dev_enable_feat	= intel_iommu_dev_enable_feat,
 	.dev_disable_feat	= intel_iommu_dev_disable_feat,
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 6ce73f35c43aac..2e1f7d1cf74793 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2584,31 +2584,13 @@ void iommu_get_resv_regions(struct device *dev, struct list_head *list)
 }
 
 void iommu_put_resv_regions(struct device *dev, struct list_head *list)
-{
-	const struct iommu_ops *ops = dev_iommu_ops(dev);
-
-	if (ops->put_resv_regions)
-		ops->put_resv_regions(dev, list);
-}
-
-/**
- * generic_iommu_put_resv_regions - Reserved region driver helper
- * @dev: device for which to free reserved regions
- * @list: reserved region list for device
- *
- * IOMMU drivers can use this to implement their .put_resv_regions() callback
- * for simple reservations. Memory allocated for each reserved region will be
- * freed. If an IOMMU driver allocates additional resources per region, it is
- * going to have to implement a custom callback.
- */
-void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list)
 {
 	struct iommu_resv_region *entry, *next;
 
 	list_for_each_entry_safe(entry, next, list, list)
 		kfree(entry);
 }
-EXPORT_SYMBOL(generic_iommu_put_resv_regions);
+EXPORT_SYMBOL(iommu_put_resv_regions);
 
 struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start,
 						  size_t length, int prot,
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 6fd75a60abd678..d970fd301e8f31 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -688,7 +688,6 @@ static const struct iommu_ops mtk_iommu_ops = {
 	.device_group	= mtk_iommu_device_group,
 	.of_xlate	= mtk_iommu_of_xlate,
 	.get_resv_regions = mtk_iommu_get_resv_regions,
-	.put_resv_regions = generic_iommu_put_resv_regions,
 	.pgsize_bitmap	= SZ_4K | SZ_64K | SZ_1M | SZ_16M,
 	.owner		= THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 25be4b822aa07f..36385b3deb8981 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -964,7 +964,7 @@ static struct iommu_device *viommu_probe_device(struct device *dev)
 	return &viommu->iommu;
 
 err_free_dev:
-	generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
+	iommu_put_resv_regions(dev, &vdev->resv_regions);
 	kfree(vdev);
 
 	return ERR_PTR(ret);
@@ -989,7 +989,7 @@ static void viommu_release_device(struct device *dev)
 
 	vdev = dev_iommu_priv_get(dev);
 
-	generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
+	iommu_put_resv_regions(dev, &vdev->resv_regions);
 	kfree(vdev);
 }
 
@@ -1013,7 +1013,6 @@ static struct iommu_ops viommu_ops = {
 	.release_device		= viommu_release_device,
 	.device_group		= viommu_device_group,
 	.get_resv_regions	= viommu_get_resv_regions,
-	.put_resv_regions	= generic_iommu_put_resv_regions,
 	.of_xlate		= viommu_of_xlate,
 	.owner			= THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a2d3562a501d3e..fed4c09e8e7cfe 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -198,7 +198,6 @@ struct iommu_iotlb_gather {
  *                  group and attached to the groups domain
  * @device_group: find iommu group for a particular device
  * @get_resv_regions: Request list of reserved regions for a device
- * @put_resv_regions: Free list of reserved regions for a device
  * @of_xlate: add OF master IDs to iommu grouping
  * @is_attach_deferred: Check if domain attach should be deferred from iommu
  *                      driver init to device driver init (default no)
@@ -229,7 +228,6 @@ struct iommu_ops {
 
 	/* Request/Free a list of reserved regions for a device */
 	void (*get_resv_regions)(struct device *dev, struct list_head *list);
-	void (*put_resv_regions)(struct device *dev, struct list_head *list);
 
 	int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
 	bool (*is_attach_deferred)(struct device *dev);
@@ -445,8 +443,6 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain,
 
 extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
 extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
-extern void generic_iommu_put_resv_regions(struct device *dev,
-					   struct list_head *list);
 extern void iommu_set_default_passthrough(bool cmd_line);
 extern void iommu_set_default_translated(bool cmd_line);
 extern bool iommu_default_passthrough(void);
-- 
2.30.2

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

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

end of thread, other threads:[~2022-07-15  8:15 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08  8:06 remove dead iommu code v2 Christoph Hellwig
2022-07-08  8:06 ` [PATCH 1/4] iommu: remove the unused dev_has_feat method Christoph Hellwig
2022-07-08  8:43   ` Baolu Lu
2022-07-08  8:06 ` [PATCH 2/4] iommu: remove iommu_dev_feature_enabled Christoph Hellwig
2022-07-08  8:47   ` Baolu Lu
2022-07-08  8:06 ` [PATCH 3/4] iommu: remove the put_resv_regions method Christoph Hellwig
2022-07-08  9:00   ` Baolu Lu
2022-07-08  9:33     ` Christoph Hellwig
2022-07-08 10:03       ` Baolu Lu
2022-07-08 10:12   ` Will Deacon
2022-07-08 10:19     ` Christoph Hellwig
2022-07-08 10:32       ` Will Deacon
2022-07-08  8:06 ` [PATCH 4/4] iommu/arm-smmu-v3: cleanup arm_smmu_dev_{enable,disable}_feature Christoph Hellwig
2022-07-08 10:33   ` Will Deacon
2022-07-15  8:14 ` remove dead iommu code v2 Joerg Roedel
  -- strict thread matches above, loose matches on Subject: below --
2022-04-07  6:26 remve dead iommu code Christoph Hellwig
2022-04-07  6:26 ` [PATCH 3/4] iommu: remove the put_resv_regions method Christoph Hellwig
2022-04-07  8:04   ` Tian, Kevin
2022-04-07 10:18   ` Robin Murphy
2022-04-07 13:24     ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.