aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/amd_iommu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index a897c7246dca..69f367b033a2 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -74,6 +74,7 @@ DECLARE_STATS_COUNTER(cnt_free_coherent);
74DECLARE_STATS_COUNTER(cross_page); 74DECLARE_STATS_COUNTER(cross_page);
75DECLARE_STATS_COUNTER(domain_flush_single); 75DECLARE_STATS_COUNTER(domain_flush_single);
76DECLARE_STATS_COUNTER(domain_flush_all); 76DECLARE_STATS_COUNTER(domain_flush_all);
77DECLARE_STATS_COUNTER(alloced_io_mem);
77 78
78static struct dentry *stats_dir; 79static struct dentry *stats_dir;
79static struct dentry *de_isolate; 80static struct dentry *de_isolate;
@@ -110,6 +111,7 @@ static void amd_iommu_stats_init(void)
110 amd_iommu_stats_add(&cross_page); 111 amd_iommu_stats_add(&cross_page);
111 amd_iommu_stats_add(&domain_flush_single); 112 amd_iommu_stats_add(&domain_flush_single);
112 amd_iommu_stats_add(&domain_flush_all); 113 amd_iommu_stats_add(&domain_flush_all);
114 amd_iommu_stats_add(&alloced_io_mem);
113} 115}
114 116
115#endif 117#endif
@@ -1246,6 +1248,8 @@ static dma_addr_t __map_single(struct device *dev,
1246 } 1248 }
1247 address += offset; 1249 address += offset;
1248 1250
1251 ADD_STATS_COUNTER(alloced_io_mem, size);
1252
1249 if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) { 1253 if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) {
1250 iommu_flush_tlb(iommu, dma_dom->domain.id); 1254 iommu_flush_tlb(iommu, dma_dom->domain.id);
1251 dma_dom->need_flush = false; 1255 dma_dom->need_flush = false;
@@ -1282,6 +1286,8 @@ static void __unmap_single(struct amd_iommu *iommu,
1282 start += PAGE_SIZE; 1286 start += PAGE_SIZE;
1283 } 1287 }
1284 1288
1289 SUB_STATS_COUNTER(alloced_io_mem, size);
1290
1285 dma_ops_free_addresses(dma_dom, dma_addr, pages); 1291 dma_ops_free_addresses(dma_dom, dma_addr, pages);
1286 1292
1287 if (amd_iommu_unmap_flush || dma_dom->need_flush) { 1293 if (amd_iommu_unmap_flush || dma_dom->need_flush) {