Received: by 10.213.65.68 with SMTP id h4csp605364imn; Fri, 30 Mar 2018 11:43:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/GZtXRkIy74p83FNHvHpk/V6kPm58BtOcMk1vp4w7AP/rH16Gydd97Li3JzpFjP7W606q/ X-Received: by 10.167.129.7 with SMTP id b7mr110863pfi.122.1522435395245; Fri, 30 Mar 2018 11:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522435395; cv=none; d=google.com; s=arc-20160816; b=y+aD3zWBchQ+9www4SQ0+ojiHh83eq0qTfsyYoFGxrveY6+6jwQWcP5rxB3veNtXdS QlvlE3N0II8FIfr4DHuRvK+/9S1qtT+rogwmy8EqHDRoOfiO1d0pp7zAtUjSpk6bwXy2 bwh6uVBoO8ZH8eA7U0aLcH6bKFFbTaHGW1IgOACAEBu215qU25iR8XjudJyry1KGCIWZ O3XOxm/7bc1HZHehWwiNJDAlUz6DrqwFpUUBFbL8kItfRYp65fvfK5XMSyUbN/bfuQJo sMEaopd1pgyambQmNIw5Pbf8hKbETup0/0ESbl2JJT6qrx4FFn+fnhmg9l7+jb2OEdqx ++Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=/l1HZk+gBapXVo0N0wj0No/x2586IP/awxg4DbFIKls=; b=kJZUdjwsdnM4ASXSExXAvUk+3abysFVOjBIamYZ/egciuFEdkETAhCX8XKkD5ivt7k 8V4SKJsAX6U/Iw8oGqYMx7qqtQT9Lrs95jXyLaDwmwzDow+5gI1WqS/BdpvLXkSN4xSB hMft5oHLqGYfZpLSBFtgsEWNAdYqEHCY7P0Ng9QqldeUJAOhTInWqCfVA2lfgskDeUXM GfTPpZUklEjgPwI7XRefgrq5o/pX27SUyTUCDIqBFthZRJqsKTSYBXHqVOmHDs6vzQXH Ul0/DD3LmK6MoHeujPMI8ZpB/vgzJ3Y77kv/eXf4DxCu2mC4B6XZpY3Iskyeffm0HGWH AT+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=AGc8G6PQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e16-v6si8882224pli.643.2018.03.30.11.42.59; Fri, 30 Mar 2018 11:43:15 -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; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=AGc8G6PQ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752188AbeC3Slx (ORCPT + 99 others); Fri, 30 Mar 2018 14:41:53 -0400 Received: from mail-bl2nam02on0089.outbound.protection.outlook.com ([104.47.38.89]:45216 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751322AbeC3Slv (ORCPT ); Fri, 30 Mar 2018 14:41:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/l1HZk+gBapXVo0N0wj0No/x2586IP/awxg4DbFIKls=; b=AGc8G6PQf9VHXTUWCNbMUkA97cupovfVtbummrpRUolM3qvDAF3KYmyH160lnA/HBPN5B35q0rG2+4+24SaG9QMezpXrHRyZ2m5hcUmHsN27iKKjrzCa5zENrqwf02iPch5Q6eg2BEbmVxZJUd36BquZIHeUHuC8e0aM5slWBt4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.109.62] (165.204.78.1) by BLUPR12MB0689.namprd12.prod.outlook.com (2a01:111:e400:5950::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.10; Fri, 30 Mar 2018 18:41:48 +0000 Subject: Re: [PATCH 1/2] iommu - Enable debugfs exposure of the IOMMU To: Tom Lendacky , iommu@lists.linux-foundation.org Cc: joro@8bytes.org, jacob.jun.pan@linux.intel.com, linux-kernel@vger.kernel.org References: <152236384612.3266.1451709369164076985.stgit@taos> <152236408441.3266.6015804200548808265.stgit@taos> From: Gary R Hook Message-ID: Date: Fri, 30 Mar 2018 13:41:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR18CA0004.namprd18.prod.outlook.com (2603:10b6:404:121::14) To BLUPR12MB0689.namprd12.prod.outlook.com (2a01:111:e400:5950::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 923be820-3744-4df4-1534-08d5966de53f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BLUPR12MB0689; X-Microsoft-Exchange-Diagnostics: 1;BLUPR12MB0689;3:A8OD6kakKAmFlieA4HLB/rTVPbsK3Z++ddWkLZI4QN5llLgZuqX0hmCbJsdDfnkpuTRohymn4e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l05XEmX8bQ2826H9aE9l+5KdDbDCO0MxjZ+0tqrHvfoA6rtN16RzBsMwBdDkQBLcfoTr5ZZ8zLUNx7Lu+hoWz/pwZC2+YgoHQh9+brnVKoSPaKyiSnhmXxd24uQ1zi0P2uOZYulL2ryAoGZ+uYrx161ZAtWuEcSnyuhCab2pEdXIRI99SkJAKoKd3k49TdoWysdhcbw7fk+LuvbQtKC6tr3R3k/tufbWv/dpKyVpNVsyMcA/0QIxVFD13xNxDuu+Aa62o4OgNOV13veOZhu;4:ca5SAcQBJRSt5XMl+ocdme68utTv1HXEiUXPibHVytguR6BdBVK59jDYmdr/JYCNpYz5Z4kRYeC6HCLYeuEhxpYJyp9we4DXdPDeMelxlJwl9k3/80Nh9xH806l5b89xmsmKxSUChVl/LZ0iHBecmmtuDJuggWfahALiGlxNMstzMTAroM9fZ2Dz/E5dUl64Y8RcXIQBUGaPeGiMBV7eTyrEaHEVnVALfedDcuuUpnWdrEvV89bOY3iutiduBFyC6e5eyPfSUt21BjkrRWfWfgZ/DP01B659DwbYOfxMAKK18k9bW3xgnu/yGNUrIXy2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231221)(944501327)(52105095)(6055026)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:BLUPR12MB0689;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0689; X-Forefront-PRVS: 06274D1C43 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(396003)(346002)(366004)(39860400002)(39380400002)(376002)(189003)(199004)(11346002)(86362001)(26005)(446003)(77096007)(65826007)(5660300001)(52116002)(25786009)(67846002)(6246003)(186003)(16526019)(6116002)(2616005)(956004)(476003)(4326008)(64126003)(486005)(50466002)(53936002)(6486002)(486005)(3846002)(2906002)(2486003)(72206003)(31696002)(229853002)(8936002)(478600001)(66066001)(47776003)(81166006)(8676002)(81156014)(23676004)(52146003)(106356001)(7736002)(65806001)(65956001)(305945005)(36756003)(59450400001)(230700001)(97736004)(386003)(53546011)(105586002)(58126008)(6666003)(68736007)(76176011)(31686004)(16576012)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR12MB0689;H:[10.236.109.62];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjEyTUIwNjg5OzIzOkJ3Zk1zVE1IZG9HSmNJcXMxSTNkVjlsb1U0?= =?utf-8?B?ODlxeC90NTk5UDN6NzRuS3BOWFFHbUkrNDFUbUdhY0ZpS2Q5VzQzNmpNeVZT?= =?utf-8?B?Y1ZQa2YvV1BXZnAycUl1VE14bUkrcVFadGdSM1hRY0NlWTdXNlh3OC9tTU93?= =?utf-8?B?R3RhSjBYWWlKcytTOWVTQTZtcFVvZDIyay9UQ3VZWjBjTE4rOGIzUXphVi9B?= =?utf-8?B?ZFMrNFdIMkZoZXlHaVh0eEk2SE5ML2w2RjNQUGZ3Z1hsZS9MeGR4ODU0cEYz?= =?utf-8?B?SVM4OEFMcUc3QkdwcVRpV2wydEFXTnFWenBjam9RSFFadERTMWlQZDlFdFYz?= =?utf-8?B?MFM1aEtDNi9WWmpQcHJpd3dPS2xNUExPK3NsUkRZWjdNeUh0aURVaEMrL21W?= =?utf-8?B?Ri95V0xUVVp2ck9EVXZCV3VyM2JXTVNKbktDT2ZxcStDZjEzTzUwSjVMZHdq?= =?utf-8?B?czVDQ3F3NEJjWm9BZmVjYjZhdDdQZlFtbzYrODByNWNkOHc5NTdwTVFvTXJN?= =?utf-8?B?Tnc2bzdwR29GSDA1bzBkZTBoZm15a3RpWlJUdWM3U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A7LIaQD3B0X6V5MmtmdqzWBHNHUb3lQKGoXcke7rx4SWdANoT2LG1qaAy92VHs06VVdwL/kK/Wj5wB8QPQKJdGfJw5vaEye9/D6IzJL/95nVXRC9HnX7Fo2duvvqFHNhBEbPL6EDBCeAWoDE+fvv9wqkLaE0/P X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2018 18:41:48.0988 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 923be820-3744-4df4-1534-08d5966de53f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0689 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/29/2018 10:57 PM, Tom Lendacky wrote: > On 3/29/2018 5:54 PM, Gary R Hook wrote: >> Provide base enablement for using debugfs to expose internal data of >> an IOMMU driver. When enabled, create the /sys/kernel/debug/iommu > > So this can't actually create anything yet since nothing invokes the > function. Maybe describe how it should be used by other drivers (and > probably include that description as a commment for the function) to > create the directory. Exactly. Given the approach I took, it takes another patch to take advantage of this. I can certainly elaborate on usage if we agree that this framework is acceptable. > >> directory. Emit a strong warning at boot time to indicate that this >> feature is enabled. >> >> Signed-off-by: Gary R Hook >> --- >> drivers/iommu/Kconfig | 11 +++++++++++ >> drivers/iommu/Makefile | 2 ++ >> drivers/iommu/amd_iommu_init.c | 2 ++ >> drivers/iommu/iommu-debugfs.c | 32 ++++++++++++++++++++++++++++++++ >> include/linux/iommu.h | 4 ++++ >> 5 files changed, 51 insertions(+) >> create mode 100644 drivers/iommu/iommu-debugfs.c >> >> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig >> index f3a21343e636..c1e39dabfec2 100644 >> --- a/drivers/iommu/Kconfig >> +++ b/drivers/iommu/Kconfig >> @@ -60,6 +60,17 @@ config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST >> >> endmenu >> >> +config IOMMU_DEBUG >> + bool "Enable IOMMU internals in DebugFS" >> + depends on DEBUG_FS >> + default n >> + help >> + Allows exposure of IOMMU device internals. This option enables >> + the use of debugfs by IOMMU drivers as required. Devices can, >> + at initialization time, cause the IOMMU code to create a top-level >> + debug/iommu directory, and then populate a subdirectory with >> + entries as required. >> + >> config IOMMU_IOVA >> tristate >> >> diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile >> index 1fb695854809..5e5c3339681d 100644 >> --- a/drivers/iommu/Makefile >> +++ b/drivers/iommu/Makefile >> @@ -2,6 +2,7 @@ >> obj-$(CONFIG_IOMMU_API) += iommu.o >> obj-$(CONFIG_IOMMU_API) += iommu-traces.o >> obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o >> +obj-$(CONFIG_IOMMU_DEBUG) += iommu-debugfs.o >> obj-$(CONFIG_IOMMU_DMA) += dma-iommu.o >> obj-$(CONFIG_IOMMU_IO_PGTABLE) += io-pgtable.o >> obj-$(CONFIG_IOMMU_IO_PGTABLE_ARMV7S) += io-pgtable-arm-v7s.o >> @@ -10,6 +11,7 @@ obj-$(CONFIG_IOMMU_IOVA) += iova.o >> obj-$(CONFIG_OF_IOMMU) += of_iommu.o >> obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o >> obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o >> +obj-$(CONFIG_AMD_IOMMU_DEBUG) += amd_iommu_debugfs.o > > Where is this CONFIG defined? That, my friend is left-over cruft. Please ignore. Apologies, and thanks. >> obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o >> obj-$(CONFIG_ARM_SMMU) += arm-smmu.o >> obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o >> diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c >> index 6fe2d0346073..99d48c42a12f 100644 >> --- a/drivers/iommu/amd_iommu_init.c >> +++ b/drivers/iommu/amd_iommu_init.c >> @@ -2783,6 +2783,8 @@ int __init amd_iommu_detect(void) >> iommu_detected = 1; >> x86_init.iommu.iommu_init = amd_iommu_init; >> >> +dump_stack(); >> + > > This definitely shouldn't be here. Dang it! > >> return 1; >> } >> >> diff --git a/drivers/iommu/iommu-debugfs.c b/drivers/iommu/iommu-debugfs.c >> new file mode 100644 >> index 000000000000..94c9acc63b65 >> --- /dev/null >> +++ b/drivers/iommu/iommu-debugfs.c >> @@ -0,0 +1,32 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * AMD IOMMU driver > > This isn't the AMD IOMMU driver. Again: dang it! >> + * >> + * Copyright (C) 2018 Advanced Micro Devices, Inc. >> + * >> + * Author: Gary R Hook >> + */ >> + >> +#include >> +#include >> +#include >> + >> +static struct dentry *iommu_debugfs_dir; >> + >> +#define MAX_NAME_LEN 20 > > This isn't used anywhere. Thanks. > >> + >> +/* Return a zero on failure; 1 on successful setup */ > > Return NULL on failure, pointer to IOMMU debugfs dentry on success. Roger. > >> +struct dentry *iommu_debugfs_setup(void) >> +{ >> + if (!debugfs_initialized()) >> + return NULL; >> + >> + if (!iommu_debugfs_dir) >> + iommu_debugfs_dir = debugfs_create_dir("iommu", NULL); >> + >> + if (iommu_debugfs_dir) >> + pr_warn("WARNING: IOMMU DEBUGFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL\n"); >> + >> + return iommu_debugfs_dir; >> +} >> +EXPORT_SYMBOL_GPL(iommu_debugfs_setup); >> diff --git a/include/linux/iommu.h b/include/linux/iommu.h >> index 41b8c5757859..cb2957dac43b 100644 >> --- a/include/linux/iommu.h >> +++ b/include/linux/iommu.h >> @@ -696,6 +696,10 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) >> return NULL; >> } >> >> +#ifdef CONFIG_IOMMU_DEBUG > > Should be a space between the #ifdef and the CONFIG_..., not a tab. Roger that. > > Thanks, > Tom > >> +struct dentry *iommu_debugfs_setup(void); >> +#endif >> + >> #endif /* CONFIG_IOMMU_API */ >> >> #endif /* __LINUX_IOMMU_H */ >>