Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4733472imm; Tue, 11 Sep 2018 17:12:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYeXtVOW1mnwFqyO0zk/L40ZwDWeA6S56bX0aW2sukY1K4Aa6qzAg+eyYeuOaX/6fbjR+k8 X-Received: by 2002:a65:62d8:: with SMTP id m24-v6mr30700401pgv.307.1536711173130; Tue, 11 Sep 2018 17:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536711173; cv=none; d=google.com; s=arc-20160816; b=ZxKu9sGW4UZNtj14CNxraCK3IVhl7WSXsYYof/MR+h8PYhSw0YzSK4wUZeyy2zWbrY LxhMgSYXXNHvWY4pyNOuRD+UJgRLYd0KpQtntNp6bNaHGvcYlJ2wYFbe9SfsWzmn7B+Z PWmiQkDKrbwJPwL/k1jVrzh1EEmwMIpnzaHSsv2v64L3xPdzDNI990rbvd4k+ecgmSoR oaN2Cg1zbWvBLhBHr+37pQgW0TB0dOpXTbYvbSboHj456DPks3zh1wMYG2ADZJOrquHy WdMQe2cwk7qtztYoaQlsrPXYcYd2iNhye8sFb//N871DSniVMJXfchleap2GGwF7/GWn evaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=71A9T/6Wv9t0AjFFd4PtkuAkRGRxTnN4MzdxkhbCAhg=; b=acsGAYxxkJbi5ZlbGk0ltT4clJvM74Z8zni7/3uydEFg7HVN4mlcal5E12G1HMKkAB jfoq39+1CAesoUazchFQgqBIUCpmTlC2kPTiqJvRybqOEvmoI2+uH2Q/2BmGIZYobgOd OphkAU5ODFMKZ1+v5m2a832q7ylEepfTfGYQSL533/paeyWPqt6vWp7tmHA6Qi4EtHOm QPUpV0tEEvtCi7XwRJ2GGW/vSuXYaVRHUNqyBfQ97t3gCnzgGSDGfAoSZMmCy1UWgPvb njkoFGmg69qMv47IDRCPspUiuDMw8fVf52pEm3bPJqvLSCy9lBAIwOXT6V/E9nCtBrbw aPrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 59-v6si20237162plp.87.2018.09.11.17.12.38; Tue, 11 Sep 2018 17:12:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728114AbeILFML (ORCPT + 99 others); Wed, 12 Sep 2018 01:12:11 -0400 Received: from mga03.intel.com ([134.134.136.65]:25689 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbeILFML (ORCPT ); Wed, 12 Sep 2018 01:12:11 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2018 17:10:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,362,1531810800"; d="scan'208";a="72213126" Received: from sohilbuildbox.sc.intel.com (HELO localhost.localdomain) ([172.25.110.4]) by orsmga007.jf.intel.com with ESMTP; 11 Sep 2018 17:10:09 -0700 From: Sohil Mehta To: Joerg Roedel Cc: Ashok Raj , David Woodhouse , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jacob Pan , Gayatri Kammela , Sohil Mehta , Ravi V Shankar , Andy Shevchenko , Lu Baolu , Fenghua Yu Subject: [PATCH v8 3/6] iommu/vt-d: Enable base Intel IOMMU debugfs support Date: Tue, 11 Sep 2018 17:11:38 -0700 Message-Id: <20180912001141.64025-4-sohil.mehta@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912001141.64025-1-sohil.mehta@intel.com> References: <20180912001141.64025-1-sohil.mehta@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new config option CONFIG_INTEL_IOMMU_DEBUGFS and do the base enabling for Intel IOMMU debugfs. Cc: Lu Baolu Cc: Fenghua Yu Cc: Ashok Raj Cc: Jacob Pan Co-Developed-by: Gayatri Kammela Signed-off-by: Gayatri Kammela Reviewed-by: Andy Shevchenko Reviewed-by: Lu Baolu Signed-off-by: Sohil Mehta --- v8: Move to the common iommu debugfs directory Simplify and split the patches differently Change filename to intel-iommu-debugfs.c drivers/iommu/Kconfig | 13 +++++++++++++ drivers/iommu/Makefile | 1 + drivers/iommu/intel-iommu-debugfs.c | 20 ++++++++++++++++++++ drivers/iommu/intel-iommu.c | 1 + include/linux/intel-iommu.h | 6 ++++++ 5 files changed, 41 insertions(+) create mode 100644 drivers/iommu/intel-iommu-debugfs.c 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 and include PCI device scope covered by these DMA remapping devices. +config INTEL_IOMMU_DEBUGFS + bool "Export Intel IOMMU internals in Debugfs" + depends on INTEL_IOMMU && IOMMU_DEBUGFS + help + !!!WARNING!!! + + DO NOT ENABLE THIS OPTION UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!!! + + Expose Intel IOMMU internals in Debugfs. + + This option is -NOT- intended for production environments, and should + only be enabled for debugging Intel IOMMU. + config INTEL_IOMMU_SVM bool "Support for Shared Virtual Memory with Intel IOMMU" 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 obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o obj-$(CONFIG_DMAR_TABLE) += dmar.o obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o +obj-$(CONFIG_INTEL_IOMMU_DEBUGFS) += intel-iommu-debugfs.o obj-$(CONFIG_INTEL_IOMMU_SVM) += intel-svm.o obj-$(CONFIG_IPMMU_VMSA) += ipmmu-vmsa.o obj-$(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 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright © 2018 Intel Corporation. + * + * Authors: Gayatri Kammela + * Sohil Mehta + * Jacob Pan + */ + +#include +#include +#include +#include + +#include + +void __init intel_iommu_debugfs_init(void) +{ + debugfs_create_dir("intel", iommu_debugfs_dir); +} 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) cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL, intel_iommu_cpu_dead); intel_iommu_enabled = 1; + intel_iommu_debugfs_init(); return 0; 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_ extern struct intel_iommu *intel_svm_device_to_iommu(struct device *dev); #endif +#ifdef CONFIG_INTEL_IOMMU_DEBUGFS +void intel_iommu_debugfs_init(void); +#else +static inline void intel_iommu_debugfs_init(void) {} +#endif /* CONFIG_INTEL_IOMMU_DEBUGFS */ + extern const struct attribute_group *intel_iommu_groups[]; bool context_present(struct context_entry *context); struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus, -- 2.18.0