Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5856844imm; Tue, 12 Jun 2018 14:43:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI38ZQ7VuS621UxXpCYyt2fxcaHvSc+e4rDBQik6Kz/+AI9KptXJkMmC+vy/Gi45ynQxRLn X-Received: by 2002:a62:8d03:: with SMTP id z3-v6mr2094891pfd.112.1528839786625; Tue, 12 Jun 2018 14:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528839786; cv=none; d=google.com; s=arc-20160816; b=mC1rZWmBvS465mWgoSiyxSXw6f/BK1Vq7P+riNMD9OVb1KXC9QQvAqAcJYy9eRnKAG 5eLEk57YCJPtl42qVgCjyr97DKpeesbFS0kLulABm52O1JUqtiemKRubpE+4Q/uDXPR9 jInHYYXgHuKVX3SgPyVy10fYl7WmTsaqIrx9pSLP1W+rwkgNQOrb9UIsfrisNHeRkpwu O/4U4ZcL4nn2twJRS+24xnMSH/1UIdxzrTdnwEp0mBS7LZfi6/X60nMkmmCGH/C8WvoG dC5l9ExkwcxX/d0Lxus3Nq9hzOL8gvhG/HZWMgCA5d7dB7GwZnmkcGXzDMUiACpW5EPP rO7A== 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:message-id:date:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=415mw2N85dokXpRvQf8K4FPKuCnfSlNeKpqYhUqbJD8=; b=Nv3IXu9p7p/XPgEkDnzBoTgWj2Int1yY0/zg9PSQUwhPO/9Q9FEcVe8o3D+NlgGQn5 3Yu/6JKwE1PVz9pAKtqiRkaJY0XF5IEnIg2IrB8liljP/zQ96n6KwctIYZAU+2q3b9kv 7KNapIwi7RANArFkfNev7I//Kv9dsBQzrwriNAJffzu+HJV1LQcT87rlsvn4XI6qUTke NzYKo7EwDVrgTUnTR9saoHql0VJA6Te2tmZjFbvY0abuOVVITKt4tbb2gCOZWI+ceeM5 sswyClD48KSQBkiacvzBm1P9tmTkZm5QpRwQM1UqOb0g+9RrFxloZZrwC4F5gKsduBPV lgJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=0SZy4of4; 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 q69-v6si1019445pfj.51.2018.06.12.14.42.51; Tue, 12 Jun 2018 14:43:06 -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=0SZy4of4; 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 S934322AbeFLVlT (ORCPT + 99 others); Tue, 12 Jun 2018 17:41:19 -0400 Received: from mail-eopbgr710065.outbound.protection.outlook.com ([40.107.71.65]:52897 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933533AbeFLVlR (ORCPT ); Tue, 12 Jun 2018 17:41:17 -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:X-MS-Exchange-SenderADCheck; bh=415mw2N85dokXpRvQf8K4FPKuCnfSlNeKpqYhUqbJD8=; b=0SZy4of4PRjxSv8CEcoAklhAa/ZaQEQYWY3EK2HLce8HKVuN3T0cVZ3bbuyJo8jAn7yWmEBaiHZGK1IZ2ySt6TG75DBegtqNPcPA8XgBMxmjwGGZZAlrbnkqrfAVGRo5qaG+sltv6tjw5KrRWV6juQf3TRpbXe7jbdQ/sXFjKjE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [127.0.1.1] (165.204.78.1) by DM5PR12MB1452.namprd12.prod.outlook.com (2603:10b6:4:d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.15; Tue, 12 Jun 2018 21:41:15 +0000 Subject: [PATCH v9 0/2] Base enablement of IOMMU debugfs support From: Gary R Hook To: iommu@lists.linux-foundation.org Cc: joro@8bytes.org, linux-kernel@vger.kernel.org Date: Tue, 12 Jun 2018 16:41:12 -0500 Message-ID: <152883965482.1936.13657625103232933481.stgit@taos> 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: SN1PR12CA0079.namprd12.prod.outlook.com (2603:10b6:802:21::14) To DM5PR12MB1452.namprd12.prod.outlook.com (2603:10b6:4:d::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f5b46fde-214e-4d31-06b6-08d5d0ad399a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(711015)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:DM5PR12MB1452; X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1452;3:jYYoFkepNnVFsd7jnh2PP3WdvauBoqf6HmWlNJ9VEOQGDYr6wshYrJd52YKfHx4QC/RoDvjgxaXhuS1fz3RGQAsybgtJamCuzgAt5N3vowKxZGk3U67gnPQ5GZ9eQ3PRtfCS7qWPO5lmzMFUMa+Fk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KRNLhunpLMZCdabyswEzQSgHWJT44XuMdQEYhAAWF+eOIDeV+l6dhwPJV6OlkK9V21rG6LbJkcdIIxve5VRQTxCi0eM9dEYYc51W55OVLF/DXcpc0thX37d7kp3qWAhetdGz0CEd/VaPnrweVGlAZ49dYVwmTtPid7G2opL3pH4m8Qw8DcnRf+aBBHUPR2YBdyxsQ;4:wePJgjrb37+9ACBEToLYum8e5oOMQgH1jYtNtiaTg8iA84d87DkAYtI2pGv60xdbHWO1CopYAN1/y/ED0YaZFGtwwmCl4u9zToZnV7iz/ynB+rZIckLGxxiwcuRPfTeMhu6283q9SOLdBKAwqx1gxycEy7xZx8a760kIlmuy9e8p99X4VleTwhIjoFFIfGtlBj31ZJQCl7y8JdtANRS0mQKGCzRMKuaaR7weNM166A+dLKPsM1iMOdGSvLQu67yw1dI4LkeBhV4bWTfNMXJfVQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:DM5PR12MB1452;BCL:0;PCL:0;RULEID:;SRVR:DM5PR12MB1452; X-Forefront-PRVS: 07013D7479 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(7916004)(396003)(366004)(39380400002)(39860400002)(346002)(376002)(199004)(189003)(23676004)(2906002)(486006)(58126008)(68736007)(50466002)(52116002)(2486003)(6916009)(106356001)(5660300001)(2361001)(53936002)(86362001)(956004)(2351001)(16576012)(105586002)(230700001)(72206003)(6666003)(476003)(7736002)(97736004)(26005)(77096007)(33896004)(386003)(6116002)(81166006)(81156014)(16526019)(186003)(3846002)(478600001)(8676002)(25786009)(47776003)(103116003)(305945005)(316002)(6486002)(33716001)(4326008)(66066001)(8936002)(9686003)(59450400001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR12MB1452;H:[127.0.1.1];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxNDUyOzIzOnkxMzRML2ZoSjRhbkdoNE5IR29MQlBWeXZa?= =?utf-8?B?NmQ3QnZoTUlnK1Vyd1pMb3RQT1VFZ0ZEdlNRaW5DQmJ3S1hvQ3RYNklUUGpk?= =?utf-8?B?OFlacFZydmpDS0NkQTJKN3A3TTI0NFlwWE5sUEYzeVlJZnVRNFhETUt5Z0c2?= =?utf-8?B?VXVvYkVhWWxHdmRBVStxUEdQWld4dEJibnU4RHlXd29TbWZNcS91K0xLeXBT?= =?utf-8?B?ZDEzZENsY0tNb3I4S2VZOHVUWWdjYlE1N0hDWEs2VXRGWktMTnllaXI0K0wv?= =?utf-8?B?ZTdOT2d1d0ZXZmZTQTJLS00vRXducVNjanNGcEdNQUJOTkpZeEoxY3RBU2xJ?= =?utf-8?B?V2NsL2NJa2V2allqZ2plVzc5ZXRQK1dIU05jcnI3Vmp3YlZ6M1lMY3QwNUtL?= =?utf-8?B?ZE94cHk4TUdFeWsvbWRrOEdZK1oxeTBuMkRrdFg1RWRJNysxREF3U1JYK3pK?= =?utf-8?B?YmlVZlNuTzR2aVlnVVVLWURSb3dLWTlWSFR3ZTg5L1QrRy9NSmVGamMzSXFy?= =?utf-8?B?d29JNzR1ZXZKSGpNcFVqNWQ5YW05NVRoY2JnUm0vdzQxRi83cnJqWlZYY0tw?= =?utf-8?B?a1UzbnVkMGg0enFFT1BVb1pzcGlCOURyWEhvT0pIWnNwSHZPT1VGeEJoQnBT?= =?utf-8?B?MTNYVVRWTDk3SkJpTTU4bTRVelV2T2JCVXFMbW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YECNaCdPi3GUhtgaMCV0vVCdaNDsYVWgVbA02ShE=;24:M8agav3SQGt+fZTFXefQSA+o5zkYswn9jfGQ3InLsfkJ5ECGCy6aGEuLQMvz7mwI/rnl3uvWbtjM+03WYlbSkbTd3rYqOjOCerlygNPBVSk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1452;7:nlaBfYuH35UptW471XR4msClPYc2VHiJqr75I1f+zz+CJJR3csZQnn/Ypzk1jEFoYcKzVvIrhGJy7URTtK3c00fcVdyI7XQxQX7tWKTNfsgooi+ATTjrqcXHSv4cuinue8n+MwKdwZBjopk8FJYiIyoCrmBYAGCM1oVwzSOWHILdp+4MZSn7aOI4qG6aGeNb9e6bnPKWIIY0OIjzCyTNfCq4R3xhXX8H0A8i8vv1pUrn7vucei2iWG1pDB/lkSX2;20:pirdA3zfI9pQLIUI9N4cLt5xDaGX0aLRcfnePGaVn10YZDOITsD9FojWv0JmQxFSg4fZiZBxf0+wBR1aKAwHku/rPYIYq6kmQmdwiVw6+rhmQ2uc1beqFsMpdQEbyh2DAMFKVdJ8EOlFg3uOk575a3u49+1gvsv6ymdKeH9V/m8KKhCKq5U0Lrh3cCBUABpVieeBSsHN9kh/deeVMBFj1RfUFNkWOrzQKsGIj8PtLYNXy2ysAO4FKrlzS61rYk0U X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2018 21:41:15.3905 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5b46fde-214e-4d31-06b6-08d5d0ad399a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1452 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These patches create a top-level function, called at IOMMU initialization, to create a debugfs directory for the IOMMU. Under this directory drivers may create and populate vendor-specific directories for their device internals. Patch 1: general IOMMU enablement Patch 2: basic AMD enablement to demonstrate linkage with patch 1 Introduce a new Kconfig parameter IOMMU_DEBUGFS to globally allow/disallow debugfs code to be built. The Makefile structure is intended to allow the use of a single switch for turning on DebugFS. Changes since v8: - Change Kconfig to use both an IOMMU boolean and a vendor-specific boolean; ensure big warning messages - Make the function that creates a vendor directory more concise Changes since v7: - Change the Kconfig approach to use a hidden boolean for a specific device - Change some #ifdefs to reference the new boolean Changes since v6: - Rely on default Kconfig value for a bool - comment/doc fixes - use const where appropriate - fix inline declaration Changes since v5: - Added parameters names in declarations/definitions - Reformatted an inline definition Changes since v4: - Guard vendor-specific debugfs files in the Makefile - Call top-level routine from iommu_init() - Add function for instantiating a driver-specific directory - Change AMD driver code to use this new format Changes since v3: - Remove superfluous calls to debugfs_initialized() - Emit a warning exactly one time - Change the Kconfig name to IOMMU_DEBUGFS - Change the way debugfs modules are made Changes since v2: - Move a declaration to outside an ifdef - Remove a spurious blank line Changes since v1: - Remove debug cruft - Remove cruft produced by design change - Change the lock to a mutex - Coding style fixes - Add a comment to document the framework --- Gary R Hook (2): iommu - Enable debugfs exposure of IOMMU driver internals iommu/amd: Add basic debugfs infrastructure for AMD IOMMU drivers/iommu/Kconfig | 22 ++++++++++++ drivers/iommu/Makefile | 2 + drivers/iommu/amd_iommu_debugfs.c | 33 +++++++++++++++++++ drivers/iommu/amd_iommu_init.c | 6 ++- drivers/iommu/amd_iommu_proto.h | 6 +++ drivers/iommu/amd_iommu_types.h | 5 +++ drivers/iommu/iommu-debugfs.c | 66 +++++++++++++++++++++++++++++++++++++ drivers/iommu/iommu.c | 2 + include/linux/iommu.h | 7 ++++ 9 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 drivers/iommu/amd_iommu_debugfs.c create mode 100644 drivers/iommu/iommu-debugfs.c --