Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 5d5e0ccd authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

iommu/dma: Fix cache maintenance in iommu_dma_map_sg()



iommu_dma_map_sg() attempts to perform cache maintenance with
iommu_dma_sync_sg_for_device() prior to mapping the scatter gather
list to an IOVA. iommu_dma_sync_sg_for_device() uses the DMA address
in the scatter gather list structure to determine if the buffer is
mapped as cached or uncached by invoking iommu_is_iova_coherent().

Since the buffer has not been mapped yet, the DMA address in the scatter
gather list structure will be 0. If IOVA 0 is not mapped in the client's
IOMMU page tables, then iommu_is_iova_coherent() will return false,
and cache maintenance will be performed on the buffer, even for clients
that are io-coherent, which is not correct, as no cache maintenance is
required for io-coherent clients.

Ensure cache maintenance happens only after the buffer has been mapped,
so that iommu_dma_sync_sg_for_device() can correctly determine if
cache maintenance is required.

Change-Id: Ie1cec69077eaeada00b5a2709b6d1680afdaaeba
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent f16a067b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment