From patchwork Mon Sep 18 12:35:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "StDenis, Tom" X-Patchwork-Id: 9956611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DBBB60385 for ; Mon, 18 Sep 2017 12:35:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E71828C6D for ; Mon, 18 Sep 2017 12:35:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3338428CA8; Mon, 18 Sep 2017 12:35:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 25E8428C6D for ; Mon, 18 Sep 2017 12:35:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9ED466E352; Mon, 18 Sep 2017 12:35:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0041.outbound.protection.outlook.com [104.47.42.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB62F6E0C6; Mon, 18 Sep 2017 12:35:35 +0000 (UTC) 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=YcSlwPnMtN+FgFRh6GzpfY2CbhkU7HMvmyzmPCBrHQo=; b=tEhN4Dlmjgjd2Jr7ha0zq/gvnsFvbHyjf6QlIA4GBmCKLEeMAHcshsZoNNlkvAYv3mIDg9avuTUWpeVJJZAAg2AHm8eNS1/Cg6KlsIGAKerVJd4+2FRouWBBbDyyC+LWyNEHqjJi0l+IFBYLymmOB/bsXMA1lxFuCG+gSuKjckI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tom.StDenis@amd.com; Received: from fx8.amd.com (165.204.55.251) by DM5PR1201MB0074.namprd12.prod.outlook.com (10.174.106.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.8; Mon, 18 Sep 2017 12:35:34 +0000 From: Tom St Denis To: amd-gfx@lists.freedesktop.org Subject: [PATCH 1/4] drm/amd/amdgpu: Fold TTM debugfs entries into array Date: Mon, 18 Sep 2017 08:35:25 -0400 Message-Id: <20170918123528.26629-2-tom.stdenis@amd.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170918123528.26629-1-tom.stdenis@amd.com> References: <20170918123528.26629-1-tom.stdenis@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: MWHPR1401CA0007.namprd14.prod.outlook.com (10.174.253.145) To DM5PR1201MB0074.namprd12.prod.outlook.com (10.174.106.16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 59e2589c-e22e-4ce6-3e31-08d4fe91c234 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR1201MB0074; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0074; 3:+zRNkgv/uzAIDxrGCmFg+lBH5uWU4Y9X4A0XBprMOnQak92PUWfByw9B44CZUXec6C2t9HCmYCCunh3fKIgLv1H0SJ+F1KkwjtB0Ao+0cIjARUo/chxd2DG8Y41dAno2GRB7tW+iQ1CfMo5dWg6MRV0GGVnYVpLOtKQYKblQJHkIt++ma00STxl5o0cwUZ7Sa3J/ABmhGDy72/VgharB69DbZgHT5zY47Z6PgA3xGICLEx7aHkGv07igLf+5Xmhn; 25:6ZctcoPIdvU+JvC4Yuj/wq8IqwKdXR/ERaZVYULpWzPwBvEquIgzoED2bYkMVCmTi4NfJTYKQrburm0yr5woHWK2QOwkzQlOvl447Cq8DCo6bHoo3YMNbw+6drED+qnaRlXoc8o8nJPb84Voub7XcI1GyaufK691OH1dIOmeKT0j8zE1dPnd1xw6Spbi7o2dGgj3ygfBS09O3iSbJ5uc1wUGIVVM3YCul1yJxUQ3Foh1sF3nA30J5iXhun6cYqBzeXRDvJSNbYxpvs0vJ1yRiogeUr/u83MG0HYMoz+5E1hXTvLxnLngRM84Q+kM4V9D25q3bBUHmRd92dVbH16v6w==; 31:szkUZ/SWrepM2WAU++vZSV5L431ZsjTwKusxFUFxgS6QXGWbn2ZdS0/Ce0Y90p1ChtmaXg76RaU48c2lyVaeRkAOxE0H8Qp25keLC/qbIAfqv8Wpnvys1/kW6iu9Zx6vF4HK9FOicRdFOsdcHY9AI/sy9p1LTYLrkeojdklTdgXMyp9Yjc03F0ht0xAvrSbA14fKgqfgFgBtF9mec8a/FDIrwkyoctgkuByVUt7GZrY= X-MS-TrafficTypeDiagnostic: DM5PR1201MB0074: X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0074; 20:HKhGJgjWK2awLMhrSo+8cYObinl8Rbhe8K8ZA1mZ1z/EoDULWKrO7DrUsJ/PcIvLra15L4a8hYknFKY+BKuNUtdKCTRqNi32XO3CiYGlTiKnltTsCx58tXAD8rbO+HmWI84IWEBbeRbBtN3pxp/0PyR38mSnmfeNXTdcjQG39B3SgfDo7nyIj2MMx2oMnL4VLZQYQKtryDo9v0viKsB9uEgXd1tK4jguAb/bfkxtugRphQj8JFgAEnjxZGNTq6KF2HhKsRhbPlYf/uVEbGZjEoOT/Zr/rQUXHCHI6k1iOkn1qsvXoji7sevVquEKqTnIEUB4m+YdLZxeeZn4oK1G4U1ABwqBt0eT64TXIEgwEPpDIiTVIrbu74F3qjbxX3v+XvabYX/anp+rm4d6Cyy+d1vrMg99ssRPJ+OTwiRmV6DRyekg8gEZejJR0av0b3JXpIsJVErSEW/y3UKxYpIiNd1RZvQ08ZE2x5xx8l/G8W7myEpxBd4nCTQC7W0vBt/j; 4:6CsLywVgL7nkXddvFv9ehhyhfIVv8kNZDiwRQnsgeQbwDDQNlA9FtAzYhlQgpW/WYdduJsELF6QUYnZMKEHNmGqk1CKZkMqakYa4Dij9KuuVvjOl0p0RS26hwMxtsMvUg1QcZD4FF16ZCfNUWSnFle9uTLYpC32H4wzQmDVye1q2aEHaVG67vYqkl0j0URdyFMGPuNEEhYr3zaI1C8EtNJgA+A9DesgwMtQNWXxwQjpkWTIBTVjQWD/XvLLTRiZg7Lnz+nCqAZv27rrh6AQoxPXvKMoVb2amSM/60zdtpsM= X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123564025)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR1201MB0074; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR1201MB0074; X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(39860400002)(376002)(199003)(189002)(101416001)(81156014)(2950100002)(53936002)(4326008)(16526017)(316002)(6486002)(6916009)(86362001)(6666003)(8676002)(7736002)(2906002)(66066001)(189998001)(305945005)(81166006)(110136004)(16586007)(97736004)(5660300001)(36756003)(2351001)(76176999)(68736007)(72206003)(25786009)(450100002)(50466002)(50226002)(3846002)(6116002)(33646002)(48376002)(47776003)(5003940100001)(478600001)(50986999)(8936002)(106356001)(1076002)(105586002)(53416004)(2361001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0074; H:fx8.amd.com; 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: =?us-ascii?Q?1; DM5PR1201MB0074; 23:x5eA3VVOmN0xu3OkvDT6bQBuXKCnNbGd9GB+8Fz?= =?us-ascii?Q?vqMcdGs9bIXS5R7yrgKC3RmvZWLICAW1mcaEsx5oya3ymr12naA6Dj5usSaZ?= =?us-ascii?Q?utDi1LfjwxKvl3bCBEQWjoqC66Y7mXuoFVHWD4pHKFFXUfbIR9VJU7YVqOYW?= =?us-ascii?Q?anACPV/7V9VJw11O1whKOtWoPGJf2d/6sIinmCtEvxHEhos08Xt8wdHUBrSs?= =?us-ascii?Q?M/g16Enmgaasi71ZeTyFNw8OFWgAGJrXw92/TM9EtV9N1MPAUTqKesKaRzZb?= =?us-ascii?Q?oNrBe/AlzR83sIr5aKJqaqAYdArnXI4+fBiLzSW0ZrY52PdmAsSaDxFKYaYd?= =?us-ascii?Q?Kv3WUytHgZdOQXX0M97Zl44EFlIfqXcqIh3IOYBr30r8mpXWYyDKknOogh9N?= =?us-ascii?Q?dovPO1c8kjk4UISGpYasXqb2KnLlCyy5WJal3jiYH4KEOwpOi18vTX9lrSg1?= =?us-ascii?Q?Ja21zEb47A3Cl7z6rAwd1uFV+PjLMtLi+KHlj480fPg5wPwHtXQQ3lcBggS2?= =?us-ascii?Q?Ex4vOpxq7tKdszaIiXkJIL07RGJfcs4PyH0Umr2UIoBirU75yi7mNrSWH5Dl?= =?us-ascii?Q?2gZNIccCsS/2et3ulPKpDysRZ51GYGVBO1WfvXNuP9mFHj+RzIVjRdQq8nbp?= =?us-ascii?Q?n6y/ui61cPxxxjhN3e9FJA4PWyHyNFZsTJuW0di0syxLzJMC/Ws1vuzrBZwT?= =?us-ascii?Q?JpYQVGXLPNsGgRcQBnMYOxW2DalRwxRb7m2ySltEN7e3CKRWRQu0IfyIdGzS?= =?us-ascii?Q?5yp9KQBOJ0Wpvwn03T1HrL2DgkWWio0s68m6EjWh5C+6HuWnqQQ43B0KhEWP?= =?us-ascii?Q?uDfk/aO++z1/3DekXZFeNp+8kdOYZXk+Z8INXga9nSJFFTQuHQXfY8bBmmSJ?= =?us-ascii?Q?nZqFs+Wf1hANooJyE6Xw8IM1uYJDq52HqJRGces7IZBRgmbwvU1TNkypbGlL?= =?us-ascii?Q?c04FIGdl/lVOJPAy070esOjWw4DuszSXr7xDgvtZtbHuejlQYskwLziUYNFW?= =?us-ascii?Q?A1Idu/YUWULoUwuEjcL5Yv99oUXxAaojtJmZ5JoHyTb1getDGJApnEj++o8m?= =?us-ascii?Q?CiKj6h5zZqZQcCuC0rOFE/X8QyZimlnqzO93GoQgST+LwtjHOylAcVAQd9c2?= =?us-ascii?Q?mDYDbZE6j9Af3+Phsjcb7x3+GXZHLDCCbcM0W5CGZ5Usk/lf7sUUv6p7633a?= =?us-ascii?Q?UcwuhfR7zFeLoqS0q4YQb4F4LOqL/w2hgTgUC?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0074; 6:SXS+y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kSQsFYL+BMeH7c9g+XYu4V47sVN2m35DxYvCqmZSrbYggEWQ6wYs21pcFQJi/kPt7L2aSQHeZJmwd6ShzfhiIuGphn+3czlNzu9lob91v+59OJdzC X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 12:35:34.1436 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0074 Cc: Tom St Denis , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tom St Denis --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 53 ++++++++++++++++++--------------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 4 +-- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 8ee16dfdb8af..7848ffa99eb4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -1809,6 +1809,18 @@ static const struct file_operations amdgpu_ttm_gtt_fops = { #endif + + +static const struct { + char *name; + const struct file_operations *fops; +} ttm_debugfs_entries[] = { + { "amdgpu_vram", &amdgpu_ttm_vram_fops }, +#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS + { "amdgpu_gtt", &amdgpu_ttm_gtt_fops }, +#endif +}; + #endif static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) @@ -1819,22 +1831,21 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) struct drm_minor *minor = adev->ddev->primary; struct dentry *ent, *root = minor->debugfs_root; - ent = debugfs_create_file("amdgpu_vram", S_IFREG | S_IRUGO, root, - adev, &amdgpu_ttm_vram_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); - i_size_write(ent->d_inode, adev->mc.mc_vram_size); - adev->mman.vram = ent; - -#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS - ent = debugfs_create_file("amdgpu_gtt", S_IFREG | S_IRUGO, root, - adev, &amdgpu_ttm_gtt_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); - i_size_write(ent->d_inode, adev->mc.gart_size); - adev->mman.gtt = ent; + for (count = 0; count < ARRAY_SIZE(ttm_debugfs_entries); count++) { + ent = debugfs_create_file( + ttm_debugfs_entries[count].name, + S_IFREG | S_IRUGO, root, + adev, + ttm_debugfs_entries[count].fops); + if (IS_ERR(ent)) + return PTR_ERR(ent); + if (!strcmp(ttm_debugfs_entries[count].name, "amdgpu_vram")) + i_size_write(ent->d_inode, adev->mc.mc_vram_size); + else if (!strcmp(ttm_debugfs_entries[count].name, "amdgpu_gtt")) + i_size_write(ent->d_inode, adev->mc.gart_size); + adev->mman.debugfs_entries[count] = ent; + } -#endif count = ARRAY_SIZE(amdgpu_ttm_debugfs_list); #ifdef CONFIG_SWIOTLB @@ -1844,7 +1855,6 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) return amdgpu_debugfs_add_files(adev, amdgpu_ttm_debugfs_list, count); #else - return 0; #endif } @@ -1852,14 +1862,9 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev) { #if defined(CONFIG_DEBUG_FS) + unsigned i; - debugfs_remove(adev->mman.vram); - adev->mman.vram = NULL; - -#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS - debugfs_remove(adev->mman.gtt); - adev->mman.gtt = NULL; -#endif - + for (i = 0; i < ARRAY_SIZE(ttm_debugfs_entries); i++) + debugfs_remove(adev->mman.debugfs_entries[i]); #endif } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index 64709e041d5b..7abae6867339 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h @@ -24,6 +24,7 @@ #ifndef __AMDGPU_TTM_H__ #define __AMDGPU_TTM_H__ +#include "amdgpu.h" #include "gpu_scheduler.h" #define AMDGPU_PL_GDS (TTM_PL_PRIV + 0) @@ -45,8 +46,7 @@ struct amdgpu_mman { bool initialized; #if defined(CONFIG_DEBUG_FS) - struct dentry *vram; - struct dentry *gtt; + struct dentry *debugfs_entries[8]; #endif /* buffer handling */