aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2019-05-07 03:39:32 -0400
committerJoerg Roedel <jroedel@suse.de>2019-05-07 03:40:03 -0400
commit97a18f548548a6ee1b9be14c6fc72090b8839875 (patch)
treeaf887ab04c4e37e74405d6188f9c440739931638
parent89736a0ee81d14439d085c8d4653bc1d86fe64d8 (diff)
Revert "iommu/amd: Flush not present cache in iommu_map_page"
This reverts commit 1a1079011da32db87e19fcb39e70d082f89da921. This commit caused a NULL-ptr deference bug and must be reverted for now. Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r--drivers/iommu/amd_iommu.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 23c1a7eebb06..fde16c5b0a70 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1307,16 +1307,6 @@ static void domain_flush_complete(struct protection_domain *domain)
1307 } 1307 }
1308} 1308}
1309 1309
1310/* Flush the not present cache if it exists */
1311static void domain_flush_np_cache(struct protection_domain *domain,
1312 dma_addr_t iova, size_t size)
1313{
1314 if (unlikely(amd_iommu_np_cache)) {
1315 domain_flush_pages(domain, iova, size);
1316 domain_flush_complete(domain);
1317 }
1318}
1319
1320 1310
1321/* 1311/*
1322 * This function flushes the DTEs for all devices in domain 1312 * This function flushes the DTEs for all devices in domain
@@ -2399,7 +2389,10 @@ static dma_addr_t __map_single(struct device *dev,
2399 } 2389 }
2400 address += offset; 2390 address += offset;
2401 2391
2402 domain_flush_np_cache(&dma_dom->domain, address, size); 2392 if (unlikely(amd_iommu_np_cache)) {
2393 domain_flush_pages(&dma_dom->domain, address, size);
2394 domain_flush_complete(&dma_dom->domain);
2395 }
2403 2396
2404out: 2397out:
2405 return address; 2398 return address;
@@ -2578,8 +2571,6 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
2578 s->dma_length = s->length; 2571 s->dma_length = s->length;
2579 } 2572 }
2580 2573
2581 domain_flush_np_cache(domain, s->dma_address, s->dma_length);
2582
2583 return nelems; 2574 return nelems;
2584 2575
2585out_unmap: 2576out_unmap:
@@ -3060,8 +3051,6 @@ static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova,
3060 ret = iommu_map_page(domain, iova, paddr, page_size, prot, GFP_KERNEL); 3051 ret = iommu_map_page(domain, iova, paddr, page_size, prot, GFP_KERNEL);
3061 mutex_unlock(&domain->api_lock); 3052 mutex_unlock(&domain->api_lock);
3062 3053
3063 domain_flush_np_cache(domain, iova, page_size);
3064
3065 return ret; 3054 return ret;
3066} 3055}
3067 3056