Re: [PATCH 1/1] iommu/vt-d: Fix dmar pte read access not set error

From: Jerry Snitselaar
Date: Fri Dec 13 2019 - 00:42:46 EST


On Thu Dec 12 19, Lu Baolu wrote:
Hi,

On 12/12/19 9:49 AM, Jerry Snitselaar wrote:
On Wed Dec 11 19, Lu Baolu wrote:
If the default DMA domain of a group doesn't fit a device, it
will still sit in the group but use a private identity domain.
When map/unmap/iova_to_phys come through iommu API, the driver
should still serve them, otherwise, other devices in the same
group will be impacted. Since identity domain has been mapped
with the whole available memory space and RMRRs, we don't need
to worry about the impact on it.

Link: https://www.spinics.net/lists/iommu/msg40416.html
Cc: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
Reported-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
Fixes: 942067f1b6b97 ("iommu/vt-d: Identify default domains replaced with private")
Cc: stable@xxxxxxxxxxxxxxx # v5.3+
Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>

Reviewed-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>

Can you please try this fix and check whether it can fix your problem?
If it helps, do you mind adding a Tested-by?

Best regards,
baolu


Tested-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>


---
drivers/iommu/intel-iommu.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 0c8d81f56a30..b73bebea9148 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -5478,9 +5478,6 @@ static int intel_iommu_map(struct iommu_domain *domain,
ÂÂÂÂint prot = 0;
ÂÂÂÂint ret;

-ÂÂÂ if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN)
-ÂÂÂÂÂÂÂ return -EINVAL;
-
ÂÂÂÂif (iommu_prot & IOMMU_READ)
ÂÂÂÂÂÂÂ prot |= DMA_PTE_READ;
ÂÂÂÂif (iommu_prot & IOMMU_WRITE)
@@ -5523,8 +5520,6 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain,
ÂÂÂÂ/* Cope with horrid API which requires us to unmap more than the
ÂÂÂÂÂÂ size argument if it happens to be a large-page mapping. */
ÂÂÂÂBUG_ON(!pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, &level));
-ÂÂÂ if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN)
-ÂÂÂÂÂÂÂ return 0;

ÂÂÂÂif (size < VTD_PAGE_SIZE << level_to_offset_bits(level))
ÂÂÂÂÂÂÂ size = VTD_PAGE_SIZE << level_to_offset_bits(level);
@@ -5556,9 +5551,6 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain,
ÂÂÂÂint level = 0;
ÂÂÂÂu64 phys = 0;

-ÂÂÂ if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN)
-ÂÂÂÂÂÂÂ return 0;
-
ÂÂÂÂpte = pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, &level);
ÂÂÂÂif (pte)
ÂÂÂÂÂÂÂ phys = dma_pte_addr(pte);
--
2.17.1


_______________________________________________
iommu mailing list
iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/iommu