Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes
@ 2024-08-28 11:10 Vasant Hegde
  2024-08-28 11:10 ` [PATCH 1/8] iommu/amd: Update event log pointer as soon as processing is complete Vasant Hegde
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

This series contains misc cleanup and trivial fixes.

This series is based on top of iommu/next branch.

-Vasant

Vasant Hegde (8):
  iommu/amd: Update event log pointer as soon as processing is complete
  iommu/amd: Make amd_iommu_is_attach_deferred() static
  iommu/amd: Remove unused DTE_GCR3_INDEX_* macros
  iommu/amd: Handle error path in amd_iommu_probe_device()
  iommu/amd: Make amd_iommu_dev_flush_pasid_all() static
  iommu/amd: Make amd_iommu_domain_flush_complete() static
  iommu/amd: Rework amd_iommu_update_and_flush_device_table()
  iommu/amd: Make amd_iommu_dev_update_dte() static

 drivers/iommu/amd/amd_iommu.h       |  5 --
 drivers/iommu/amd/amd_iommu_types.h |  4 --
 drivers/iommu/amd/io_pgtable.c      |  1 -
 drivers/iommu/amd/iommu.c           | 87 ++++++++++++++---------------
 4 files changed, 41 insertions(+), 56 deletions(-)


base-commit: 0e922e0fecffdb8e0f5ea9c00754f65a17e5a535
-- 
2.31.1


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

* [PATCH 1/8] iommu/amd: Update event log pointer as soon as processing is complete
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
@ 2024-08-28 11:10 ` Vasant Hegde
  2024-08-28 11:10 ` [PATCH 2/8] iommu/amd: Make amd_iommu_is_attach_deferred() static Vasant Hegde
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

Update event buffer head pointer once driver completes processing. So
that IOMMU can write new log without waiting for driver to complete
processing all event logs.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/iommu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index dbe838828efe..e13e401c52de 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -825,10 +825,12 @@ static void iommu_poll_events(struct amd_iommu *iommu)
 
 	while (head != tail) {
 		iommu_print_event(iommu, iommu->evt_buf + head);
+
+		/* Update head pointer of hardware ring-buffer */
 		head = (head + EVENT_ENTRY_SIZE) % EVT_BUFFER_SIZE;
+		writel(head, iommu->mmio_base + MMIO_EVT_HEAD_OFFSET);
 	}
 
-	writel(head, iommu->mmio_base + MMIO_EVT_HEAD_OFFSET);
 }
 
 #ifdef CONFIG_IRQ_REMAP
-- 
2.31.1


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

* [PATCH 2/8] iommu/amd: Make amd_iommu_is_attach_deferred() static
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
  2024-08-28 11:10 ` [PATCH 1/8] iommu/amd: Update event log pointer as soon as processing is complete Vasant Hegde
@ 2024-08-28 11:10 ` Vasant Hegde
  2024-08-28 11:10 ` [PATCH 3/8] iommu/amd: Remove unused DTE_GCR3_INDEX_* macros Vasant Hegde
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

amd_iommu_is_attach_deferred() is a callback function called by
iommu_ops. Make it as static.

No functional changes intended.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/amd_iommu.h | 1 -
 drivers/iommu/amd/iommu.c     | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h
index 52e18b5f99fd..a9e207ec2bbb 100644
--- a/drivers/iommu/amd/amd_iommu.h
+++ b/drivers/iommu/amd/amd_iommu.h
@@ -180,7 +180,6 @@ static inline struct protection_domain *to_pdomain(struct iommu_domain *dom)
 }
 
 bool translation_pre_enabled(struct amd_iommu *iommu);
-bool amd_iommu_is_attach_deferred(struct device *dev);
 int __init add_special_device(u8 type, u8 id, u32 *devid, bool cmd_line);
 
 #ifdef CONFIG_DMI
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index e13e401c52de..c57ea47183c3 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2785,7 +2785,7 @@ static void amd_iommu_get_resv_regions(struct device *dev,
 	list_add_tail(&region->list, head);
 }
 
