linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] iommu/vt-d: Several misc cleanups
@ 2021-03-23  1:05 Lu Baolu
  2021-03-23  1:05 ` [PATCH 1/5] iommu/vt-d: Remove unused dma map/unmap trace events Lu Baolu
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Lu Baolu @ 2021-03-23  1:05 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu, iommu,
	linux-kernel, Lu Baolu

Hi Joerg et al,

This series includes several cleanups in the VT-d driver. Please help to
review.

Best regards,
baolu

Lu Baolu (5):
  iommu/vt-d: Remove unused dma map/unmap trace events
  iommu/vt-d: Remove svm_dev_ops
  iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID
  iommu/vt-d: Remove unused function declarations
  iommu/vt-d: Make unnecessarily global functions static

 drivers/iommu/intel/pasid.c        |   4 +-
 drivers/iommu/intel/pasid.h        |   5 --
 drivers/iommu/intel/svm.c          |  55 +++++--------
 include/linux/intel-iommu.h        |   3 -
 include/linux/intel-svm.h          |  23 +-----
 include/trace/events/intel_iommu.h | 120 -----------------------------
 6 files changed, 24 insertions(+), 186 deletions(-)

-- 
2.25.1


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

* [PATCH 1/5] iommu/vt-d: Remove unused dma map/unmap trace events
  2021-03-23  1:05 [PATCH 0/5] iommu/vt-d: Several misc cleanups Lu Baolu
@ 2021-03-23  1:05 ` Lu Baolu
  2021-03-23 17:26   ` Christoph Hellwig
  2021-03-23  1:05 ` [PATCH 2/5] iommu/vt-d: Remove svm_dev_ops Lu Baolu
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Lu Baolu @ 2021-03-23  1:05 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu, iommu,
	linux-kernel, Lu Baolu

