iommu/vt-d: Remove redundant SLTS cap check for nested and dirty tracking
Subsystems (2)
PATCH 1/1 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.
--- drivers/iommu/intel/iommu.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iommu/intel/iommu.c +2 -7
@@ -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
Signature · 1 line
2.43.0
Quoted 11 lines · Wei Wang
In
intel_iommu_domain_alloc_paging_flags():
For thenested_parentcase,nested_supported()has been check earlier, and for thedirty_trackingcase,ssads_supported()has been check earlier. Both of these imply SLTS support, making the subsequent SLTS cap check redundant.
Also, false-initialize thefirst_stageboolean to simplify the code.Signed-off-by Wei Wang <[email protected]>--- drivers/iommu/intel/iommu.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
I'm going to post a patch that fixes this (and the other one you sent) differently next week:
https://github.com/jgunthorpe/linux/commits/iommu_pt_vtd/
iommu/vtd: Split intel_iommu_domain_alloc_paging_flags()
Jason