-bool amd_iommu_is_attach_deferred(struct device *dev)
+static bool amd_iommu_is_attach_deferred(struct device *dev)
 {
 	struct iommu_dev_data *dev_data = dev_iommu_priv_get(dev);
 
-- 
2.31.1


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

* [PATCH 3/8] iommu/amd: Remove unused DTE_GCR3_INDEX_* macros
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
  2024-08-28 11:10 ` [PATCH 1/8] iommu/amd: Update event log pointer as soon as processing is complete Vasant Hegde
  2024-08-28 11:10 ` [PATCH 2/8] iommu/amd: Make amd_iommu_is_attach_deferred() static Vasant Hegde
@ 2024-08-28 11:10 ` Vasant Hegde
  2024-08-28 11:10 ` [PATCH 4/8] iommu/amd: Handle error path in amd_iommu_probe_device() Vasant Hegde
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

It was added in commit 52815b75682e ("iommu/amd: Add support for
IOMMUv2 domain mode"), but never used it. Hence remove these unused
macros.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/amd_iommu_types.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
index c9f9a598eb82..c7432296bb90 100644
--- a/drivers/iommu/amd/amd_iommu_types.h
+++ b/drivers/iommu/amd/amd_iommu_types.h
@@ -415,10 +415,6 @@
 #define DTE_GCR3_VAL_B(x)	(((x) >> 15) & 0x0ffffULL)
 #define DTE_GCR3_VAL_C(x)	(((x) >> 31) & 0x1fffffULL)
 
-#define DTE_GCR3_INDEX_A	0
-#define DTE_GCR3_INDEX_B	1
-#define DTE_GCR3_INDEX_C	1
-
 #define DTE_GCR3_SHIFT_A	58
 #define DTE_GCR3_SHIFT_B	16
 #define DTE_GCR3_SHIFT_C	43
-- 
2.31.1


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

* [PATCH 4/8] iommu/amd: Handle error path in amd_iommu_probe_device()
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
                   ` (2 preceding siblings ...)
  2024-08-28 11:10 ` [PATCH 3/8] iommu/amd: Remove unused DTE_GCR3_INDEX_* macros Vasant Hegde
@ 2024-08-28 11:10 ` Vasant Hegde
  2024-08-28 11:10 ` [PATCH 5/8] iommu/amd: Make amd_iommu_dev_flush_pasid_all() static Vasant Hegde
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

Do not try to set max_pasids in error path as dev_data is not allocated.

Fixes: a0c47f233e68 ("iommu/amd: Introduce iommu_dev_data.max_pasids")
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/iommu.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index c57ea47183c3..be31a263ac6f 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2187,11 +2187,12 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
 		dev_err(dev, "Failed to initialize - trying to proceed anyway\n");
 		iommu_dev = ERR_PTR(ret);
 		iommu_ignore_device(iommu, dev);
-	} else {
-		amd_iommu_set_pci_msi_domain(dev, iommu);
-		iommu_dev = &iommu->iommu;
+		goto out_err;
 	}
 
+	amd_iommu_set_pci_msi_domain(dev, iommu);
+	iommu_dev = &iommu->iommu;
+
 	/*
 	 * If IOMMU and device supports PASID then it will contain max
 	 * supported PASIDs, else it will be zero.
@@ -2203,11 +2204,12 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
 					     pci_max_pasids(to_pci_dev(dev)));
 	}
 
-	iommu_completion_wait(iommu);
-
 	if (dev_is_pci(dev))
 		pci_prepare_ats(to_pci_dev(dev), PAGE_SHIFT);
 
+out_err:
+	iommu_completion_wait(iommu);
+
 	return iommu_dev;
 }
 
-- 
2.31.1


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

* [PATCH 5/8] iommu/amd: Make amd_iommu_dev_flush_pasid_all() static
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
                   ` (3 preceding siblings ...)
  2024-08-28 11:10 ` [PATCH 4/8] iommu/amd: Handle error path in amd_iommu_probe_device() Vasant Hegde
@ 2024-08-28 11:10 ` Vasant Hegde
  2024-08-28 11:10 ` [PATCH 6/8] iommu/amd: Make amd_iommu_domain_flush_complete() static Vasant Hegde
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

As its not used outside iommu.c. Also rename it as dev_flush_pasid_all().

No functional change intended.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/amd_iommu.h | 2 --
 drivers/iommu/amd/iommu.c     | 6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h
index a9e207ec2bbb..d0a24ec3ada2 100644
--- a/drivers/iommu/amd/amd_iommu.h
+++ b/drivers/iommu/amd/amd_iommu.h
@@ -93,8 +93,6 @@ void amd_iommu_domain_flush_pages(struct protection_domain *domain,
 				  u64 address, size_t size);
 void amd_iommu_dev_flush_pasid_pages(struct iommu_dev_data *dev_data,
 				     ioasid_t pasid, u64 address, size_t size);
-void amd_iommu_dev_flush_pasid_all(struct iommu_dev_data *dev_data,
-				   ioasid_t pasid);
 
 #ifdef CONFIG_IRQ_REMAP
 int amd_iommu_create_irq_domain(struct amd_iommu *iommu);
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index be31a263ac6f..c06189a811ea 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1551,8 +1551,8 @@ void amd_iommu_dev_flush_pasid_pages(struct iommu_dev_data *dev_data,
 	iommu_completion_wait(iommu);
 }
 
-void amd_iommu_dev_flush_pasid_all(struct iommu_dev_data *dev_data,
-				   ioasid_t pasid)
+static void dev_flush_pasid_all(struct iommu_dev_data *dev_data,
+				ioasid_t pasid)
 {
 	amd_iommu_dev_flush_pasid_pages(dev_data, 0,
 					CMD_INV_IOMMU_ALL_PAGES_ADDRESS, pasid);
@@ -1818,7 +1818,7 @@ static int update_gcr3(struct iommu_dev_data *dev_data,
 	else
 		*pte = 0;
 
-	amd_iommu_dev_flush_pasid_all(dev_data, pasid);
+	dev_flush_pasid_all(dev_data, pasid);
 	return 0;
 }
 
-- 
2.31.1


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

* [PATCH 6/8] iommu/amd: Make amd_iommu_domain_flush_complete() static
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
                   ` (4 preceding siblings ...)
  2024-08-28 11:10 ` [PATCH 5/8] iommu/amd: Make amd_iommu_dev_flush_pasid_all() static Vasant Hegde
@ 2024-08-28 11:10 ` Vasant Hegde
  2024-08-28 11:10 ` [PATCH 7/8] iommu/amd: Rework amd_iommu_update_and_flush_device_table() Vasant Hegde
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

AMD driver uses amd_iommu_domain_flush_complete() function to make sure
IOMMU processed invalidation commands before proceeding. Ideally this
should be called from functions which updates DTE/invalidates caches.
There is no need to call this function explicitly. This patches makes
below changes :

- Rename amd_iommu_domain_flush_complete() -> domain_flush_complete()
  and make it as static function.

- Rearrage domain_flush_complete() to avoid forward declaration.

- Update amd_iommu_update_and_flush_device_table() to call
  domain_flush_complete().

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/amd_iommu.h  |  1 -
 drivers/iommu/amd/io_pgtable.c |  1 -
 drivers/iommu/amd/iommu.c      | 37 +++++++++++++++++-----------------
 3 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h
index d0a24ec3ada2..94402b88789d 100644
--- a/drivers/iommu/amd/amd_iommu.h
+++ b/drivers/iommu/amd/amd_iommu.h
@@ -88,7 +88,6 @@ void amd_iommu_flush_all_caches(struct amd_iommu *iommu);
 void amd_iommu_update_and_flush_device_table(struct protection_domain *domain);
 void amd_iommu_domain_update(struct protection_domain *domain);
 void amd_iommu_dev_update_dte(struct iommu_dev_data *dev_data, bool set);
-void amd_iommu_domain_flush_complete(struct protection_domain *domain);
 void amd_iommu_domain_flush_pages(struct protection_domain *domain,
 				  u64 address, size_t size);
 void amd_iommu_dev_flush_pasid_pages(struct iommu_dev_data *dev_data,
diff --git a/drivers/iommu/amd/io_pgtable.c b/drivers/iommu/amd/io_pgtable.c
index 1074ee25064d..bfbcec68efb9 100644
--- a/drivers/iommu/amd/io_pgtable.c
+++ b/drivers/iommu/amd/io_pgtable.c
@@ -175,7 +175,6 @@ static bool increase_address_space(struct protection_domain *domain,
 	domain->iop.root  = pte;
 	domain->iop.mode += 1;
 	amd_iommu_update_and_flush_device_table(domain);
-	amd_iommu_domain_flush_complete(domain);
 
 	/*
 	 * Device Table needs to be updated and flushed before the new root can
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index c06189a811ea..56c51b83ee6b 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1249,6 +1249,22 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
 	return ret;
 }
 
+static void domain_flush_complete(struct protection_domain *domain)
+{
+	int i;
+
+	for (i = 0; i < amd_iommu_get_num_iommus(); ++i) {
+		if (domain && !domain->dev_iommu[i])
+			continue;
+
+		/*
+		 * Devices of this domain are behind this IOMMU
+		 * We need to wait for completion of all commands.
+		 */
+		iommu_completion_wait(amd_iommus[i]);
+	}
+}
+
 static int iommu_flush_dte(struct amd_iommu *iommu, u16 devid)
 {
 	struct iommu_cmd cmd;
@@ -1485,7 +1501,7 @@ void amd_iommu_domain_flush_pages(struct protection_domain *domain,
 		__domain_flush_pages(domain, address, size);
 
 		/* Wait until IOMMU TLB and all device IOTLB flushes are complete */
-		amd_iommu_domain_flush_complete(domain);
+		domain_flush_complete(domain);
 
 		return;
 	}
@@ -1525,7 +1541,7 @@ void amd_iommu_domain_flush_pages(struct protection_domain *domain,
 	}
 
 	/* Wait until IOMMU TLB and all device IOTLB flushes are complete */
-	amd_iommu_domain_flush_complete(domain);
+	domain_flush_complete(domain);
 }
 
 /* Flush the whole IO/TLB for a given protection domain - including PDE */
