diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-12-12 07:50:21 -0500 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-01-03 08:11:58 -0500 |
commit | 7f26508bbb76ce86aad1130ef6b7f1a4bb7de0c2 (patch) | |
tree | 92efde72a5101c1aed8858272f150c1c281bc3b8 /arch | |
parent | a9dddbe0497ab0df7ee729e8d4cb0ee2dec3e4ba (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.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 37 |
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 | ||
423 | static 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, | |||
57 | static struct dma_ops_domain *find_protection_domain(u16 devid); | 58 | static 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 | |||
67 | static struct dentry *stats_dir; | ||
68 | static struct dentry *de_isolate; | ||
69 | static struct dentry *de_fflush; | ||
70 | |||
71 | static 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 | |||
80 | static 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 */ |
61 | static int iommu_has_npcache(struct amd_iommu *iommu) | 96 | static 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 | ||
1625 | free_domains: | 1662 | free_domains: |