lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 28 Jun 2024 14:27:43 +0200
From: Joel Granados via B4 Relay <devnull+j.granados.samsung.com@...nel.org>
To: David Woodhouse <dwmw2@...radead.org>, 
 Lu Baolu <baolu.lu@...ux.intel.com>, Joerg Roedel <joro@...tes.org>, 
 Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>
Cc: iommu@...ts.linux.dev, linux-kernel@...r.kernel.org, 
 Joel Granados <j.granados@...sung.com>
Subject: [PATCH RFC 5/5] iommu/vt-d: Remove dev_iommu_priv_get call from
 domain_get_id_for_dev

From: Joel Granados <j.granados@...sung.com>

We don't need to run dev_iommu_priv_get as we already have the struct
intel_iommu. Pass the intel_iommu instead of the device and rename the
function to domain_id_for_iommu to express what it is really doing.

Signed-off-by: Joel Granados <j.granados@...sung.com>
---
 drivers/iommu/intel/cache.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/intel/cache.c b/drivers/iommu/intel/cache.c
index c630f4485a06..e55d700fcd29 100644
--- a/drivers/iommu/intel/cache.c
+++ b/drivers/iommu/intel/cache.c
@@ -147,11 +147,9 @@ static void __cache_tag_unassign_parent_domain(struct dmar_domain *domain,
 		cache_tag_unassign_type(domain, tag_id, CACHE_TAG_NESTING_DEVTLB);
 }
 
-static u16 domain_get_id_for_dev(struct dmar_domain *domain, struct device *dev)
+static u16 domain_id_for_iommu(struct dmar_domain *domain,
+			       struct intel_iommu *iommu)
 {
-	struct device_domain_info *info = dev_iommu_priv_get(dev);
-	struct intel_iommu *iommu = info->iommu;
-
 	/*
 	 * The driver assigns different domain IDs for all domains except
 	 * the SVA type.
@@ -178,7 +176,7 @@ int cache_tag_assign_domain(struct dmar_domain *domain,
 		.pasid = pasid,
 		.iommu = info->iommu,
 		.dev = dev,
-		.domain_id = domain_get_id_for_dev(domain, dev),
+		.domain_id = domain_id_for_iommu(domain, info->iommu),
 	};
 	int ret;
 
@@ -209,7 +207,7 @@ void cache_tag_unassign_domain(struct dmar_domain *domain,
 		.pasid = pasid,
 		.iommu = info->iommu,
 		.dev = dev,
-		.domain_id = domain_get_id_for_dev(domain, dev)
+		.domain_id = domain_id_for_iommu(domain, info->iommu)
 	};
 
 	__cache_tag_unassign_domain(domain, &tag_id, info->ats_enabled);

-- 
2.43.0



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