public inbox for iommu@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
	Kyung Min Park <kyung.min.park@intel.com>,
	iommu@lists.linux-foundation.org, Longpeng <longpeng2@huawei.com>
Subject: [PATCH 4/9] iommu/vt-d: Check FL and SL capability sanity in scalable mode
Date: Thu, 14 Oct 2021 13:38:34 +0800	[thread overview]
Message-ID: <20211014053839.727419-5-baolu.lu@linux.intel.com> (raw)
In-Reply-To: <20211014053839.727419-1-baolu.lu@linux.intel.com>

An iommu domain could be allocated and mapped before it's attached to any
device. This requires that in scalable mode, when the domain is allocated,
the format (FL or SL) of the page table must be determined. In order to
achieve this, the platform should support consistent SL or FL capabilities
on all IOMMU's. This adds a check for this and aborts IOMMU probing if it
doesn't meet this requirement.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20210926114535.923263-1-baolu.lu@linux.intel.com
---
 drivers/iommu/intel/cap_audit.h |  1 +
 drivers/iommu/intel/cap_audit.c | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/iommu/intel/cap_audit.h b/drivers/iommu/intel/cap_audit.h
index 74cfccae0e81..d07b75938961 100644
--- a/drivers/iommu/intel/cap_audit.h
+++ b/drivers/iommu/intel/cap_audit.h
@@ -111,6 +111,7 @@ bool intel_cap_smts_sanity(void);
 bool intel_cap_pasid_sanity(void);
 bool intel_cap_nest_sanity(void);
 bool intel_cap_flts_sanity(void);
+bool intel_cap_slts_sanity(void);
 
 static inline bool scalable_mode_support(void)
 {
diff --git a/drivers/iommu/intel/cap_audit.c b/drivers/iommu/intel/cap_audit.c
index b12e421a2f1a..b39d223926a4 100644
--- a/drivers/iommu/intel/cap_audit.c
+++ b/drivers/iommu/intel/cap_audit.c
@@ -163,6 +163,14 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)
 			check_irq_capabilities(iommu, i);
 	}
 
+	/*
+	 * If the system is sane to support scalable mode, either SL or FL
+	 * should be sane.
+	 */
+	if (intel_cap_smts_sanity() &&
+	    !intel_cap_flts_sanity() && !intel_cap_slts_sanity())
+		return -EOPNOTSUPP;
+
 out:
 	rcu_read_unlock();
 	return 0;
@@ -203,3 +211,8 @@ bool intel_cap_flts_sanity(void)
 {
 	return ecap_flts(intel_iommu_ecap_sanity);
 }
+
+bool intel_cap_slts_sanity(void)
+{
+	return ecap_slts(intel_iommu_ecap_sanity);
+}
-- 
2.25.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2021-10-14  5:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14  5:38 [PATCH 0/9] [PULL REQUEST] Intel IOMMU Updates for Linux v5.16 Lu Baolu
2021-10-14  5:38 ` [PATCH 1/9] iommu/vt-d: Do not falsely log intel_iommu is unsupported kernel option Lu Baolu
2021-10-14  5:38 ` [PATCH 2/9] iommu/vt-d: Dump DMAR translation structure when DMA fault occurs Lu Baolu
2021-10-14  5:38 ` [PATCH 3/9] iommu/vt-d: Remove duplicate identity domain flag Lu Baolu
2021-10-14  5:38 ` Lu Baolu [this message]
2021-10-14  5:38 ` [PATCH 5/9] iommu/vt-d: Use second level for GPA->HPA translation Lu Baolu
2021-10-14  5:38 ` [PATCH 6/9] iommu/vt-d: Delete dev_has_feat callback Lu Baolu
2021-10-14  5:38 ` [PATCH 7/9] iommu/vt-d: Clean up unused PASID updating functions Lu Baolu
2021-10-14  5:38 ` [PATCH 8/9] iommu/vt-d: Convert the return type of first_pte_in_page to bool Lu Baolu
2021-10-14  5:38 ` [PATCH 9/9] iommu/vt-d: Avoid duplicate removing in __domain_mapping() Lu Baolu
2021-10-18 18:33 ` [PATCH 0/9] [PULL REQUEST] Intel IOMMU Updates for Linux v5.16 Joerg Roedel

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=20211014053839.727419-5-baolu.lu@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kyung.min.park@intel.com \
    --cc=longpeng2@huawei.com \
    --cc=tvrtko.ursulin@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