* [PATCH v1] iommu/vt-d: Remove redundant SLTS cap check for nested and dirty tracking
@ 2025-06-05 10:10 Wei Wang
2025-06-06 17:15 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Wei Wang @ 2025-06-05 10:10 UTC (permalink / raw)
To: baolu.lu, kevin.tian, yi.l.liu, jgg, dwmw2, joro, linux-kernel,
iommu
Cc: Wei Wang
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@intel.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] iommu/vt-d: Remove redundant SLTS cap check for nested and dirty tracking
2025-06-05 10:10 [PATCH v1] iommu/vt-d: Remove redundant SLTS cap check for nested and dirty tracking Wei Wang
@ 2025-06-06 17:15 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2025-06-06 17:15 UTC (permalink / raw)
To: Wei Wang; +Cc: baolu.lu, kevin.tian, yi.l.liu, dwmw2, joro, linux-kernel, iommu
On Thu, Jun 05, 2025 at 06:10:52PM +0800, Wei Wang wrote:
> 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@intel.com>
> ---
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-06 17:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05 10:10 [PATCH v1] iommu/vt-d: Remove redundant SLTS cap check for nested and dirty tracking Wei Wang
2025-06-06 17:15 ` Jason Gunthorpe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.