@@ -1558,22 +1574,6 @@ static void dev_flush_pasid_all(struct iommu_dev_data *dev_data,
 					CMD_INV_IOMMU_ALL_PAGES_ADDRESS, pasid);
 }
 
-void amd_iommu_domain_flush_complete(struct protection_domain *domain)
-{
-	int i;
-
-	for (i = 0; i < amd_iommu_get_num_iommus(); ++i) {
-		if (domain && !domain->dev_iommu[i])
-			continue;
-
-		/*
-		 * Devices of this domain are behind this IOMMU
-		 * We need to wait for completion of all commands.
-		 */
-		iommu_completion_wait(amd_iommus[i]);
-	}
-}
-
 /* Flush the not present cache if it exists */
 static void domain_flush_np_cache(struct protection_domain *domain,
 		dma_addr_t iova, size_t size)
@@ -1615,6 +1615,7 @@ void amd_iommu_update_and_flush_device_table(struct protection_domain *domain)
 {
 	update_device_table(domain);
 	domain_flush_devices(domain);
+	domain_flush_complete(domain);
 }
 
 void amd_iommu_domain_update(struct protection_domain *domain)
-- 
2.31.1


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

* [PATCH 7/8] iommu/amd: Rework amd_iommu_update_and_flush_device_table()
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
                   ` (5 preceding siblings ...)
  2024-08-28 11:10 ` [PATCH 6/8] iommu/amd: Make amd_iommu_domain_flush_complete() static Vasant Hegde
