Skip to contentSkip to conversation

iommu/amd: Misc cleanup

PATCH Applied Vasant Hegde 4 participants 11 messages Jan 18, 2024 – Feb 9, 2024

Subsystems (2)
lore
Share & tools
lore

Vasant Hegde

author maintainer
#0 lore raw

cover iommu/amd: Misc cleanup

This patch series removes unused macros, redundant check and unncessary EXPORT_SYMBOLS. No major functional changes intended.

Thanks,
Vasant

Vasant Hegde (6):
iommu/amd: Remove unused PPR_* macros
iommu/amd: Remove unused IOVA_* macro
iommu/amd: Remove unused APERTURE_* macros
iommu/amd: Remove duplicate function declarations from amd_iommu.h iommu/amd: Remove redundant error check in amd_iommu_probe_device() iommu/amd: Remove EXPORT_SYMBOL for perf counter related functions

 drivers/iommu/amd/amd_iommu.h       | 13 -------------
 drivers/iommu/amd/amd_iommu_types.h |  7 -------
 drivers/iommu/amd/init.c            |  3 ---
 drivers/iommu/amd/iommu.c           |  7 +------
 4 files changed, 1 insertion(+), 29 deletions(-)
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/6 iommu/amd: Remove unused PPR_* macros

Commit 5a0b11a180a ("iommu/amd: Remove iommu_v2 module") missed to remove PPR_* macros. Remove these macros as its not used anymore.

No functional change intended.

---
 drivers/iommu/amd/amd_iommu.h | 4 ----
 1 file changed, 4 deletions(-)
drivers/iommu/amd/amd_iommu.h +0 -4
index 3008503513df..db983b8e572b 100644
@@ -122,10 +122,6 @@ static inline int amd_iommu_create_irq_domain(struct amd_iommu *iommu)
 }
 #endif
 
-#define PPR_SUCCESS			0x0
-#define PPR_INVALID			0x1
-#define PPR_FAILURE			0xf
-
 static inline bool is_rd890_iommu(struct pci_dev *pdev)
 {
 	return (pdev->vendor == PCI_VENDOR_ID_ATI) &&
Signature · 1 line
2.31.1
author maintainer
#2 lore raw

PATCH 2/6 iommu/amd: Remove unused IOVA_* macro

In reply to Vasant Hegde

These macros are not used after commit ac6d704679d343 ("iommu/dma: Pass address limit rather than size to iommu_setup_dma_ops()").

No functional change intended.

---
@Lu Baolu,
We have similar unused macro (IOVA_START_PFN) in intel driver as well. If you want I can remove that macro as part of this series.

-Vasant

 drivers/iommu/amd/iommu.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/iommu/amd/iommu.c +0 -4
index 4280d97fa6ba..6bb4f2dc5194 100644
@@ -45,10 +45,6 @@
 
 #define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28))
 
-/* IO virtual address start page frame number */
-#define IOVA_START_PFN		(1)
-#define IOVA_PFN(addr)		((addr) >> PAGE_SHIFT)
-
 /* Reserved IOVA ranges */
 #define MSI_RANGE_START		(0xfee00000)
 #define MSI_RANGE_END		(0xfeefffff)
Signature · 1 line
2.31.1
author maintainer
#3 lore raw

PATCH 3/6 iommu/amd: Remove unused APERTURE_* macros

In reply to Vasant Hegde

These macros are not used after commit 518d9b450387 ("iommu/amd: Remove special mapping code for dma_ops path").

No functional change intended.

---
 drivers/iommu/amd/amd_iommu_types.h | 7 -------
 1 file changed, 7 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +0 -7
index 722120f95647..9bef7aa54992 100644
@@ -519,13 +519,6 @@ extern struct kmem_cache *amd_iommu_irq_cache;
 #define for_each_pdom_dev_data_safe(pdom_dev_data, next, pdom) \
 	list_for_each_entry_safe((pdom_dev_data), (next), &pdom->dev_data_list, list)
 
-#define APERTURE_RANGE_SHIFT	27	/* 128 MB */
-#define APERTURE_RANGE_SIZE	(1ULL << APERTURE_RANGE_SHIFT)
-#define APERTURE_RANGE_PAGES	(APERTURE_RANGE_SIZE >> PAGE_SHIFT)
-#define APERTURE_MAX_RANGES	32	/* allows 4GB of DMA address space */
-#define APERTURE_RANGE_INDEX(a)	((a) >> APERTURE_RANGE_SHIFT)
-#define APERTURE_PAGE_INDEX(a)	(((a) >> 21) & 0x3fULL)
-
 
 struct amd_iommu;
 struct iommu_domain;
Signature · 1 line
2.31.1
author maintainer
#4 lore raw

PATCH 4/6 iommu/amd: Remove duplicate function declarations from amd_iommu.h

In reply to Vasant Hegde

Perf counter related functions are defined in amd-iommu.h as well. Hence remove duplicate declarations.

No functional change intended.

---
 drivers/iommu/amd/amd_iommu.h | 9 ---------
 1 file changed, 9 deletions(-)
drivers/iommu/amd/amd_iommu.h +0 -9
index db983b8e572b..c2ab07d364dd 100644
@@ -70,15 +70,6 @@ int amd_iommu_page_response(struct device *dev,
 int amd_iommu_iopf_enable_device(struct device *dev);
 int amd_iommu_iopf_disable_device(struct device *dev);
 
-struct amd_iommu *get_amd_iommu(unsigned int idx);
-u8 amd_iommu_pc_get_max_banks(unsigned int idx);
-bool amd_iommu_pc_supported(void);
-u8 amd_iommu_pc_get_max_counters(unsigned int idx);
-int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
-			 u8 fxn, u64 *value);
-int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
-			 u8 fxn, u64 *value);
-
 /* Device capabilities */
 int amd_iommu_pdev_enable_cap_pri(struct pci_dev *pdev);
 void amd_iommu_pdev_disable_cap_pri(struct pci_dev *pdev);
