[PATCH 4.14 307/343] iommu/amd: Wait for completion of IOTLB flush in attach_device

From: Greg Kroah-Hartman
Date: Fri Jan 24 2020 - 05:05:39 EST


From: Filippo Sironi <sironi@xxxxxxxxx>

[ Upstream commit 0b15e02f0cc4fb34a9160de7ba6db3a4013dc1b7 ]

To make sure the domain tlb flush completes before the
function returns, explicitly wait for its completion.

Signed-off-by: Filippo Sironi <sironi@xxxxxxxxx>
Fixes: 42a49f965a8d ("amd-iommu: flush domain tlb when attaching a new device")
[joro: Added commit message and fixes tag]
Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/iommu/amd_iommu.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index d09c24825734e..778f167be2d35 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2160,6 +2160,8 @@ skip_ats_check:
*/
domain_flush_tlb_pde(domain);

+ domain_flush_complete(domain);
+
return ret;
}

--
2.20.1