@ 2024-08-28 11:10 ` Vasant Hegde
  2024-08-28 11:10 ` [PATCH 8/8] iommu/amd: Make amd_iommu_dev_update_dte() static Vasant Hegde
  2024-09-04  9:36 ` [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Joerg Roedel
  8 siblings, 0 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

Remove separate function to update and flush the device table as only
amd_iommu_update_and_flush_device_table() calls these functions.

No functional changes intended.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/iommu.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 56c51b83ee6b..808959be0902 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1591,15 +1591,7 @@ static void domain_flush_np_cache(struct protection_domain *domain,
 /*
  * This function flushes the DTEs for all devices in domain
  */
-static void domain_flush_devices(struct protection_domain *domain)
-{
-	struct iommu_dev_data *dev_data;
-
-	list_for_each_entry(dev_data, &domain->dev_list, list)
-		device_flush_dte(dev_data);
-}
-
-static void update_device_table(struct protection_domain *domain)
+void amd_iommu_update_and_flush_device_table(struct protection_domain *domain)
 {
 	struct iommu_dev_data *dev_data;
 
@@ -1609,12 +1601,10 @@ static void update_device_table(struct protection_domain *domain)
 		set_dte_entry(iommu, dev_data);
 		clone_aliases(iommu, dev_data->dev);
 	}
-}
 
-void amd_iommu_update_and_flush_device_table(struct protection_domain *domain)
-{
-	update_device_table(domain);
-	domain_flush_devices(domain);
+	list_for_each_entry(dev_data, &domain->dev_list, list)
+		device_flush_dte(dev_data);
+
 	domain_flush_complete(domain);
 }
 
-- 
2.31.1


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

* [PATCH 8/8] iommu/amd: Make amd_iommu_dev_update_dte() static
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
                   ` (6 preceding siblings ...)
  2024-08-28 11:10 ` [PATCH 7/8] iommu/amd: Rework amd_iommu_update_and_flush_device_table() Vasant Hegde
@ 2024-08-28 11:10 ` Vasant Hegde
  2024-09-04  9:36 ` [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Joerg Roedel
  8 siblings, 0 replies; 10+ messages in thread
From: Vasant Hegde @ 2024-08-28 11:10 UTC (permalink / raw)
  To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde

As its used inside iommu.c only. Also rename function to dev_update_dte()
as its static function.

No functional changes intended.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/amd_iommu.h | 1 -
 drivers/iommu/amd/iommu.c     | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h
index 94402b88789d..705dd364afe3 100644
--- a/drivers/iommu/amd/amd_iommu.h
+++ b/drivers/iommu/amd/amd_iommu.h
@@ -87,7 +87,6 @@ int amd_iommu_complete_ppr(struct device *dev, u32 pasid, int status, int tag);
 void amd_iommu_flush_all_caches(struct amd_iommu *iommu);
 void amd_iommu_update_and_flush_device_table(struct protection_domain *domain);
 void amd_iommu_domain_update(struct protection_domain *domain);
-void amd_iommu_dev_update_dte(struct iommu_dev_data *dev_data, bool set);
 void amd_iommu_domain_flush_pages(struct protection_domain *domain,
 				  u64 address, size_t size);
 void amd_iommu_dev_flush_pasid_pages(struct iommu_dev_data *dev_data,
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 808959be0902..82c0ee527732 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1955,7 +1955,7 @@ static void clear_dte_entry(struct amd_iommu *iommu, u16 devid)
 }
 
 /* Update and flush DTE for the given device */
-void amd_iommu_dev_update_dte(struct iommu_dev_data *dev_data, bool set)
+static void dev_update_dte(struct iommu_dev_data *dev_data, bool set)
 {
 	struct amd_iommu *iommu = get_amd_iommu_from_dev(dev_data->dev);
 
@@ -2055,7 +2055,7 @@ static void do_detach(struct iommu_dev_data *dev_data)
 	struct amd_iommu *iommu = get_amd_iommu_from_dev_data(dev_data);
 
 	/* Clear DTE and flush the entry */
-	amd_iommu_dev_update_dte(dev_data, false);
+	dev_update_dte(dev_data, false);
 
 	/* Flush IOTLB and wait for the flushes to finish */
 	amd_iommu_domain_flush_all(domain);
@@ -2470,7 +2470,7 @@ static int blocked_domain_attach_device(struct iommu_domain *domain,
 
 	/* Clear DTE and flush the entry */
 	spin_lock(&dev_data->lock);
-	amd_iommu_dev_update_dte(dev_data, false);
+	dev_update_dte(dev_data, false);
 	spin_unlock(&dev_data->lock);
 
 	return 0;
@@ -2538,7 +2538,7 @@ static int amd_iommu_attach_device(struct iommu_domain *dom,
 	}
 
 	/* Update device table */
-	amd_iommu_dev_update_dte(dev_data, true);
+	dev_update_dte(dev_data, true);
 
 	return ret;
 }
-- 
2.31.1


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

* Re: [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes
  2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
                   ` (7 preceding siblings ...)
  2024-08-28 11:10 ` [PATCH 8/8] iommu/amd: Make amd_iommu_dev_update_dte() static Vasant Hegde
@ 2024-09-04  9:36 ` Joerg Roedel
  8 siblings, 0 replies; 10+ messages in thread
From: Joerg Roedel @ 2024-09-04  9:36 UTC (permalink / raw)
  To: Vasant Hegde; +Cc: iommu, will, robin.murphy, suravee.suthikulpanit

On Wed, Aug 28, 2024 at 11:10:21AM +0000, Vasant Hegde wrote:
> Vasant Hegde (8):
>   iommu/amd: Update event log pointer as soon as processing is complete
>   iommu/amd: Make amd_iommu_is_attach_deferred() static
>   iommu/amd: Remove unused DTE_GCR3_INDEX_* macros
>   iommu/amd: Handle error path in amd_iommu_probe_device()
>   iommu/amd: Make amd_iommu_dev_flush_pasid_all() static
>   iommu/amd: Make amd_iommu_domain_flush_complete() static
>   iommu/amd: Rework amd_iommu_update_and_flush_device_table()
>   iommu/amd: Make amd_iommu_dev_update_dte() static

Applied, thanks.

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

end of thread, other threads:[~2024-09-04  9:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 11:10 [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Vasant Hegde
2024-08-28 11:10 ` [PATCH 1/8] iommu/amd: Update event log pointer as soon as processing is complete Vasant Hegde
2024-08-28 11:10 ` [PATCH 2/8] iommu/amd: Make amd_iommu_is_attach_deferred() static Vasant Hegde
2024-08-28 11:10 ` [PATCH 3/8] iommu/amd: Remove unused DTE_GCR3_INDEX_* macros Vasant Hegde
2024-08-28 11:10 ` [PATCH 4/8] iommu/amd: Handle error path in amd_iommu_probe_device() Vasant Hegde
2024-08-28 11:10 ` [PATCH 5/8] iommu/amd: Make amd_iommu_dev_flush_pasid_all() static Vasant Hegde
2024-08-28 11:10 ` [PATCH 6/8] iommu/amd: Make amd_iommu_domain_flush_complete() static Vasant Hegde
2024-08-28 11:10 ` [PATCH 7/8] iommu/amd: Rework amd_iommu_update_and_flush_device_table() Vasant Hegde
2024-08-28 11:10 ` [PATCH 8/8] iommu/amd: Make amd_iommu_dev_update_dte() static Vasant Hegde
2024-09-04  9:36 ` [PATCH 0/8] iommu/amd: Misc cleanup and trivial fixes Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox