Skip to contentSkip to conversation

iommu/amd: Optimization and cleanup for unused variables

PATCH In review Adrian Huang 2 participants 4 messages Jan 9, 2020 – Jan 17, 2020 IOMMU

lore
Share & tools
lore
#0 lore raw

cover iommu/amd: Optimization and cleanup for unused variables

This series optimizes the register reading by using readq instead of readl and cleans up the unused variables.

Adrian Huang (2):
iommu/amd: Replace two consecutive readl calls with one readq iommu/amd: Remove unused struct member

 drivers/iommu/amd_iommu_init.c  | 6 +-----
 drivers/iommu/amd_iommu_types.h | 1 -
 2 files changed, 1 insertion(+), 6 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#1 lore raw

PATCH 1/2 iommu/amd: Replace two consecutive readl calls with one readq

From: Adrian Huang <[email protected]>

Optimize the reigster reading by using readq instead of the two consecutive readl calls.

---
 drivers/iommu/amd_iommu_init.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/iommu/amd_iommu_init.c +1 -5
index c5167fe0bd5f..cfdc4b60ccbe 100644
@@ -1718,7 +1718,6 @@ static const struct attribute_group *amd_iommu_groups[] = {
 static int __init iommu_init_pci(struct amd_iommu *iommu)
 {
 	int cap_ptr = iommu->cap_ptr;
-	u32 low, high;
 	int ret;
 
 	iommu->dev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(iommu->devid),
@@ -1736,10 +1735,7 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
 		amd_iommu_iotlb_sup = false;
 
 	/* read extended feature bits */
-	low  = readl(iommu->mmio_base + MMIO_EXT_FEATURES);
-	high = readl(iommu->mmio_base + MMIO_EXT_FEATURES + 4);
-
-	iommu->features = ((u64)high << 32) | low;
+	iommu->features = readq(iommu->mmio_base + MMIO_EXT_FEATURES);
 
 	if (iommu_feature(iommu, FEATURE_GT)) {
 		int glxval;
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#2 lore raw

PATCH 2/2 iommu/amd: Remove unused struct member

In reply to Adrian Huang

From: Adrian Huang <[email protected]>

Commit c805b428f206 ("iommu/amd: Remove amd_iommu_pd_list") removes the global list for the allocated protection domains. The corresponding member 'list' of the protection_domain struct is not used anymore, so it can be removed.

---
 drivers/iommu/amd_iommu_types.h | 1 -
 1 file changed, 1 deletion(-)
drivers/iommu/amd_iommu_types.h +0 -1
index 500f0b78879d..f8d01d6b00da 100644
@@ -463,7 +463,6 @@ struct amd_irte_ops;
  * independent of their use.
  */
 struct protection_domain {
-	struct list_head list;  /* for list of all protection domains */
 	struct list_head dev_list; /* List of all devices in this domain */
 	struct iommu_domain domain; /* generic domain handle used by
 				       iommu core code */
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer
#3 lore raw
In reply to Adrian Huang
Quoted 6 lines · Adrian Huang

This series optimizes the register reading by using readq instead of readl and cleans up the unused variables.

Adrian Huang (2):
iommu/amd: Replace two consecutive readl calls with one readq iommu/amd: Remove unused struct member

Applied, thanks Adrian.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu