Received: by 10.223.185.116 with SMTP id b49csp252433wrg; Thu, 8 Mar 2018 16:52:35 -0800 (PST) X-Google-Smtp-Source: AG47ELvITVO+3V5FjL7HIt4NCA12FPVb/1XAElEp/HhcEforMltgvB44q1ntAZWASHtrnm+4+2o3 X-Received: by 2002:a17:902:7282:: with SMTP id d2-v6mr26269328pll.303.1520556755281; Thu, 08 Mar 2018 16:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520556755; cv=none; d=google.com; s=arc-20160816; b=zg2VWIDQWm8Iyygf+uk/sNBwLzprzjBlZKTpCr+1ffnWSNF/TKJlAZb06NTWVhcstS PrFql+LqleOoCIa7OYT8cX6I9eCDpb9qHrzyC1iWMfrmN+VZVRjMn4Zo7fyLsgZN7Jqa FnFT914IMm5V+gvak6cJ1uv9LMjSs07g1Wg04EvBjORoSHftBDXW3S/WY7JNYFd0Sh40 i9DhN2JkLL6IWmY+fObublJO97Vnc1e9Mv3cE29RVG69fnbP0CZaey+GMDfRZiKR9LOS 3MU1nI6/e2799yeChp3oopy9gyiBiDtgy6mPfXiVfGdnF4UrAxxlklXjFGnZd4hkP5/g 9xOg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature:arc-authentication-results; bh=6GBwuEtCVMlevkntX1hBxh0VukZucc3wQCTdtI+u1Vw=; b=O+oBd1DG83NG4e/TT4r0Sq9cZl744T4lBFFbcmMPTiNAsDMrz08bSi/sdf91/2f748 +6ctuBExajht6Vrs9awoWk2FOxTIuCzHKdBUmGkx8CbMzsLQsfDQTZBo7VwogkdfIS3q FkvG1bkHMWXV/gm6a5DQq49yF5fOIp+VFo/Ha1ZwV8z7Io/zGYf7rk0Ds486vjnOJKf3 Wekf7m8LtU3vGZfunEAtrpT0dJcLI8BC/1m/tuc1Q9z5kPft7p8PMZMrQxnshmefRHSr y4bKi5+sqXrDpYTthT0Z1K/MTLJ6SSl4ELNypceuoeCTJuXvCxzOt2DlMI6ltDjySQ6h BDBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=FmhrfuVV; 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 k22-v6si15760945pls.182.2018.03.08.16.52.20; Thu, 08 Mar 2018 16:52:35 -0800 (PST) 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=FmhrfuVV; 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 S1751871AbeCIAvK (ORCPT + 99 others); Thu, 8 Mar 2018 19:51:10 -0500 Received: from mail-by2nam01on0066.outbound.protection.outlook.com ([104.47.34.66]:26208 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751776AbeCIAvI (ORCPT ); Thu, 8 Mar 2018 19:51:08 -0500 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=6GBwuEtCVMlevkntX1hBxh0VukZucc3wQCTdtI+u1Vw=; b=FmhrfuVVnRdwO4hFzWcZk0BIbYaGlcdVQxQ+pogg2DhiBVChpSVvUXraGlM/2YTUAzwB03l9WZTdSHVlbJb/idVNYPqRFmR01jrWGBGrbwWLbZ88VTvAte4T0lqNw1J9empUj+LPB9MGHNRTEySpHsrDls5dxZsFmPtvX7NwKj8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from sosxen2.amd.com (165.204.78.1) by BY2PR12MB0694.namprd12.prod.outlook.com (10.163.113.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Fri, 9 Mar 2018 00:51:03 +0000 Subject: [PATCH v2 2/5] iommu/amd - Add a 'verbose' switch for IOMMU debugfs From: Gary R Hook To: iommu@lists.linux-foundation.org Cc: joro@8bytes.org, linux-kernel@vger.kernel.org Date: Thu, 08 Mar 2018 18:50:58 -0600 Message-ID: <152055665818.63229.14230357529475243257.stgit@sosxen2.amd.com> In-Reply-To: <152055660594.63229.5131049527614494130.stgit@sosxen2.amd.com> References: <152055660594.63229.5131049527614494130.stgit@sosxen2.amd.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR21CA0006.namprd21.prod.outlook.com (10.173.197.16) To BY2PR12MB0694.namprd12.prod.outlook.com (10.163.113.16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3ea5aa9a-847d-4259-f856-08d58557d5e3 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;BY2PR12MB0694;3:dZ9IZcnG54V/AJZfR9W4+GKQye9UjNhro8vvhbM/MMvK4ArdcK03JcsCXZdzdX8UtrrQIYBxGSeDX299B10Li+R4ePzO57donXJw0HM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k1wgg7Ylr00920HAPvIy6BE1PAbwhaJiTLhGZdIEYhL9au0sU8FNcIz9qJaQogSog4eE7Qst88n58054nBupl7DGaR11i+qiYD4ppdqq44PJfYyLZ4BfHIUZrrF9AI8H/zk3gtdBREwCqZM0Z7DCmhDyx+l9gAqJwlz5He2HHG3V5iVe4vYyZL6VN9hSkkvpNcC2RsAeKAm1Pbr0nGhkgelfSEjhlpzeGxosmJV9/;4:38aZLk1oT4a8tI52/WQbKjeyVZGcD+3X6/X+3hpX1Fai9M59aUCUCSI+mlytRh8oJUrCPzt9OtRZwSD1GGO+sHTfK85EspT9ZhjdkuwmHmajlyIRe2JP0C7dDL8JWI8HnJmp2XJNY96qtiCvEaWAyovNqZhVgsEuLXiZdRXBV5X2wIHF0ZT095qvYzvhADrL1LwlZAeK344r32mcR6/esJaiRr550IGaxPlr+SoLEVWHhF9odrSBYlXaKYVW9SbkzVcZ6JjYnagmAavTtQZsd3z74usfjx7UhCMR1Z1rwht4OVr/xTJVQJEUy/6IWSN5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040521)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(3002001)(10201501046)(6055026)(6041309)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011);SRVR:BY2PR12MB0694;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0694; X-Forefront-PRVS: 0606BBEB39 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(366004)(39380400002)(396003)(39860400002)(346002)(376002)(189003)(199004)(7696005)(72206003)(50466002)(478600001)(186003)(16526019)(55016002)(68736007)(86362001)(97736004)(2906002)(52116002)(76176011)(47776003)(23676004)(2486003)(316002)(59450400001)(81166006)(81156014)(4326008)(8676002)(58126008)(25786009)(3846002)(66066001)(6916009)(106356001)(5660300001)(6666003)(2950100002)(386003)(105586002)(53416004)(2361001)(7736002)(26005)(8936002)(230700001)(6116002)(305945005)(53936002)(103116003)(2351001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0694;H:sosxen2.amd.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjEyTUIwNjk0OzIzOkFDVFJKM2JOZEx3dVR6V1UwdFlwMFRrLzVv?= =?utf-8?B?bFhxbHdxZEdOMndhU21qYldMM0N4aUwwbGl0QXdFQ29zVG1GLzdDSzdhK0Vs?= =?utf-8?B?eDlEeGtsREZCK21sYkZ6WkprZ3l4VlBSYTdUYmtEemVmbm1HTTVkMTgzQTJN?= =?utf-8?B?dURGSFplYzBkUytaR0N2ckdvbXpVNXBKWWJFS1hCQXNySjlodUZpVGhjbXJM?= =?utf-8?B?cDhTK0ZSTmxzRlJkQ2lyNDZ0bk9yRGgveWZ0UUZoc0ZtOHE3WWFTQ01oMkFV?= =?utf-8?B?ZDJFZStYTWFJbHRVTUdxMzFoNC8zN3hGeVU5UmNXa2t6ejNKY25pZnlFQnVs?= =?utf-8?B?VUhpaVFIUUVuWldxVGNkRjhFcUdSaElZeEUxekdZU1RvN25veUdaS09tcmtl?= =?utf-8?B?ZnZwMnJSaWVvQy9SUXZBc2Q5NWg3YWVtVVFZRm5QeUdRNW5oOXBXbGdIMVJW?= =?utf-8?B?TlJxbUMyY0YyOXVicXNwQWxkQTUvUmZHNE52aTlUd3REamdGSC9FWkRkeitG?= =?utf-8?B?ZHdOQWgzbGVJOU9iQS9BRFpTL1hzSTRkYzRYRVROZkNXVkhkUWpjMlRMbTFH?= =?utf-8?B?RkZmdUpqZitJUFhTeWVvaEtNZUNjWWFoM2owQkFBbU4wUjFmNTM4THFXZlZn?= =?utf-8?B?MDhhN2xWd3lHc2p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ny9aPT/EJq3ujaa4H/bRK2NaxwIvvr7Lddr3SDA5QCYfoTWa3rrpCO29dyzyyO3LVFceRUYR/2+P1RGKa91Aq9nP5vJynC8tNzN3BfSlWA1h13MVeVzXWzo1X8/YYLY50vB7rrDDyeke3zF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0694;20:SinFl3jZ6RNz4aJEQPh9OQirFpFJZ2ODFmJONi+bmpBGzfSf3mNdtT8qJ2d0FV5JE6gVKrfoNBWhromctq+sxEVpDosBul1WPKSnOvAECG4B21my/rsTinShtG6LanEIN2/xI8AMyFZ95MIet3w59sBWMoLtkA3W5EAy7ShnMUPBznXLKV7gcebJKWmscOafCqnryTo3cfmS5qv7A2rKJ2ejXfdaxl8UoE0Uf/ggtKUOXLonCFSv6k21W2GOMY5Y X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2018 00:51:03.2272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ea5aa9a-847d-4259-f856-08d58557d5e3 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 Enable more descriptive debugfs output via a 'verbose' variable. Signed-off-by: Gary R Hook --- drivers/iommu/amd_iommu_debugfs.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd_iommu_debugfs.c b/drivers/iommu/amd_iommu_debugfs.c index b0395a47bc32..481f4d86f8f8 100644 --- a/drivers/iommu/amd_iommu_debugfs.c +++ b/drivers/iommu/amd_iommu_debugfs.c @@ -27,6 +27,8 @@ static DEFINE_RWLOCK(iommu_debugfs_lock); #define MAX_NAME_LEN 20 +static unsigned int amd_iommu_verbose = 0; + static unsigned int amd_iommu_count_valid_dtes(int start, int end) { unsigned int n = 0; @@ -61,7 +63,10 @@ static ssize_t amd_iommu_debugfs_dtecount_read(struct file *filp, return -ENOMEM; n = amd_iommu_count_valid_dtes(0, 0xFFFF); - oboff += OSCNPRINTF("%d\n", n); + if (amd_iommu_verbose) + oboff += OSCNPRINTF("# DTEs: %d\n", n); + else + oboff += OSCNPRINTF("%d\n", n); ret = simple_read_from_buffer(ubuf, count, offp, obuf, oboff); kfree(obuf); @@ -79,6 +84,7 @@ static const struct file_operations amd_iommu_debugfs_dtecount_ops = { void amd_iommu_debugfs_setup(struct amd_iommu *iommu) { char name[MAX_NAME_LEN + 1]; + struct dentry *d_verbose; struct dentry *d_dte; unsigned long flags; @@ -97,6 +103,12 @@ void amd_iommu_debugfs_setup(struct amd_iommu *iommu) if (!iommu->debugfs_instance) goto err; + d_verbose = debugfs_create_u32("verbose", 0600, + iommu->debugfs_instance, + &amd_iommu_verbose); + if (!d_verbose) + goto err; + d_dte = debugfs_create_file("count", 0400, iommu->debugfs_instance, iommu, &amd_iommu_debugfs_dtecount_ops);