Commit 5eb06bfc authored by Zhen Lei's avatar Zhen Lei Committed by Greg Kroah-Hartman

iommu/amd: make sure TLB to be flushed before IOVA freed

[ Upstream commit 3c120143 ]

Although the mapping has already been removed in the page table, it maybe
still exist in TLB. Suppose the freed IOVAs is reused by others before the
flush operation completed, the new user can not correctly access to its
meomory.
Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
Fixes: b1516a14 ('iommu/amd: Implement flush queue')
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0830a976
...@@ -2452,9 +2452,9 @@ static void __unmap_single(struct dma_ops_domain *dma_dom, ...@@ -2452,9 +2452,9 @@ static void __unmap_single(struct dma_ops_domain *dma_dom,
} }
if (amd_iommu_unmap_flush) { if (amd_iommu_unmap_flush) {
dma_ops_free_iova(dma_dom, dma_addr, pages);
domain_flush_tlb(&dma_dom->domain); domain_flush_tlb(&dma_dom->domain);
domain_flush_complete(&dma_dom->domain); domain_flush_complete(&dma_dom->domain);
dma_ops_free_iova(dma_dom, dma_addr, pages);
} else { } else {
queue_add(dma_dom, dma_addr, pages); queue_add(dma_dom, dma_addr, pages);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment