iommu/vt-d: Set SRE bit when hardware has SRS cap
Subsystems (2)
PATCH v2 1/1 iommu/vt-d: Set SRE bit when hardware has SRS cap
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.
V2: Add SRS cap checking in intel_pasid_setup_second_level()
--- drivers/iommu/intel/pasid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iommu/intel/pasid.c +3 -2
@@ -642,7 +642,7 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu,* Since it is a second level only translation setup, we should * set SRE bit as well (addresses are expected to be GPAs). */ -if (pasid !=PASID_RID2PASID ) +if ((pasid !=PASID_RID2PASID ) &&ecap_srs (iommu->ecap))pasid_set_sre (pte);pasid_set_present (pte);spin_unlock (&iommu->lock);
@@ -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);
Signature · 1 line
2.25.1
Baolu Lu
maintainerQuoted 5 lines · 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.
Quoted 8 lines
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.
V2: Add SRS cap checking in
intel_pasid_setup_second_level()Fixes 6f7db75e1c46 ("iommu/vt-d: Add second level page table interface")Signed-off-by Tina Zhang<[email protected]>
Patch queued for v6.1. Thank you!
https://lore.kernel.org/linux-iommu/[email protected]/
Best regards,
baolu