Skip to content

Commit b6e7fdf

Browse files
committed
Merge tag 'iommu-fixes-v6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu fixes from Joerg Roedel: - Preset accessed bits in Intel VT-d page-directory entries to avoid hardware error - Set supervisor bit only when Intel IOMMU has the SRS capability * tag 'iommu-fixes-v6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/vt-d: Set SRE bit only when hardware has SRS cap iommu/vt-d: Preset Access bit for IOVA in FL non-leaf paging entries
2 parents 8c67d86 + 7fc961c commit b6e7fdf

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -959,11 +959,9 @@ static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain,
959959

960960
domain_flush_cache(domain, tmp_page, VTD_PAGE_SIZE);
961961
pteval = ((uint64_t)virt_to_dma_pfn(tmp_page) << VTD_PAGE_SHIFT) | DMA_PTE_READ | DMA_PTE_WRITE;
962-
if (domain_use_first_level(domain)) {
963-
pteval |= DMA_FL_PTE_XD | DMA_FL_PTE_US;
964-
if (iommu_is_dma_domain(&domain->domain))
965-
pteval |= DMA_FL_PTE_ACCESS;
966-
}
962+
if (domain_use_first_level(domain))
963+
pteval |= DMA_FL_PTE_XD | DMA_FL_PTE_US | DMA_FL_PTE_ACCESS;
964+
967965
if (cmpxchg64(&pte->val, 0ULL, pteval))
968966
/* Someone else set it while we were thinking; use theirs. */
969967
free_pgtable_page(tmp_page);

drivers/iommu/intel/pasid.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu,
642642
* Since it is a second level only translation setup, we should
643643
* set SRE bit as well (addresses are expected to be GPAs).
644644
*/
645-
if (pasid != PASID_RID2PASID)
645+
if (pasid != PASID_RID2PASID && ecap_srs(iommu->ecap))
646646
pasid_set_sre(pte);
647647
pasid_set_present(pte);
648648
spin_unlock(&iommu->lock);
@@ -685,7 +685,8 @@ int intel_pasid_setup_pass_through(struct intel_iommu *iommu,
685685
* We should set SRE bit as well since the addresses are expected
686686
* to be GPAs.
687687
*/
688-
pasid_set_sre(pte);
688+
if (ecap_srs(iommu->ecap))
689+
pasid_set_sre(pte);
689690
pasid_set_present(pte);
690691
spin_unlock(&iommu->lock);
691692

0 commit comments

Comments
 (0)