All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: Set SRE bit when hardware has SRS cap
@ 2022-11-14  8:55 Tina Zhang
  2022-11-14 12:00 ` Baolu Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Tina Zhang @ 2022-11-14  8:55 UTC (permalink / raw)
  To: iommu; +Cc: baolu.lu, Tina Zhang

SRS cap is the hardware cap telling if the hardware IOMMU can support
requests seeking supervisor privilege or not. SRE bit in scalable-mode
PASID table entry is treated as Reserved(0) for implementation not
supporting SRS cap.

Checking SRS cap before setting SRE bit can avoid the non-recoverable
fault of "Non-zero reserved field set in PASID Table Entry" caused by
setting SRE bit while there is no SRS cap support.

Currently, both intel_pasid_setup_first_level() and
intel_pasid_setup_second_level() implicitly take care about of it. The
only missing SRS cap checking is in intel_pasid_setup_pass_through().

Fixes: 6f7db75e1c46 ("iommu/vt-d: Add second level page table interface")
Signed-off-by: Tina Zhang <tina.zhang@intel.com>
---
 drivers/iommu/intel/pasid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
index c30ddac40ee5..4a59035a5181 100644
--- a/drivers/iommu/intel/pasid.c
+++ b/drivers/iommu/intel/pasid.c
@@ -685,7 +685,8 @@ int intel_pasid_setup_pass_through(struct intel_iommu *iommu,
 	 * We should set SRE bit as well since the addresses are expected
 	 * to be GPAs.
 	 */
-	pasid_set_sre(pte);
+	if (ecap_srs(iommu->ecap))
+		pasid_set_sre(pte);
 	pasid_set_present(pte);
 	spin_unlock(&iommu->lock);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-15  2:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14  8:55 [PATCH] iommu/vt-d: Set SRE bit when hardware has SRS cap Tina Zhang
2022-11-14 12:00 ` Baolu Lu
2022-11-14 23:55   ` tina.zhang
2022-11-15  1:40     ` Baolu Lu
2022-11-15  2:12       ` tina.zhang

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.