Loading arch/x86/include/asm/amd_iommu_types.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -420,6 +420,8 @@ struct __iommu_counter { #define ADD_STATS_COUNTER(name, x) #define ADD_STATS_COUNTER(name, x) #define SUB_STATS_COUNTER(name, x) #define SUB_STATS_COUNTER(name, x) static inline void amd_iommu_stats_init(void) { } #endif /* CONFIG_AMD_IOMMU_STATS */ #endif /* CONFIG_AMD_IOMMU_STATS */ #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */ #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */ arch/x86/kernel/amd_iommu.c +37 −0 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <linux/pci.h> #include <linux/pci.h> #include <linux/gfp.h> #include <linux/gfp.h> #include <linux/bitops.h> #include <linux/bitops.h> #include <linux/debugfs.h> #include <linux/scatterlist.h> #include <linux/scatterlist.h> #include <linux/iommu-helper.h> #include <linux/iommu-helper.h> #ifdef CONFIG_IOMMU_API #ifdef CONFIG_IOMMU_API Loading Loading @@ -57,6 +58,40 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, static struct dma_ops_domain *find_protection_domain(u16 devid); static struct dma_ops_domain *find_protection_domain(u16 devid); #ifdef CONFIG_AMD_IOMMU_STATS /* * Initialization code for statistics collection */ static struct dentry *stats_dir; static struct dentry *de_isolate; static struct dentry *de_fflush; static void amd_iommu_stats_add(struct __iommu_counter *cnt) { if (stats_dir == NULL) return; cnt->dent = debugfs_create_u64(cnt->name, 0444, stats_dir, &cnt->value); } static void amd_iommu_stats_init(void) { stats_dir = debugfs_create_dir("amd-iommu", NULL); if (stats_dir == NULL) return; de_isolate = debugfs_create_bool("isolation", 0444, stats_dir, (u32 *)&amd_iommu_isolate); de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, (u32 *)&amd_iommu_unmap_flush); } #endif /* returns !0 if the IOMMU is caching non-present entries in its TLB */ /* returns !0 if the IOMMU is caching non-present entries in its TLB */ static int iommu_has_npcache(struct amd_iommu *iommu) static int iommu_has_npcache(struct amd_iommu *iommu) { { Loading Loading @@ -1620,6 +1655,8 @@ int __init amd_iommu_init_dma_ops(void) bus_register_notifier(&pci_bus_type, &device_nb); bus_register_notifier(&pci_bus_type, &device_nb); amd_iommu_stats_init(); return 0; return 0; free_domains: free_domains: Loading Loading
arch/x86/include/asm/amd_iommu_types.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -420,6 +420,8 @@ struct __iommu_counter { #define ADD_STATS_COUNTER(name, x) #define ADD_STATS_COUNTER(name, x) #define SUB_STATS_COUNTER(name, x) #define SUB_STATS_COUNTER(name, x) static inline void amd_iommu_stats_init(void) { } #endif /* CONFIG_AMD_IOMMU_STATS */ #endif /* CONFIG_AMD_IOMMU_STATS */ #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */ #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */
arch/x86/kernel/amd_iommu.c +37 −0 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <linux/pci.h> #include <linux/pci.h> #include <linux/gfp.h> #include <linux/gfp.h> #include <linux/bitops.h> #include <linux/bitops.h> #include <linux/debugfs.h> #include <linux/scatterlist.h> #include <linux/scatterlist.h> #include <linux/iommu-helper.h> #include <linux/iommu-helper.h> #ifdef CONFIG_IOMMU_API #ifdef CONFIG_IOMMU_API Loading Loading @@ -57,6 +58,40 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, static struct dma_ops_domain *find_protection_domain(u16 devid); static struct dma_ops_domain *find_protection_domain(u16 devid); #ifdef CONFIG_AMD_IOMMU_STATS /* * Initialization code for statistics collection */ static struct dentry *stats_dir; static struct dentry *de_isolate; static struct dentry *de_fflush; static void amd_iommu_stats_add(struct __iommu_counter *cnt) { if (stats_dir == NULL) return; cnt->dent = debugfs_create_u64(cnt->name, 0444, stats_dir, &cnt->value); } static void amd_iommu_stats_init(void) { stats_dir = debugfs_create_dir("amd-iommu", NULL); if (stats_dir == NULL) return; de_isolate = debugfs_create_bool("isolation", 0444, stats_dir, (u32 *)&amd_iommu_isolate); de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, (u32 *)&amd_iommu_unmap_flush); } #endif /* returns !0 if the IOMMU is caching non-present entries in its TLB */ /* returns !0 if the IOMMU is caching non-present entries in its TLB */ static int iommu_has_npcache(struct amd_iommu *iommu) static int iommu_has_npcache(struct amd_iommu *iommu) { { Loading Loading @@ -1620,6 +1655,8 @@ int __init amd_iommu_init_dma_ops(void) bus_register_notifier(&pci_bus_type, &device_nb); bus_register_notifier(&pci_bus_type, &device_nb); amd_iommu_stats_init(); return 0; return 0; free_domains: free_domains: Loading