With commit c588072bba6b5 ("iommu/vt-d: Convert intel iommu driver to
the iommu ops"), the trace events for dma map/unmap have no users any
more. Cleanup them to make the code neat.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 include/trace/events/intel_iommu.h | 120 -----------------------------
 1 file changed, 120 deletions(-)

diff --git a/include/trace/events/intel_iommu.h b/include/trace/events/intel_iommu.h
index e801f4910522..d233f2916584 100644
--- a/include/trace/events/intel_iommu.h
+++ b/include/trace/events/intel_iommu.h
@@ -15,126 +15,6 @@
 #include <linux/tracepoint.h>
 #include <linux/intel-iommu.h>
 
-DECLARE_EVENT_CLASS(dma_map,
-	TP_PROTO(struct device *dev, dma_addr_t dev_addr, phys_addr_t phys_addr,
-		 size_t size),
-
-	TP_ARGS(dev, dev_addr, phys_addr, size),
-
-	TP_STRUCT__entry(
-		__string(dev_name, dev_name(dev))
-		__field(dma_addr_t, dev_addr)
-		__field(phys_addr_t, phys_addr)
-		__field(size_t,	size)
-	),
-
-	TP_fast_assign(
-		__assign_str(dev_name, dev_name(dev));
-		__entry->dev_addr = dev_addr;
-		__entry->phys_addr = phys_addr;
-		__entry->size = size;
-	),
-
-	TP_printk("dev=%s dev_addr=0x%llx phys_addr=0x%llx size=%zu",
-		  __get_str(dev_name),
-		  (unsigned long long)__entry->dev_addr,
-		  (unsigned long long)__entry->phys_addr,
-		  __entry->size)
-);
-
-DEFINE_EVENT(dma_map, map_single,
-	TP_PROTO(struct device *dev, dma_addr_t dev_addr, phys_addr_t phys_addr,
-		 size_t size),
-	TP_ARGS(dev, dev_addr, phys_addr, size)
-);
-
-DEFINE_EVENT(dma_map, bounce_map_single,
-	TP_PROTO(struct device *dev, dma_addr_t dev_addr, phys_addr_t phys_addr,
-		 size_t size),
-	TP_ARGS(dev, dev_addr, phys_addr, size)
-);
-
-DECLARE_EVENT_CLASS(dma_unmap,
-	TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size),
-
-	TP_ARGS(dev, dev_addr, size),
-
-	TP_STRUCT__entry(
-		__string(dev_name, dev_name(dev))
-		__field(dma_addr_t, dev_addr)
-		__field(size_t,	size)
-	),
-
-	TP_fast_assign(
-		__assign_str(dev_name, dev_name(dev));
-		__entry->dev_addr = dev_addr;
-		__entry->size = size;
-	),
-
-	TP_printk("dev=%s dev_addr=0x%llx size=%zu",
-		  __get_str(dev_name),
-		  (unsigned long long)__entry->dev_addr,
-		  __entry->size)
-);
-
-DEFINE_EVENT(dma_unmap, unmap_single,
-	TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size),
-	TP_ARGS(dev, dev_addr, size)
-);
-
-DEFINE_EVENT(dma_unmap, unmap_sg,
-	TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size),
-	TP_ARGS(dev, dev_addr, size)
-);
-
-DEFINE_EVENT(dma_unmap, bounce_unmap_single,
-	TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size),
-	TP_ARGS(dev, dev_addr, size)
-);
-
-DECLARE_EVENT_CLASS(dma_map_sg,
-	TP_PROTO(struct device *dev, int index, int total,
-		 struct scatterlist *sg),
-
-	TP_ARGS(dev, index, total, sg),
-
-	TP_STRUCT__entry(
-		__string(dev_name, dev_name(dev))
-		__field(dma_addr_t, dev_addr)
-		__field(phys_addr_t, phys_addr)
-		__field(size_t,	size)
-		__field(int, index)
-		__field(int, total)
-	),
-
-	TP_fast_assign(
-		__assign_str(dev_name, dev_name(dev));
-		__entry->dev_addr = sg->dma_address;
-		__entry->phys_addr = sg_phys(sg);
-		__entry->size = sg->dma_length;
-		__entry->index = index;
-		__entry->total = total;
-	),
-
-	TP_printk("dev=%s [%d/%d] dev_addr=0x%llx phys_addr=0x%llx size=%zu",
-		  __get_str(dev_name), __entry->index, __entry->total,
-		  (unsigned long long)__entry->dev_addr,
-		  (unsigned long long)__entry->phys_addr,
-		  __entry->size)
-);
-
-DEFINE_EVENT(dma_map_sg, map_sg,
-	TP_PROTO(struct device *dev, int index, int total,
-		 struct scatterlist *sg),
-	TP_ARGS(dev, index, total, sg)
-);
-
-DEFINE_EVENT(dma_map_sg, bounce_map_sg,
-	TP_PROTO(struct device *dev, int index, int total,
-		 struct scatterlist *sg),
-	TP_ARGS(dev, index, total, sg)
-);
-
 TRACE_EVENT(qi_submit,
 	TP_PROTO(struct intel_iommu *iommu, u64 qw0, u64 qw1, u64 qw2, u64 qw3),
 
-- 
2.25.1


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

* [PATCH 2/5] iommu/vt-d: Remove svm_dev_ops
  2021-03-23  1:05 [PATCH 0/5] iommu/vt-d: Several misc cleanups Lu Baolu
  2021-03-23  1:05 ` [PATCH 1/5] iommu/vt-d: Remove unused dma map/unmap trace events Lu Baolu
@ 2021-03-23  1:05 ` Lu Baolu
  2021-03-23 17:29   ` Christoph Hellwig
  2021-03-23  1:05 ` [PATCH 3/5] iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID Lu Baolu
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Lu Baolu @ 2021-03-23  1:05 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu, iommu,
	linux-kernel, Lu Baolu

The svm_dev_ops has never been referenced in the tree, and there's no
plan to have anything to use it. Remove it to make the code neat.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/svm.c   | 15 +--------------
 include/linux/intel-iommu.h |  3 ---
 include/linux/intel-svm.h   |  7 -------
 3 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index 5d590d63ab52..875ee74d8c41 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -462,7 +462,6 @@ static void load_pasid(struct mm_struct *mm, u32 pasid)
 /* Caller must hold pasid_mutex, mm reference */
 static int
 intel_svm_bind_mm(struct device *dev, unsigned int flags,
-		  struct svm_dev_ops *ops,
 		  struct mm_struct *mm, struct intel_svm_dev **sd)
 {
 	struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
@@ -512,10 +511,6 @@ intel_svm_bind_mm(struct device *dev, unsigned int flags,
 
 			/* Find the matching device in svm list */
 			for_each_svm_dev(sdev, svm, dev) {
-				if (sdev->ops != ops) {
-					ret = -EBUSY;
-					goto out;
-				}
 				sdev->users++;
 				goto success;
 			}
@@ -550,7 +545,6 @@ intel_svm_bind_mm(struct device *dev, unsigned int flags,
 
 	/* Finish the setup now we know we're keeping it */
 	sdev->users = 1;
-	sdev->ops = ops;
 	init_rcu_head(&sdev->rcu);
 
 	if (!svm) {
@@ -1006,13 +1000,6 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 		mmap_read_unlock(svm->mm);
 		mmput(svm->mm);
 bad_req:
-		WARN_ON(!sdev);
-		if (sdev && sdev->ops && sdev->ops->fault_cb) {
-			int rwxp = (req->rd_req << 3) | (req->wr_req << 2) |
-				(req->exe_req << 1) | (req->pm_req);
-			sdev->ops->fault_cb(sdev->dev, req->pasid, req->addr,
-					    req->priv_data, rwxp, result);
-		}
 		/* We get here in the error case where the PASID lookup failed,
 		   and these can be NULL. Do not use them below this point! */
 		sdev = NULL;
@@ -1087,7 +1074,7 @@ intel_svm_bind(struct device *dev, struct mm_struct *mm, void *drvdata)
 	if (drvdata)
 		flags = *(unsigned int *)drvdata;
 	mutex_lock(&pasid_mutex);
-	ret = intel_svm_bind_mm(dev, flags, NULL, mm, &sdev);
+	ret = intel_svm_bind_mm(dev, flags, mm, &sdev);
 	if (ret)
 		sva = ERR_PTR(ret);
 	else if (sdev)
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 76f974da8ca4..03faf20a6817 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -770,14 +770,11 @@ u32 intel_svm_get_pasid(struct iommu_sva *handle);
 int intel_svm_page_response(struct device *dev, struct iommu_fault_event *evt,
 			    struct iommu_page_response *msg);
 
-struct svm_dev_ops;
-
 struct intel_svm_dev {
 	struct list_head list;
 	struct rcu_head rcu;
 	struct device *dev;
 	struct intel_iommu *iommu;
-	struct svm_dev_ops *ops;
 	struct iommu_sva sva;
 	u32 pasid;
 	int users;
diff --git a/include/linux/intel-svm.h b/include/linux/intel-svm.h
index 39d368a810b8..6c9d10c0fb1e 100644
--- a/include/linux/intel-svm.h
+++ b/include/linux/intel-svm.h
@@ -8,13 +8,6 @@
 #ifndef __INTEL_SVM_H__
 #define __INTEL_SVM_H__
 
-struct device;
-
-struct svm_dev_ops {
-	void (*fault_cb)(struct device *dev, u32 pasid, u64 address,
-			 void *private, int rwxp, int response);
-};
-
 /* Values for rxwp in fault_cb callback */
 #define SVM_REQ_READ	(1<<3)
 #define SVM_REQ_WRITE	(1<<2)
-- 
2.25.1


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

* [PATCH 3/5] iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID
  2021-03-23  1:05 [PATCH 0/5] iommu/vt-d: Several misc cleanups Lu Baolu
  2021-03-23  1:05 ` [PATCH 1/5] iommu/vt-d: Remove unused dma map/unmap trace events Lu Baolu
  2021-03-23  1:05 ` [PATCH 2/5] iommu/vt-d: Remove svm_dev_ops Lu Baolu
@ 2021-03-23  1:05 ` Lu Baolu
  2021-03-23 17:33   ` Christoph Hellwig
  2021-03-23  1:05 ` [PATCH 4/5] iommu/vt-d: Remove unused function declarations Lu Baolu
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Lu Baolu @ 2021-03-23  1:05 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu, iommu,
	linux-kernel, Lu Baolu

The SVM_FLAG_PRIVATE_PASID has never been referenced in the tree, and
there's no plan to have anything to use it. So cleanup it.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/svm.c | 40 ++++++++++++++++++---------------------
 include/linux/intel-svm.h | 16 +++-------------
 2 files changed, 21 insertions(+), 35 deletions(-)

diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index 875ee74d8c41..5165cea90421 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -465,9 +465,9 @@ intel_svm_bind_mm(struct device *dev, unsigned int flags,
 		  struct mm_struct *mm, struct intel_svm_dev **sd)
 {
 	struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
+	struct intel_svm *svm = NULL, *t;
 	struct device_domain_info *info;
 	struct intel_svm_dev *sdev;
-	struct intel_svm *svm = NULL;
 	unsigned long iflags;
 	int pasid_max;
 	int ret;
@@ -493,30 +493,26 @@ intel_svm_bind_mm(struct device *dev, unsigned int flags,
 		}
 	}
 
-	if (!(flags & SVM_FLAG_PRIVATE_PASID)) {
-		struct intel_svm *t;
-
-		list_for_each_entry(t, &global_svm_list, list) {
-			if (t->mm != mm || (t->flags & SVM_FLAG_PRIVATE_PASID))
-				continue;
-
-			svm = t;
-			if (svm->pasid >= pasid_max) {
-				dev_warn(dev,
-					 "Limited PASID width. Cannot use existing PASID %d\n",
-					 svm->pasid);
-				ret = -ENOSPC;
-				goto out;
-			}
+	list_for_each_entry(t, &global_svm_list, list) {
+		if (t->mm != mm)
+			continue;
 
-			/* Find the matching device in svm list */
-			for_each_svm_dev(sdev, svm, dev) {
-				sdev->users++;
-				goto success;
-			}
+		svm = t;
+		if (svm->pasid >= pasid_max) {
+			dev_warn(dev,
+				 "Limited PASID width. Cannot use existing PASID %d\n",
+				 svm->pasid);
+			ret = -ENOSPC;
+			goto out;
+		}
 
-			break;
+		/* Find the matching device in svm list */
+		for_each_svm_dev(sdev, svm, dev) {
+			sdev->users++;
+			goto success;
 		}
+
+		break;
 	}
 
 	sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
diff --git a/include/linux/intel-svm.h b/include/linux/intel-svm.h
index 6c9d10c0fb1e..10fa80eef13a 100644
--- a/include/linux/intel-svm.h
+++ b/include/linux/intel-svm.h
@@ -14,16 +14,6 @@
 #define SVM_REQ_EXEC	(1<<1)
 #define SVM_REQ_PRIV	(1<<0)
 
-/*
- * The SVM_FLAG_PRIVATE_PASID flag requests a PASID which is *not* the "main"
- * PASID for the current process. Even if a PASID already exists, a new one
- * will be allocated. And the PASID allocated with SVM_FLAG_PRIVATE_PASID
- * will not be given to subsequent callers. This facility allows a driver to
- * disambiguate between multiple device contexts which access the same MM,
- * if there is no other way to do so. It should be used sparingly, if at all.
- */
-#define SVM_FLAG_PRIVATE_PASID		(1<<0)
-
 /*
  * The SVM_FLAG_SUPERVISOR_MODE flag requests a PASID which can be used only
  * for access to kernel addresses. No IOTLB flushes are automatically done
@@ -35,18 +25,18 @@
  * It is unlikely that we will ever hook into flush_tlb_kernel_range() to
  * do such IOTLB flushes automatically.
  */
-#define SVM_FLAG_SUPERVISOR_MODE	(1<<1)
+#define SVM_FLAG_SUPERVISOR_MODE	BIT(0)
 /*
  * The SVM_FLAG_GUEST_MODE flag is used when a PASID bind is for guest
  * processes. Compared to the host bind, the primary differences are:
  * 1. mm life cycle management
  * 2. fault reporting
  */
-#define SVM_FLAG_GUEST_MODE		(1<<2)
+#define SVM_FLAG_GUEST_MODE		BIT(1)
 /*
  * The SVM_FLAG_GUEST_PASID flag is used when a guest has its own PASID space,
  * which requires guest and host PASID translation at both directions.
  */
-#define SVM_FLAG_GUEST_PASID		(1<<3)
+#define SVM_FLAG_GUEST_PASID		BIT(2)
 
 #endif /* __INTEL_SVM_H__ */
-- 
2.25.1


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

* [PATCH 4/5] iommu/vt-d: Remove unused function declarations
  2021-03-23  1:05 [PATCH 0/5] iommu/vt-d: Several misc cleanups Lu Baolu
                   ` (2 preceding siblings ...)
  2021-03-23  1:05 ` [PATCH 3/5] iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID Lu Baolu
@ 2021-03-23  1:05 ` Lu Baolu
  2021-03-23 17:35   ` Christoph Hellwig
  2021-03-23  1:06 ` [PATCH 5/5] iommu/vt-d: Make unnecessarily global functions static Lu Baolu
  2021-04-07  8:16 ` [PATCH 0/5] iommu/vt-d: Several misc cleanups Joerg Roedel
  5 siblings, 1 reply; 13+ messages in thread
From: Lu Baolu @ 2021-03-23  1:05 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu, iommu,
	linux-kernel, Lu Baolu

Some functions have been deprecated. Remove the remaining function
delarations.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/pasid.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/iommu/intel/pasid.h b/drivers/iommu/intel/pasid.h
index 444c0bec221a..90a3268d7a77 100644
--- a/drivers/iommu/intel/pasid.h
+++ b/drivers/iommu/intel/pasid.h
@@ -99,9 +99,6 @@ static inline bool pasid_pte_is_present(struct pasid_entry *pte)
 }
 
 extern unsigned int intel_pasid_max_id;
-int intel_pasid_alloc_id(void *ptr, int start, int end, gfp_t gfp);
-void intel_pasid_free_id(u32 pasid);
-void *intel_pasid_lookup_id(u32 pasid);
 int intel_pasid_alloc_table(struct device *dev);
 void intel_pasid_free_table(struct device *dev);
 struct pasid_table *intel_pasid_get_table(struct device *dev);
-- 
2.25.1


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

* [PATCH 5/5] iommu/vt-d: Make unnecessarily global functions static
  2021-03-23  1:05 [PATCH 0/5] iommu/vt-d: Several misc cleanups Lu Baolu
                   ` (3 preceding siblings ...)
  2021-03-23  1:05 ` [PATCH 4/5] iommu/vt-d: Remove unused function declarations Lu Baolu
@ 2021-03-23  1:06 ` Lu Baolu
  2021-03-23 17:37   ` Christoph Hellwig
  2021-04-07  8:16 ` [PATCH 0/5] iommu/vt-d: Several misc cleanups Joerg Roedel
  5 siblings, 1 reply; 13+ messages in thread
From: Lu Baolu @ 2021-03-23  1:06 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu, iommu,
	linux-kernel, Lu Baolu

Make some functions static as they are only used inside pasid.c.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/pasid.c | 4 ++--
 drivers/iommu/intel/pasid.h | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
index f2c747e62c6a..c896aef7db40 100644
--- a/drivers/iommu/intel/pasid.c
+++ b/drivers/iommu/intel/pasid.c
@@ -230,7 +230,7 @@ struct pasid_table *intel_pasid_get_table(struct device *dev)
 	return info->pasid_table;
 }
 
-int intel_pasid_get_dev_max_id(struct device *dev)
+static int intel_pasid_get_dev_max_id(struct device *dev)
 {
 	struct device_domain_info *info;
 
@@ -241,7 +241,7 @@ int intel_pasid_get_dev_max_id(struct device *dev)
 	return info->pasid_table->max_pasid;
 }
 
-struct pasid_entry *intel_pasid_get_entry(struct device *dev, u32 pasid)
+static struct pasid_entry *intel_pasid_get_entry(struct device *dev, u32 pasid)
 {
 	struct device_domain_info *info;
 	struct pasid_table *pasid_table;
diff --git a/drivers/iommu/intel/pasid.h b/drivers/iommu/intel/pasid.h
index 90a3268d7a77..079534fcf55d 100644
--- a/drivers/iommu/intel/pasid.h
+++ b/drivers/iommu/intel/pasid.h
@@ -102,8 +102,6 @@ extern unsigned int intel_pasid_max_id;
 int intel_pasid_alloc_table(struct device *dev);
 void intel_pasid_free_table(struct device *dev);
 struct pasid_table *intel_pasid_get_table(struct device *dev);
-int intel_pasid_get_dev_max_id(struct device *dev);
-struct pasid_entry *intel_pasid_get_entry(struct device *dev, u32 pasid);
 int intel_pasid_setup_first_level(struct intel_iommu *iommu,
 				  struct device *dev, pgd_t *pgd,
 				  u32 pasid, u16 did, int flags);
-- 
2.25.1


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

* Re: [PATCH 1/5] iommu/vt-d: Remove unused dma map/unmap trace events
  2021-03-23  1:05 ` [PATCH 1/5] iommu/vt-d: Remove unused dma map/unmap trace events Lu Baolu
@ 2021-03-23 17:26   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2021-03-23 17:26 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Joerg Roedel, Will Deacon, ashok.raj, kevin.tian, jacob.jun.pan,
	yi.l.liu, iommu, linux-kernel

On Tue, Mar 23, 2021 at 09:05:56AM +0800, Lu Baolu wrote:
> With commit c588072bba6b5 ("iommu/vt-d: Convert intel iommu driver to
> the iommu ops"), the trace events for dma map/unmap have no users any
> more. Cleanup them to make the code neat.
> 
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH 2/5] iommu/vt-d: Remove svm_dev_ops
  2021-03-23  1:05 ` [PATCH 2/5] iommu/vt-d: Remove svm_dev_ops Lu Baolu
@ 2021-03-23 17:29   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2021-03-23 17:29 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Joerg Roedel, Will Deacon, ashok.raj, kevin.tian, jacob.jun.pan,
	yi.l.liu, iommu, linux-kernel

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH 3/5] iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID
  2021-03-23  1:05 ` [PATCH 3/5] iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID Lu Baolu
@ 2021-03-23 17:33   ` Christoph Hellwig
  2021-03-24  7:25     ` Lu Baolu
  0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2021-03-23 17:33 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Joerg Roedel, Will Deacon, ashok.raj, kevin.tian, jacob.jun.pan,
	yi.l.liu, iommu, linux-kernel

On Tue, Mar 23, 2021 at 09:05:58AM +0800, Lu Baolu wrote:
> The SVM_FLAG_PRIVATE_PASID has never been referenced in the tree, and
> there's no plan to have anything to use it. So cleanup it.
> 
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

But can we take this a little further?  SVM_FLAG_GUEST_PASID is unused
as well.  SVM_FLAG_GUEST_MODE is only used in drivers/iommu/intel/svm.c,
and SVM_FLAG_SUPERVISOR_MODE is actually used as an API flag to
iommu_sva_bind_device.  So IMHO the latter should be elevated to an
IOMMU API level flag, and then include/linux/intel-svm.h can go away
entirely or at least be moved to drivers/iommu/intel/.

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

* Re: [PATCH 4/5] iommu/vt-d: Remove unused function declarations
  2021-03-23  1:05 ` [PATCH 4/5] iommu/vt-d: Remove unused function declarations Lu Baolu
@ 2021-03-23 17:35   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2021-03-23 17:35 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Joerg Roedel, Will Deacon, ashok.raj, kevin.tian, jacob.jun.pan,
	yi.l.liu, iommu, linux-kernel

On Tue, Mar 23, 2021 at 09:05:59AM +0800, Lu Baolu wrote:
> Some functions have been deprecated. Remove the remaining function
> delarations.

s/deprecated/removed/g

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH 5/5] iommu/vt-d: Make unnecessarily global functions static
  2021-03-23  1:06 ` [PATCH 5/5] iommu/vt-d: Make unnecessarily global functions static Lu Baolu
@ 2021-03-23 17:37   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2021-03-23 17:37 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Joerg Roedel, Will Deacon, ashok.raj, kevin.tian, jacob.jun.pan,
	yi.l.liu, iommu, linux-kernel

On Tue, Mar 23, 2021 at 09:06:00AM +0800, Lu Baolu wrote:
> Make some functions static as they are only used inside pasid.c.
> 
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH 3/5] iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID
  2021-03-23 17:33   ` Christoph Hellwig
@ 2021-03-24  7:25     ` Lu Baolu
  0 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2021-03-24  7:25 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: baolu.lu, Joerg Roedel, Will Deacon, ashok.raj, kevin.tian,
	jacob.jun.pan, yi.l.liu, iommu, linux-kernel

Hi Christoph,

On 3/24/21 1:33 AM, Christoph Hellwig wrote:
> On Tue, Mar 23, 2021 at 09:05:58AM +0800, Lu Baolu wrote:
>> The SVM_FLAG_PRIVATE_PASID has never been referenced in the tree, and
>> there's no plan to have anything to use it. So cleanup it.
>>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> 
> Looks good,
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thank you!

> 
> But can we take this a little further?  SVM_FLAG_GUEST_PASID is unused
> as well.  SVM_FLAG_GUEST_MODE is only used in drivers/iommu/intel/svm.c,
> and SVM_FLAG_SUPERVISOR_MODE is actually used as an API flag to
> iommu_sva_bind_device.  So IMHO the latter should be elevated to an
> IOMMU API level flag, and then include/linux/intel-svm.h can go away
> entirely or at least be moved to drivers/iommu/intel/.
> 

Sure. I will consider it and make it in separated patches.

Best regards,
baolu

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

* Re: [PATCH 0/5] iommu/vt-d: Several misc cleanups
  2021-03-23  1:05 [PATCH 0/5] iommu/vt-d: Several misc cleanups Lu Baolu
                   ` (4 preceding siblings ...)
  2021-03-23  1:06 ` [PATCH 5/5] iommu/vt-d: Make unnecessarily global functions static Lu Baolu
@ 2021-04-07  8:16 ` Joerg Roedel
  5 siblings, 0 replies; 13+ messages in thread
From: Joerg Roedel @ 2021-04-07  8:16 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Will Deacon, ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu,
	iommu, linux-kernel

On Tue, Mar 23, 2021 at 09:05:55AM +0800, Lu Baolu wrote:
> Lu Baolu (5):
>   iommu/vt-d: Remove unused dma map/unmap trace events
>   iommu/vt-d: Remove svm_dev_ops
>   iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID
>   iommu/vt-d: Remove unused function declarations
>   iommu/vt-d: Make unnecessarily global functions static

Applied all, thanks.

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

end of thread, other threads:[~2021-04-07  8:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23  1:05 [PATCH 0/5] iommu/vt-d: Several misc cleanups Lu Baolu
2021-03-23  1:05 ` [PATCH 1/5] iommu/vt-d: Remove unused dma map/unmap trace events Lu Baolu
2021-03-23 17:26   ` Christoph Hellwig
2021-03-23  1:05 ` [PATCH 2/5] iommu/vt-d: Remove svm_dev_ops Lu Baolu
2021-03-23 17:29   ` Christoph Hellwig
2021-03-23  1:05 ` [PATCH 3/5] iommu/vt-d: Remove SVM_FLAG_PRIVATE_PASID Lu Baolu
2021-03-23 17:33   ` Christoph Hellwig
2021-03-24  7:25     ` Lu Baolu
2021-03-23  1:05 ` [PATCH 4/5] iommu/vt-d: Remove unused function declarations Lu Baolu
2021-03-23 17:35   ` Christoph Hellwig
2021-03-23  1:06 ` [PATCH 5/5] iommu/vt-d: Make unnecessarily global functions static Lu Baolu
2021-03-23 17:37   ` Christoph Hellwig
2021-04-07  8:16 ` [PATCH 0/5] iommu/vt-d: Several misc cleanups 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).