aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-12-12 07:50:21 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-01-03 08:11:58 -0500
commit7f26508bbb76ce86aad1130ef6b7f1a4bb7de0c2 (patch)
tree92efde72a5101c1aed8858272f150c1c281bc3b8 /arch
parenta9dddbe0497ab0df7ee729e8d4cb0ee2dec3e4ba (diff)
AMD IOMMU: add init code for statistic collection
Impact: create a new debugfs directory Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/amd_iommu_types.h2
-rw-r--r--arch/x86/kernel/amd_iommu.c37
2 files changed, 39 insertions, 0 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h
index 1379c5fe86d0..95c8cd9d22b5 100644
--- a/arch/x86/include/asm/amd_iommu_types.h
+++ b/arch/x86/include/asm/amd_iommu_types.h
@@ -420,6 +420,8 @@ struct __iommu_counter {
420#define ADD_STATS_COUNTER(name, x) 420#define ADD_STATS_COUNTER(name, x)
421#define SUB_STATS_COUNTER(name, x) 421#define SUB_STATS_COUNTER(name, x)
422 422
423static inline void amd_iommu_stats_init(void) { }
424
423#endif /* CONFIG_AMD_IOMMU_STATS */ 425#endif /* CONFIG_AMD_IOMMU_STATS */
424 426
425#endif /* _ASM_X86_AMD_IOMMU_TYPES_H */ 427#endif /* _ASM_X86_AMD_IOMMU_TYPES_H */
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 3011ea7a3f82..f98f70626bc6 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -20,6 +20,7 @@
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/gfp.h> 21#include <linux/gfp.h>
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <linux/debugfs.h>
23#include <linux/scatterlist.h> 24#include <linux/scatterlist.h>
24#include <linux/iommu-helper.h> 25#include <linux/iommu-helper.h>
25#ifdef CONFIG_IOMMU_API 26#ifdef CONFIG_IOMMU_API
@@ -57,6 +58,40 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom,
57static struct dma_ops_domain *find_protection_domain(u16 devid); 58static struct dma_ops_domain *find_protection_domain(u16 devid);
58 59
59 60
61#ifdef CONFIG_AMD_IOMMU_STATS
62
63/*
64 * Initialization code for statistics collection
65 */
66
67static struct dentry *stats_dir;
68static struct dentry *de_isolate;
69static struct dentry *de_fflush;
70
71static void amd_iommu_stats_add(struct __iommu_counter *cnt)
72{
73 if (stats_dir == NULL)
74 return;
75
76 cnt->dent = debugfs_create_u64(cnt->name, 0444, stats_dir,
77 &cnt->value);
78}
79
80static void amd_iommu_stats_init(void)
81{
82 stats_dir = debugfs_create_dir("amd-iommu", NULL);
83 if (stats_dir == NULL)
84 return;
85
86 de_isolate = debugfs_create_bool("isolation", 0444, stats_dir,
87 (u32 *)&amd_iommu_isolate);
88
89 de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir,
90 (u32 *)&amd_iommu_unmap_flush);
91}
92
93#endif
94
60/* returns !0 if the IOMMU is caching non-present entries in its TLB */ 95/* returns !0 if the IOMMU is caching non-present entries in its TLB */
61static int iommu_has_npcache(struct amd_iommu *iommu) 96static int iommu_has_npcache(struct amd_iommu *iommu)
62{ 97{
@@ -1620,6 +1655,8 @@ int __init amd_iommu_init_dma_ops(void)
1620 1655
1621 bus_register_notifier(&pci_bus_type, &device_nb); 1656 bus_register_notifier(&pci_bus_type, &device_nb);
1622 1657
1658 amd_iommu_stats_init();
1659
1623 return 0; 1660 return 0;
1624 1661
1625free_domains: 1662free_domains: