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

+6 -7
+3 -5
drivers/iommu/intel/iommu.c
··· 959 960 domain_flush_cache(domain, tmp_page, VTD_PAGE_SIZE); 961 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 - } 967 if (cmpxchg64(&pte->val, 0ULL, pteval)) 968 /* Someone else set it while we were thinking; use theirs. */ 969 free_pgtable_page(tmp_page);
··· 959 960 domain_flush_cache(domain, tmp_page, VTD_PAGE_SIZE); 961 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 | DMA_FL_PTE_ACCESS; 964 + 965 if (cmpxchg64(&pte->val, 0ULL, pteval)) 966 /* Someone else set it while we were thinking; use theirs. */ 967 free_pgtable_page(tmp_page);
+3 -2
drivers/iommu/intel/pasid.c
··· 642 * Since it is a second level only translation setup, we should 643 * set SRE bit as well (addresses are expected to be GPAs). 644 */ 645 - if (pasid != PASID_RID2PASID) 646 pasid_set_sre(pte); 647 pasid_set_present(pte); 648 spin_unlock(&iommu->lock); ··· 685 * We should set SRE bit as well since the addresses are expected 686 * to be GPAs. 687 */ 688 - pasid_set_sre(pte); 689 pasid_set_present(pte); 690 spin_unlock(&iommu->lock); 691
··· 642 * Since it is a second level only translation setup, we should 643 * set SRE bit as well (addresses are expected to be GPAs). 644 */ 645 + if (pasid != PASID_RID2PASID && ecap_srs(iommu->ecap)) 646 pasid_set_sre(pte); 647 pasid_set_present(pte); 648 spin_unlock(&iommu->lock); ··· 685 * We should set SRE bit as well since the addresses are expected 686 * to be GPAs. 687 */ 688 + if (ecap_srs(iommu->ecap)) 689 + pasid_set_sre(pte); 690 pasid_set_present(pte); 691 spin_unlock(&iommu->lock); 692