Received: by 10.213.65.68 with SMTP id h4csp628255imn; Fri, 30 Mar 2018 12:11:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+bUwquzXI80s3Ec5Ak3uzUc5jTn5EHN6XRoSL/yjO+yCTJ+KEKcYlN+BylCHEsJ4X+WNg5 X-Received: by 10.167.129.129 with SMTP id g1mr176352pfi.224.1522437073376; Fri, 30 Mar 2018 12:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522437073; cv=none; d=google.com; s=arc-20160816; b=vonxyc5qCI0RubU64WFHrnFDwcyP4r1UkqeBcgUzKSFJi8eex8hX5q9jiUt73eRoSy bF4eAWod5Ng2DShFCntAl3Lp/gaV69zflATD37BLKoxs9QCCdsftZgkZAGhT+p7SrB8A Wue0501T8mecMDpvYFMaGZ7vbbD3q1kRs93sLei9S+KP91TTm5dUGBvpDZcIP3iGbq8t wcKSquh2CiX//Kvjy0Vv3nwtRRK3Pz8P8UW+fCbeL4iwz8qhlWiu6NIU1RPKQ9E9e/zW h7JyjEygAj6JaaMEn6FM+M5Yvf/pDfpq3t+Husrer8nmqT0s0Fuxp6lI9yGEE/IphPLu CZvQ== 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=KWo8R2N+ivj8xztZZC6VoWvwiBs1s1JFFr6HiJDWFug=; b=HpRoHEkYy7Gz1WQKuqK7SVjmBmNQtiUxlwkFidWb9Iu8+xeMtbR++Cc5+DaiaL3ONb gFm4ukHHUETu4J6Ad5iNJD0Ld4ui03RBGiWmuh2PBS/as2SSoY5gGdoImfIwUACZ0M9w BgwwQgRs1eZdgyo6fV3kxJ/kIBqf6/qoaRRvx+aGZb1/LAz/gRXIEITDjM2P1zOq36Xi XOLDhWjMjQjC/PGIdKHD8Q8ZrHbzfsJWBhLVX/2QwfuPfjD24YYQu31e5Hacoeg57dqQ jf3JKCtEw/mwUXTCYJ5oOju8p3hObKycbJhqVDlmYuEybs3yCppgCkBgOoC015ppUtjl QMEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=OL1OiKek; 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 f4-v6si7566959plm.378.2018.03.30.12.10.59; Fri, 30 Mar 2018 12:11:13 -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=OL1OiKek; 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 S1752600AbeC3TIa (ORCPT + 99 others); Fri, 30 Mar 2018 15:08:30 -0400 Received: from mail-sn1nam01on0079.outbound.protection.outlook.com ([104.47.32.79]:9488 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752343AbeC3TI2 (ORCPT ); Fri, 30 Mar 2018 15:08:28 -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=KWo8R2N+ivj8xztZZC6VoWvwiBs1s1JFFr6HiJDWFug=; b=OL1OiKek8E7L6ddC8pCu1mJlNJDRFUmAJDVUitQhK5Xy+eFfwgvIJj78OBFQdwRRvNZe91CxaRsSyrFp4Faq0DY99xfcEswZYVTKj2wTIFfYqrn3szAu20qeGGquFxc+5vYXCY4Mucc2En297W3UeSI/Qz2eGJcWYxBOwhYQ7FM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.109.62] (165.204.78.1) by BY2PR12MB0694.namprd12.prod.outlook.com (2a01:111:e400:52df::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Fri, 30 Mar 2018 19:08:26 +0000 Subject: Re: [PATCH 2/2] iommu/amd: Add basic debugfs infrastructure for AMD 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> <152236409481.3266.6464716993249076762.stgit@taos> From: Gary R Hook Message-ID: <3eb931c8-fd4f-f08e-3449-00eb02aff52b@amd.com> Date: Fri, 30 Mar 2018 14:08:23 -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: SN4PR0501CA0023.namprd05.prod.outlook.com (2603:10b6:803:40::36) To BY2PR12MB0694.namprd12.prod.outlook.com (2a01:111:e400:52df::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: de3462e6-bd11-4ad3-6a3e-08d596719dca X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BY2PR12MB0694; X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB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HwtU4MR8S5XxkROyntXYvvBKPRo2f2b1tspdrJg3poMM7Y5NCC3QN5ZmAR91jv6opQioFoZtrxIIugQUaMB/PjCcxfKkTpjlJvsQ0fdWEciFmXB+J1+JM9o8IkXDoTg2yt8Veh0zWA4VlALzZ2ar/Tax9dRkJNBVp964A2mpqPnsKrTE/TqBu3GYPvkI3YDvtyNvsNs5xToiqJoL2IEljJiJSm8d6UZNVOA3U6hdAlex4P2pMcvwlov+Kh8LiScVwaW+rCd6MsjpFgJkJNl+kep6h0ubqc8sCZfQ7M07OiyS/kvGN76saoFhqIv2FKfkqoU83esn61cTuDw17AvtL2bnXwfFCpMVjknkNaUc;4:J/n/H+lJe3aAWlWmtdvU953/yqcJklP3GFW/daC/CM9VmCwOIG1oAiXmxvg37C0zjz72O1lzlrrh568ApOUjBRLpiFODpR13QuEAiNrbVnqN1I8wwaHRH8BD9bXYkd/jF9qjvzZPxpg3pF+7ejh1sGbT1t+6eugWQplSkJ2w1Qi/3bjq3SwA1jqXz5qqfKxwxJ4/wXaHX651VY1i8Ux7W9EptlFkURPLm3H4O58zRoOwAVIhlsZjMnIk3UG8dmAOR+7e+tXWELpqDPEklaILHPr+B+ljeBHzKc4dwlp0O7dGlQG6eJrgUkvMpMn4f+AI 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)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011);SRVR:BY2PR12MB0694;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0694; X-Forefront-PRVS: 06274D1C43 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(346002)(366004)(376002)(39380400002)(39860400002)(396003)(199004)(189003)(956004)(11346002)(446003)(575784001)(53936002)(6246003)(105586002)(6116002)(3846002)(68736007)(305945005)(6486002)(86362001)(4326008)(97736004)(486005)(2616005)(486005)(5660300001)(72206003)(25786009)(76176011)(230700001)(59450400001)(53546011)(386003)(65826007)(476003)(478600001)(7736002)(64126003)(50466002)(36756003)(58126008)(77096007)(67846002)(65806001)(186003)(2486003)(31696002)(52116002)(23676004)(52146003)(16526019)(16576012)(8676002)(316002)(6666003)(2906002)(47776003)(229853002)(26005)(81166006)(81156014)(106356001)(8936002)(31686004)(65956001)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0694;H:[10.236.109.62];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjEyTUIwNjk0OzIzOkhLdkFBcFlETW9nREk1WkUwRWhCb2liWTM5?= =?utf-8?B?VVJRaUpFc01UOVpxNVlibC8zdFZiWWRQdmg0R0Z1VndoK2NRaktTclhrMUhF?= =?utf-8?B?Y24xYTJhYVpUUXpiZ1BHV0FsdFYrWGNlVkVqUmdIN1BLeUx6a1NoRkZwM1k5?= =?utf-8?B?dzdHUXJYK3FVNjNrU2RCSy9IRWgrTFE4cWk1NnA1WFkvWDlkaVlYL0VwNWZi?= =?utf-8?B?eldxY3V1Uytydmdxald6OFh1UWRuZ01Rb09wQ2oxVTA0Nzk5OStUd2o5akNi?= =?utf-8?B?Z2JNYXlGSDVkclFYM1FnbGFVTG52cVYwYVowdGR0M3BESUlwTVd2S3BNSVph?= =?utf-8?B?cG9Ibm5vYmhSWHZsdHpHT3ROUFQ1YVFCcnAzdGs5TzZZa1RHek9idS9TSmRI?= =?utf-8?B?dGx0LzZQMm5DMmVaaDZZb2dSOTBoM3IvQXVON1dycjJBZ05QWjRObXVCSk5u?= =?utf-8?B?bHZBZFl0N2ZvdG8rUHQvbVVMZEtVTC95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hrtIb2SD7HX2kONd66GY5MauldgysXAVcA6bjHfWNpm9k8yLNLogpT+PhRXjBSSzMnByh0HJcEf5zvwAQPYDRO1t+jKkde/CFkmcmZz3uuG5Fls+/jlh/340XSi8tnHPTWUZRrs1vgZfBHOuKRjWXpIWXLUcuOsQx62JQiBgCzH4AL6tGs/VDeqb0zFX/nSJzaRc/i8zWyHiYErH/T564b06AJ2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2018 19:08:26.1958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de3462e6-bd11-4ad3-6a3e-08d596719dca X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0694 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/29/2018 11:16 PM, Tom Lendacky wrote: > On 3/29/2018 5:54 PM, Gary R Hook wrote: >> Implement a skeleton framework for debugfs support in the >> AMD IOMMU. >> >> >> Signed-off-by: Gary R Hook >> --- >> drivers/iommu/Kconfig | 6 ++--- >> drivers/iommu/Makefile | 2 +- >> drivers/iommu/amd_iommu_debugfs.c | 47 +++++++++++++++++++++++++++++++++++++ >> drivers/iommu/amd_iommu_init.c | 9 ++++--- >> drivers/iommu/amd_iommu_proto.h | 6 +++++ >> drivers/iommu/amd_iommu_types.h | 3 ++ >> include/linux/iommu.h | 8 +++--- >> 7 files changed, 69 insertions(+), 12 deletions(-) >> create mode 100644 drivers/iommu/amd_iommu_debugfs.c >> >> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig >> index d40248446214..8d50151d5bf4 100644 >> --- a/drivers/iommu/Kconfig >> +++ b/drivers/iommu/Kconfig >> @@ -65,9 +65,9 @@ config IOMMU_DEBUG >> depends on DEBUG_FS >> default n >> help >> - Base enablement for access to any IOMMU device. Allows individual >> - drivers to populate debugfs for access to IOMMU registers and >> - data structures. >> + Enable exposure of IOMMU device internals. Allow devices to >> + populate debugfs for access to IOMMU registers and data >> + structures. > > This help text shouldn't change just because a driver is making use of > the interface that was created in the previous patch. Roger. It should be changed in the base patch only. > >> >> config IOMMU_IOVA >> tristate >> diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile >> index 5e5c3339681d..0ca250f626d9 100644 >> --- a/drivers/iommu/Makefile >> +++ b/drivers/iommu/Makefile >> @@ -11,7 +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 >> +obj-$(CONFIG_IOMMU_DEBUG) += amd_iommu_debugfs.o >> 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_debugfs.c b/drivers/iommu/amd_iommu_debugfs.c >> new file mode 100644 >> index 000000000000..3547ad3339c1 >> --- /dev/null >> +++ b/drivers/iommu/amd_iommu_debugfs.c >> @@ -0,0 +1,47 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * AMD IOMMU driver >> + * >> + * Copyright (C) 2018 Advanced Micro Devices, Inc. >> + * >> + * Author: Gary R Hook >> + */ >> + >> +#ifdef CONFIG_IOMMU_DEBUG > > Since the module won't be built unless this is defined, you don't > need this. For some reason my build is trying to compile this file, even though I have the debug option disabled. Gotta track this down. > >> + >> +#include >> +#include >> +#include >> +#include "amd_iommu_proto.h" >> +#include "amd_iommu_types.h" >> + >> +static struct dentry *iommu_debugfs_dir; >> +static DEFINE_RWLOCK(iommu_debugfs_lock); > > Use amd_iommu_... > > Also, didn't you run into an issue with the CCP and debugfs creation > during probe using a RWLOCK? Should probably make this a mutex. Yes, and had to make a change. I will do so here. > >> + >> +#define MAX_NAME_LEN 20 >> + >> +void amd_iommu_debugfs_setup(struct amd_iommu *iommu) >> +{ >> + char name[MAX_NAME_LEN + 1]; >> + struct dentry *d_top; >> + unsigned long flags; >> + >> + if (!debugfs_initialized()) >> + return; >> + >> + write_lock_irqsave(&iommu_debugfs_lock, flags); >> + if (!iommu_debugfs_dir && (d_top = iommu_debugfs_setup())) >> + iommu_debugfs_dir = debugfs_create_dir("amd", d_top); >> + write_unlock_irqrestore(&iommu_debugfs_lock, flags); >> + if (iommu_debugfs_dir) { >> + snprintf(name, MAX_NAME_LEN, "iommu%02d", iommu->index); >> + iommu->debugfs_instance = debugfs_create_dir(name, >> + iommu_debugfs_dir); >> + if (!iommu->debugfs_instance) >> + debugfs_remove_recursive(iommu_debugfs_dir); > > So this might cause an error. You remove it, but don't set the variable > to NULL, so the next IOMMU that is probed could try to use it. But why > are you deleting it anyway? Right you are. My thought was to remove everything driver-specific in the event of a failure. Do we not like that? > >> + } >> + >> + return; >> +} >> + >> +#endif >> diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c >> index 99d48c42a12f..43856c7f4ea1 100644 >> --- a/drivers/iommu/amd_iommu_init.c >> +++ b/drivers/iommu/amd_iommu_init.c >> @@ -89,6 +89,7 @@ >> #define ACPI_DEVFLAG_ATSDIS 0x10000000 >> >> #define LOOP_TIMEOUT 100000 >> + > > Spurious newline. D'oh! > >> /* >> * ACPI table definitions >> * >> @@ -2720,6 +2721,7 @@ int __init amd_iommu_enable_faulting(void) >> */ >> static int __init amd_iommu_init(void) >> { >> + struct amd_iommu *iommu; >> int ret; >> >> ret = iommu_go_to_state(IOMMU_INITIALIZED); >> @@ -2729,14 +2731,15 @@ static int __init amd_iommu_init(void) >> disable_iommus(); >> free_iommu_resources(); >> } else { >> - struct amd_iommu *iommu; >> - >> uninit_device_table_dma(); >> for_each_iommu(iommu) >> iommu_flush_all_caches(iommu); >> } >> } >> >> + for_each_iommu(iommu) >> + amd_iommu_debugfs_setup(iommu); >> + >> return ret; >> } >> >> @@ -2783,8 +2786,6 @@ int __init amd_iommu_detect(void) >> iommu_detected = 1; >> x86_init.iommu.iommu_init = amd_iommu_init; >> >> -dump_stack(); >> - >> return 1; >> } >> >> diff --git a/drivers/iommu/amd_iommu_proto.h b/drivers/iommu/amd_iommu_proto.h >> index 640c286a0ab9..e19cebc5c740 100644 >> --- a/drivers/iommu/amd_iommu_proto.h >> +++ b/drivers/iommu/amd_iommu_proto.h >> @@ -33,6 +33,12 @@ extern void amd_iommu_uninit_devices(void); >> extern void amd_iommu_init_notifier(void); >> extern int amd_iommu_init_api(void); >> >> +#ifdef CONFIG_IOMMU_DEBUG > > Use space instead of tab. Yep, fixed it. > >> +extern void amd_iommu_debugfs_setup(struct amd_iommu *iommu); >> +#else >> +static inline void amd_iommu_debugfs_setup(struct amd_iommu *iommu) {} >> +#endif >> + >> /* Needed for interrupt remapping */ >> extern int amd_iommu_prepare(void); >> extern int amd_iommu_enable(void); >> diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h >> index f6b24c7d8b70..6dca9fe38518 100644 >> --- a/drivers/iommu/amd_iommu_types.h >> +++ b/drivers/iommu/amd_iommu_types.h >> @@ -591,6 +591,9 @@ struct amd_iommu { >> >> u32 flags; >> volatile u64 __aligned(8) cmd_sem; >> + >> + /* DebugFS Info */ >> + struct dentry *debugfs_instance; >> }; >> >> static inline struct amd_iommu *dev_to_amd_iommu(struct device *dev) >> diff --git a/include/linux/iommu.h b/include/linux/iommu.h >> index 98527f9b473b..dbfff811aa25 100644 >> --- a/include/linux/iommu.h >> +++ b/include/linux/iommu.h >> @@ -412,6 +412,10 @@ void iommu_fwspec_free(struct device *dev); >> int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids); >> const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode); >> >> +#ifdef CONFIG_IOMMU_DEBUG >> +extern struct dentry *iommu_debugfs_setup(void); >> +#endif >> + > > Any reason why this moved? If it was not in the right place in the first > patch, that's where it should be fixed. It was in the wrong place, but you are correct. I'll properly move it in the other patch. Thanks. > > Thanks, > Tom > >> #else /* CONFIG_IOMMU_API */ >> >> struct iommu_ops {}; >> @@ -696,10 +700,6 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) >> return NULL; >> } >> >> -#ifdef CONFIG_IOMMU_DEBUG >> -extern struct dentry *iommu_debugfs_setup(void); >> -#endif >> - >> #endif /* CONFIG_IOMMU_API */ >> >> #endif /* __LINUX_IOMMU_H */ >>