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]
Message-ID: <18d99aa79a024a80b51a821ff3dacad8f7276969.1744692494.git.nicolinc@nvidia.com>
Date: Mon, 14 Apr 2025 21:57:40 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: <will@...nel.org>, <robin.murphy@....com>, <jgg@...dia.com>
CC: <joro@...tes.org>, <kevin.tian@...el.com>, <praan@...gle.com>,
	<nathan@...nel.org>, <yi.l.liu@...el.com>, <peterz@...radead.org>,
	<mshavit@...gle.com>, <jsnitsel@...hat.com>, <smostafa@...gle.com>,
	<jeff.johnson@....qualcomm.com>, <zhangzekun11@...wei.com>,
	<linux-arm-kernel@...ts.infradead.org>, <iommu@...ts.linux.dev>,
	<linux-kernel@...r.kernel.org>, <shameerali.kolothum.thodi@...wei.com>
Subject: [PATCH v2 05/11] iommu/arm-smmu-v3: Rename arm_smmu_attach_prepare_vmaster

There is a need of stuffing more vsmmu-related routine into the prepare().

Given that the arm_smmu_attach_prepare_vmaster() is always called when the
domain is a nested domain that always has a valid vsmmu pointer. Rename it
to arm_vsmmu_attach_prepare().

Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h         | 9 ++++-----
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 8 ++++----
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c         | 5 +++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
index 2f8928971716..7b47f4408a7a 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
@@ -1089,8 +1089,8 @@ struct iommufd_viommu *arm_vsmmu_alloc(struct device *dev,
 				       struct iommu_domain *parent,
 				       struct iommufd_ctx *ictx,
 				       unsigned int viommu_type);
-int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
-				    struct arm_smmu_nested_domain *nested_domain);
+int arm_vsmmu_attach_prepare(struct arm_smmu_attach_state *state,
+			     struct arm_vsmmu *vsmmu);
 void arm_smmu_attach_commit_vmaster(struct arm_smmu_attach_state *state);
 void arm_smmu_master_clear_vmaster(struct arm_smmu_master *master);
 int arm_vmaster_report_event(struct arm_smmu_vmaster *vmaster, u64 *evt);
@@ -1098,9 +1098,8 @@ int arm_vmaster_report_event(struct arm_smmu_vmaster *vmaster, u64 *evt);
 #define arm_smmu_hw_info NULL
 #define arm_vsmmu_alloc NULL
 
-static inline int
-arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
-				struct arm_smmu_nested_domain *nested_domain)
+static inline int arm_vsmmu_attach_prepare(struct arm_smmu_attach_state *state,
+					   struct arm_vsmmu *vsmmu)
 {
 	return 0;
 }
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
index d86dba6691e8..6cd01536c966 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
@@ -89,8 +89,8 @@ static void arm_smmu_make_nested_domain_ste(
 	}
 }
 
-int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
-				    struct arm_smmu_nested_domain *nested_domain)
+int arm_vsmmu_attach_prepare(struct arm_smmu_attach_state *state,
+			     struct arm_vsmmu *vsmmu)
 {
 	struct arm_smmu_vmaster *vmaster;
 	unsigned long vsid;
@@ -98,7 +98,7 @@ int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
 
 	iommu_group_mutex_assert(state->master->dev);
 
-	ret = iommufd_viommu_get_vdev_id(&nested_domain->vsmmu->core,
+	ret = iommufd_viommu_get_vdev_id(&vsmmu->core,
 					 state->master->dev, &vsid);
 	if (ret)
 		return ret;
@@ -106,7 +106,7 @@ int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
 	vmaster = kzalloc(sizeof(*vmaster), GFP_KERNEL);
 	if (!vmaster)
 		return -ENOMEM;
-	vmaster->vsmmu = nested_domain->vsmmu;
+	vmaster->vsmmu = vsmmu;
 	vmaster->vsid = vsid;
 	state->vmaster = vmaster;
 
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index bafe7c7c2769..07d435562da2 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2839,8 +2839,9 @@ int arm_smmu_attach_prepare(struct arm_smmu_attach_state *state,
 
 	if (smmu_domain) {
 		if (new_domain->type == IOMMU_DOMAIN_NESTED) {
-			ret = arm_smmu_attach_prepare_vmaster(
-				state, to_smmu_nested_domain(new_domain));
+			ret = arm_vsmmu_attach_prepare(
+				state,
+				to_smmu_nested_domain(new_domain)->vsmmu);
 			if (ret)
 				return ret;
 		}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