Signature · 1 line
2.31.1
author maintainer
#5 lore raw

PATCH 5/6 iommu/amd: Remove redundant error check in amd_iommu_probe_device()

In reply to Vasant Hegde

iommu_init_device() is not returning -ENOTSUPP since commit 61289cbaf6c8 ("iommu/amd: Remove old alias handling code").

No functional change intended.

---
 drivers/iommu/amd/iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/amd/iommu.c +1 -2
index 6bb4f2dc5194..431febbb0fab 100644
@@ -2175,8 +2175,7 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
 
 	ret = iommu_init_device(iommu, dev);
 	if (ret) {
-		if (ret != -ENOTSUPP)
-			dev_err(dev, "Failed to initialize - trying to proceed anyway\n");
+		dev_err(dev, "Failed to initialize - trying to proceed anyway\n");
 		iommu_dev = ERR_PTR(ret);
 		iommu_ignore_device(iommu, dev);
 	} else {
Signature · 1 line
2.31.1
author maintainer
#6 lore raw

PATCH 6/6 iommu/amd: Remove EXPORT_SYMBOL for perf counter related functions

In reply to Vasant Hegde

.. as IOMMU perf counters are always built as part of kernel.

No functional change intended.

---
 drivers/iommu/amd/init.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/iommu/amd/init.c +0 -3
index 426db9ea3718..2b64cb08f795 100644
@@ -3653,13 +3653,11 @@ u8 amd_iommu_pc_get_max_banks(unsigned int idx)
 
 	return 0;
 }
-EXPORT_SYMBOL(amd_iommu_pc_get_max_banks);
 
 bool amd_iommu_pc_supported(void)
 {
 	return amd_iommu_pc_present;
 }
-EXPORT_SYMBOL(amd_iommu_pc_supported);
 
 u8 amd_iommu_pc_get_max_counters(unsigned int idx)
 {
@@ -3670,7 +3668,6 @@ u8 amd_iommu_pc_get_max_counters(unsigned int idx)
 
 	return 0;
 }
-EXPORT_SYMBOL(amd_iommu_pc_get_max_counters);
 
 static int iommu_pc_get_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
 				u8 fxn, u64 *value, bool is_write)
Signature · 1 line
2.31.1
Reviewed-by on the v1 series
#7 lore raw
In reply to Vasant Hegde

Hi Vasant,

I had issues applying the series to the topic branch, and realized it is based on top of your SVA Support patchset. If these patches are merged before the SVA changes, the minor conflicts are simple enough to resolve I suppose..

Quoted 2 lines · Vasant Hegde

This patch series removes unused macros, redundant check and unncessary EXPORT_SYMBOLS. No major functional changes intended.

For the series:

Quoted 18 lines

Thanks,
Vasant

Vasant Hegde (6):
iommu/amd: Remove unused PPR_* macros
iommu/amd: Remove unused IOVA_* macro
iommu/amd: Remove unused APERTURE_* macros
iommu/amd: Remove duplicate function declarations from amd_iommu.h iommu/amd: Remove redundant error check in amd_iommu_probe_device() iommu/amd: Remove EXPORT_SYMBOL for perf counter related functions

  drivers/iommu/amd/amd_iommu.h       | 13 -------------
  drivers/iommu/amd/amd_iommu_types.h |  7 -------
  drivers/iommu/amd/init.c            |  3 ---
  drivers/iommu/amd/iommu.c           |  7 +------
  4 files changed, 1 insertion(+), 29 deletions(-)
author maintainer
#8 lore raw

Hi Alejandro,

Quoted 5 lines · Alejandro Jimenez

Hi Vasant,

I had issues applying the series to the topic branch, and realized it is based on top of your SVA Support patchset. If these patches are merged before the SVA changes, the minor conflicts are simple enough to resolve I suppose..

Sorry for the trouble. I forgot to update the cover letter. You are right. This series is based on top of SVA Part 4 V5 [1].

[5]
https://lore.kernel.org/linux-iommu/[email protected]/T/#t

Quoted 8 lines · Vasant Hegde
Quoted 2 lines

This patch series removes unused macros, redundant check and unncessary EXPORT_SYMBOLS. No major functional changes intended.

For the series:

Thanks for the review.

-Vasant

Reviewed-by on the v1 series
#9 lore raw
In reply to Vasant Hegde
Quoted 6 lines · Vasant Hegde

This patch series removes unused macros, redundant check and unncessary EXPORT_SYMBOLS. No major functional changes intended.

Thanks,
Vasant

Quoted 7 lines

Vasant Hegde (6):
iommu/amd: Remove unused PPR_* macros
iommu/amd: Remove unused IOVA_* macro
iommu/amd: Remove unused APERTURE_* macros
iommu/amd: Remove duplicate function declarations from amd_iommu.h iommu/amd: Remove redundant error check in amd_iommu_probe_device() iommu/amd: Remove EXPORT_SYMBOL for perf counter related functions

Jason

maintainer Applied
#10 lore raw
In reply to Vasant Hegde
Quoted 8 lines · Vasant Hegde

Vasant Hegde (6):
iommu/amd: Remove unused PPR_* macros
iommu/amd: Remove unused IOVA_* macro
iommu/amd: Remove unused APERTURE_* macros
iommu/amd: Remove duplicate function declarations from amd_iommu.h iommu/amd: Remove redundant error check in amd_iommu_probe_device() iommu/amd: Remove EXPORT_SYMBOL for perf counter related functions

Quoted 5 lines
 drivers/iommu/amd/amd_iommu.h       | 13 -------------
 drivers/iommu/amd/amd_iommu_types.h |  7 -------
 drivers/iommu/amd/init.c            |  3 ---
 drivers/iommu/amd/iommu.c           |  7 +------
 4 files changed, 1 insertion(+), 29 deletions(-)

Applied, thanks.