diff options
| -rw-r--r-- | drivers/iommu/intel-iommu-debugfs.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c index 2becbd78620f..7fabf9b1c2dc 100644 --- a/drivers/iommu/intel-iommu-debugfs.c +++ b/drivers/iommu/intel-iommu-debugfs.c | |||
| @@ -131,6 +131,69 @@ out: | |||
| 131 | } | 131 | } |
| 132 | DEFINE_SHOW_ATTRIBUTE(iommu_regset); | 132 | DEFINE_SHOW_ATTRIBUTE(iommu_regset); |
| 133 | 133 | ||
| 134 | static void ctx_tbl_entry_show(struct seq_file *m, struct intel_iommu *iommu, | ||
| 135 | int bus) | ||
| 136 | { | ||
| 137 | struct context_entry *context; | ||
| 138 | int devfn; | ||
| 139 | |||
| 140 | seq_printf(m, " Context Table Entries for Bus: %d\n", bus); | ||
| 141 | seq_puts(m, " Entry\tB:D.F\tHigh\tLow\n"); | ||
| 142 | |||
| 143 | for (devfn = 0; devfn < 256; devfn++) { | ||
| 144 | context = iommu_context_addr(iommu, bus, devfn, 0); | ||
| 145 | if (!context) | ||
| 146 | return; | ||
| 147 | |||
| 148 | if (!context_present(context)) | ||
| 149 | continue; | ||
| 150 | |||
| 151 | seq_printf(m, " %-5d\t%02x:%02x.%x\t%-6llx\t%llx\n", devfn, | ||
| 152 | bus, PCI_SLOT(devfn), PCI_FUNC(devfn), | ||
| 153 | context[0].hi, context[0].lo); | ||
| 154 | } | ||
| 155 | } | ||
| 156 | |||
| 157 | static void root_tbl_entry_show(struct seq_file *m, struct intel_iommu *iommu) | ||
| 158 | { | ||
| 159 | unsigned long flags; | ||
| 160 | int bus; | ||
| 161 | |||
| 162 | spin_lock_irqsave(&iommu->lock, flags); | ||
| 163 | seq_printf(m, "IOMMU %s: Root Table Address:%llx\n", iommu->name, | ||
| 164 | (u64)virt_to_phys(iommu->root_entry)); | ||
| 165 | seq_puts(m, "Root Table Entries:\n"); | ||
| 166 | |||
| 167 | for (bus = 0; bus < 256; bus++) { | ||
| 168 | if (!(iommu->root_entry[bus].lo & 1)) | ||
| 169 | continue; | ||
| 170 | |||
| 171 | seq_printf(m, " Bus: %d H: %llx L: %llx\n", bus, | ||
| 172 | iommu->root_entry[bus].hi, | ||
| 173 | iommu->root_entry[bus].lo); | ||
| 174 | |||
| 175 | ctx_tbl_entry_show(m, iommu, bus); | ||
| 176 | seq_putc(m, '\n'); | ||
| 177 | } | ||
| 178 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
| 179 | } | ||
| 180 | |||
| 181 | static int dmar_translation_struct_show(struct seq_file *m, void *unused) | ||
| 182 | { | ||
| 183 | struct dmar_drhd_unit *drhd; | ||
| 184 | struct intel_iommu *iommu; | ||
| 185 | |||
| 186 | rcu_read_lock(); | ||
| 187 | for_each_active_iommu(iommu, drhd) { | ||
| 188 | root_tbl_entry_show(m, iommu); | ||
| 189 | seq_putc(m, '\n'); | ||
| 190 | } | ||
| 191 | rcu_read_unlock(); | ||
| 192 | |||
| 193 | return 0; | ||
| 194 | } | ||
| 195 | DEFINE_SHOW_ATTRIBUTE(dmar_translation_struct); | ||
| 196 | |||
| 134 | #ifdef CONFIG_IRQ_REMAP | 197 | #ifdef CONFIG_IRQ_REMAP |
| 135 | static void ir_tbl_remap_entry_show(struct seq_file *m, | 198 | static void ir_tbl_remap_entry_show(struct seq_file *m, |
| 136 | struct intel_iommu *iommu) | 199 | struct intel_iommu *iommu) |
| @@ -242,6 +305,8 @@ void __init intel_iommu_debugfs_init(void) | |||
| 242 | 305 | ||
| 243 | debugfs_create_file("iommu_regset", 0444, intel_iommu_debug, NULL, | 306 | debugfs_create_file("iommu_regset", 0444, intel_iommu_debug, NULL, |
| 244 | &iommu_regset_fops); | 307 | &iommu_regset_fops); |
| 308 | debugfs_create_file("dmar_translation_struct", 0444, intel_iommu_debug, | ||
| 309 | NULL, &dmar_translation_struct_fops); | ||
| 245 | #ifdef CONFIG_IRQ_REMAP | 310 | #ifdef CONFIG_IRQ_REMAP |
| 246 | debugfs_create_file("ir_translation_struct", 0444, intel_iommu_debug, | 311 | debugfs_create_file("ir_translation_struct", 0444, intel_iommu_debug, |
| 247 | NULL, &ir_translation_struct_fops); | 312 | NULL, &ir_translation_struct_fops); |
