aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSohil Mehta <sohil.mehta@intel.com>2018-09-11 20:11:38 -0400
committerJoerg Roedel <jroedel@suse.de>2018-09-25 08:33:43 -0400
commitee2636b8670b1ab2a02a65923a9bef59e9199c37 (patch)
tree340b641db7e72cba2cf7c7746f6a1f529aa1a9b5
parent4a2d80dbadb72b998641af32d8dd4b7b39e72aa0 (diff)
iommu/vt-d: Enable base Intel IOMMU debugfs support
Add a new config option CONFIG_INTEL_IOMMU_DEBUGFS and do the base enabling for Intel IOMMU debugfs. Cc: Lu Baolu <baolu.lu@linux.intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Ashok Raj <ashok.raj@intel.com> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Co-Developed-by: Gayatri Kammela <gayatri.kammela@intel.com> Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Sohil Mehta <sohil.mehta@intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r--drivers/iommu/Kconfig13
-rw-r--r--drivers/iommu/Makefile1
-rw-r--r--drivers/iommu/intel-iommu-debugfs.c20
-rw-r--r--drivers/iommu/intel-iommu.c1
-rw-r--r--include/linux/intel-iommu.h6
5 files changed, 41 insertions, 0 deletions
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index c60395b7470f..51ba19c8847b 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -186,6 +186,19 @@ config INTEL_IOMMU
186 and include PCI device scope covered by these DMA 186 and include PCI device scope covered by these DMA
187 remapping devices. 187 remapping devices.
188 188
189config INTEL_IOMMU_DEBUGFS
190 bool "Export Intel IOMMU internals in Debugfs"
191 depends on INTEL_IOMMU && IOMMU_DEBUGFS
192 help
193 !!!WARNING!!!
194
195 DO NOT ENABLE THIS OPTION UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!!!
196
197 Expose Intel IOMMU internals in Debugfs.
198
199 This option is -NOT- intended for production environments, and should
200 only be enabled for debugging Intel IOMMU.
201
189config INTEL_IOMMU_SVM 202config INTEL_IOMMU_SVM
190 bool "Support for Shared Virtual Memory with Intel IOMMU" 203 bool "Support for Shared Virtual Memory with Intel IOMMU"
191 depends on INTEL_IOMMU && X86 204 depends on INTEL_IOMMU && X86
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile
index ab5eba6edf82..a158a68c8ea8 100644
--- a/drivers/iommu/Makefile
+++ b/drivers/iommu/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_ARM_SMMU) += arm-smmu.o
17obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o 17obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o
18obj-$(CONFIG_DMAR_TABLE) += dmar.o 18obj-$(CONFIG_DMAR_TABLE) += dmar.o
19obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o 19obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o
20obj-$(CONFIG_INTEL_IOMMU_DEBUGFS) += intel-iommu-debugfs.o
20obj-$(CONFIG_INTEL_IOMMU_SVM) += intel-svm.o 21obj-$(CONFIG_INTEL_IOMMU_SVM) += intel-svm.o
21obj-$(CONFIG_IPMMU_VMSA) += ipmmu-vmsa.o 22obj-$(CONFIG_IPMMU_VMSA) += ipmmu-vmsa.o
22obj-$(CONFIG_IRQ_REMAP) += intel_irq_remapping.o irq_remapping.o 23obj-$(CONFIG_IRQ_REMAP) += intel_irq_remapping.o irq_remapping.o
diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c
new file mode 100644
index 000000000000..33e0a6c12d92
--- /dev/null
+++ b/drivers/iommu/intel-iommu-debugfs.c
@@ -0,0 +1,20 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright © 2018 Intel Corporation.
4 *
5 * Authors: Gayatri Kammela <gayatri.kammela@intel.com>
6 * Sohil Mehta <sohil.mehta@intel.com>
7 * Jacob Pan <jacob.jun.pan@linux.intel.com>
8 */
9
10#include <linux/debugfs.h>
11#include <linux/dmar.h>
12#include <linux/intel-iommu.h>
13#include <linux/pci.h>
14
15#include <asm/irq_remapping.h>
16
17void __init intel_iommu_debugfs_init(void)
18{
19 debugfs_create_dir("intel", iommu_debugfs_dir);
20}
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index b5868c757995..b9cf7c8c1616 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4837,6 +4837,7 @@ int __init intel_iommu_init(void)
4837 cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL, 4837 cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL,
4838 intel_iommu_cpu_dead); 4838 intel_iommu_cpu_dead);
4839 intel_iommu_enabled = 1; 4839 intel_iommu_enabled = 1;
4840 intel_iommu_debugfs_init();
4840 4841
4841 return 0; 4842 return 0;
4842 4843
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 3bdb9aa198af..b0ae25837361 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -621,6 +621,12 @@ extern int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_
621extern struct intel_iommu *intel_svm_device_to_iommu(struct device *dev); 621extern struct intel_iommu *intel_svm_device_to_iommu(struct device *dev);
622#endif 622#endif
623 623
624#ifdef CONFIG_INTEL_IOMMU_DEBUGFS
625void intel_iommu_debugfs_init(void);
626#else
627static inline void intel_iommu_debugfs_init(void) {}
628#endif /* CONFIG_INTEL_IOMMU_DEBUGFS */
629
624extern const struct attribute_group *intel_iommu_groups[]; 630extern const struct attribute_group *intel_iommu_groups[];
625bool context_present(struct context_entry *context); 631bool context_present(struct context_entry *context);
626struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus, 632struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,