Linux IOMMU Development
 help / color / mirror / Atom feed
From: Wei Wang <wei.w.wang@intel.com>
To: baolu.lu@linux.intel.com, kevin.tian@intel.com,
	yi.l.liu@intel.com, jgg@nvidia.com, dwmw2@infradead.org,
	joro@8bytes.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux.dev
Cc: Wei Wang <wei.w.wang@intel.com>
Subject: [PATCH v1] iommu/vt-d: Remove redundant SLTS cap check for nested and dirty tracking
Date: Thu,  5 Jun 2025 18:10:52 +0800	[thread overview]
Message-ID: <20250605101052.955174-1-wei.w.wang@intel.com> (raw)

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


             reply	other threads:[~2025-06-05  2:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 10:10 Wei Wang [this message]
2025-06-06 17:15 ` [PATCH v1] iommu/vt-d: Remove redundant SLTS cap check for nested and dirty tracking Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250605101052.955174-1-wei.w.wang@intel.com \
    --to=wei.w.wang@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox