diff options
author | David Stevens <stevensd@chromium.org> | 2021-09-29 11:32:55 +0900 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2021-09-29 12:49:44 +0200 |
commit | 06e620345d544e559b2961cb5a676ec9c80c8950 (patch) | |
tree | d0a96d2c97a8329fa981498556b5bfeaa2bcfb2b /scripts | |
parent | 08ae5d4a1ae96b72222e7b02d072bb997ff29dac (diff) | |
download | linux-stable-06e620345d544e559b2961cb5a676ec9c80c8950.tar.gz linux-stable-06e620345d544e559b2961cb5a676ec9c80c8950.tar.bz2 linux-stable-06e620345d544e559b2961cb5a676ec9c80c8950.zip |
iommu/dma: Fix arch_sync_dma for map
When calling arch_sync_dma, we need to pass it the memory that's
actually being used for dma. When using swiotlb bounce buffers, this is
the bounce buffer. Move arch_sync_dma into the __iommu_dma_map_swiotlb
helper, so it can use the bounce buffer address if necessary.
Now that iommu_dma_map_sg delegates to a function which takes care of
architectural syncing in the untrusted device case, the call to
iommu_dma_sync_sg_for_device can be moved so it only occurs for trusted
devices. Doing the sync for untrusted devices before mapping never
really worked, since it needs to be able to target swiotlb buffers.
This also moves the architectural sync to before the call to
__iommu_dma_map, to guarantee that untrusted devices can't see stale
data they shouldn't see.
Fixes: 82612d66d51d ("iommu: Allow the iommu/dma api to use bounce buffers")
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20210929023300.335969-3-stevensd@google.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions