[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250605101052.955174-1-wei.w.wang@intel.com>
Date: Thu, 5 Jun 2025 18:10:52 +0800
From: Wei Wang <wei.w.wang@...el.com>
To: baolu.lu@...ux.intel.com,
kevin.tian@...el.com,
yi.l.liu@...el.com,
jgg@...dia.com,
dwmw2@...radead.org,
joro@...tes.org,
linux-kernel@...r.kernel.org,
iommu@...ts.linux.dev
Cc: Wei Wang <wei.w.wang@...el.com>
Subject: [PATCH v1] iommu/vt-d: Remove redundant SLTS cap check for nested and dirty tracking
In intel_iommu_domain_alloc_paging_flags():
For the nested_parent case, nested_supported() has been check earlier,
and for the dirty_tracking case, ssads_supported() has been check earlier.
Both of these imply SLTS support, making the subsequent SLTS cap check
redundant.
Also, false-initialize the first_stage boolean to simplify the code.
Signed-off-by: Wei Wang <wei.w.wang@...el.com>
---
drivers/iommu/intel/iommu.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 7aa3932251b2..a79f91b47a8a 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -3340,7 +3340,7 @@ intel_iommu_domain_alloc_paging_flags(struct device *dev, u32 flags,
struct intel_iommu *iommu = info->iommu;
struct dmar_domain *dmar_domain;
struct iommu_domain *domain;
- bool first_stage;
+ bool first_stage = false;
if (flags &
(~(IOMMU_HWPT_ALLOC_NEST_PARENT | IOMMU_HWPT_ALLOC_DIRTY_TRACKING |
@@ -3356,13 +3356,8 @@ intel_iommu_domain_alloc_paging_flags(struct device *dev, u32 flags,
* IOMMU_HWPT_ALLOC_NEST_PARENT or IOMMU_HWPT_ALLOC_DIRTY_TRACKING
* is specified.
*/
- if (nested_parent || dirty_tracking) {
- if (!sm_supported(iommu) || !ecap_slts(iommu->ecap))
- return ERR_PTR(-EOPNOTSUPP);
- first_stage = false;
- } else {
+ if (!nested_parent && !dirty_tracking)
first_stage = first_level_by_default(iommu);
- }
dmar_domain = paging_domain_alloc(dev, first_stage);
if (IS_ERR(dmar_domain))
base-commit: 16b70698aa3ae7888826d0c84567c72241cf6713
--
2.43.0
Powered by blists - more mailing lists