forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
....@@ -1,24 +1,17 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
2
- *
3
- * This program is free software; you can redistribute it and/or modify
4
- * it under the terms of the GNU General Public License version 2 and
5
- * only version 2 as published by the Free Software Foundation.
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
11
- *
123 */
13
-
144
155 #include <linux/types.h>
166 #include <linux/debugfs.h>
7
+
8
+#include <drm/drm_debugfs.h>
9
+#include <drm/drm_file.h>
1710 #include <drm/drm_print.h>
1811
1912 #include "a5xx_gpu.h"
2013
21
-static int pfp_print(struct msm_gpu *gpu, struct drm_printer *p)
14
+static void pfp_print(struct msm_gpu *gpu, struct drm_printer *p)
2215 {
2316 int i;
2417
....@@ -29,11 +22,9 @@
2922 drm_printf(p, " %02x: %08x\n", i,
3023 gpu_read(gpu, REG_A5XX_CP_PFP_STAT_DATA));
3124 }
32
-
33
- return 0;
3425 }
3526
36
-static int me_print(struct msm_gpu *gpu, struct drm_printer *p)
27
+static void me_print(struct msm_gpu *gpu, struct drm_printer *p)
3728 {
3829 int i;
3930
....@@ -44,11 +35,9 @@
4435 drm_printf(p, " %02x: %08x\n", i,
4536 gpu_read(gpu, REG_A5XX_CP_ME_STAT_DATA));
4637 }
47
-
48
- return 0;
4938 }
5039
51
-static int meq_print(struct msm_gpu *gpu, struct drm_printer *p)
40
+static void meq_print(struct msm_gpu *gpu, struct drm_printer *p)
5241 {
5342 int i;
5443
....@@ -59,11 +48,9 @@
5948 drm_printf(p, " %02x: %08x\n", i,
6049 gpu_read(gpu, REG_A5XX_CP_MEQ_DBG_DATA));
6150 }
62
-
63
- return 0;
6451 }
6552
66
-static int roq_print(struct msm_gpu *gpu, struct drm_printer *p)
53
+static void roq_print(struct msm_gpu *gpu, struct drm_printer *p)
6754 {
6855 int i;
6956
....@@ -78,8 +65,6 @@
7865 drm_printf(p, " %02x: %08x %08x %08x %08x\n", i,
7966 val[0], val[1], val[2], val[3]);
8067 }
81
-
82
- return 0;
8368 }
8469
8570 static int show(struct seq_file *m, void *arg)
....@@ -88,10 +73,11 @@
8873 struct drm_device *dev = node->minor->dev;
8974 struct msm_drm_private *priv = dev->dev_private;
9075 struct drm_printer p = drm_seq_file_printer(m);
91
- int (*show)(struct msm_gpu *gpu, struct drm_printer *p) =
76
+ void (*show)(struct msm_gpu *gpu, struct drm_printer *p) =
9277 node->info_ent->data;
9378
94
- return show(priv->gpu, &p);
79
+ show(priv->gpu, &p);
80
+ return 0;
9581 }
9682
9783 #define ENT(n) { .name = #n, .show = show, .data = n ##_print }
....@@ -130,16 +116,14 @@
130116 adreno_gpu->fw[ADRENO_FW_PFP] = NULL;
131117
132118 if (a5xx_gpu->pm4_bo) {
133
- if (a5xx_gpu->pm4_iova)
134
- msm_gem_put_iova(a5xx_gpu->pm4_bo, gpu->aspace);
135
- drm_gem_object_unreference(a5xx_gpu->pm4_bo);
119
+ msm_gem_unpin_iova(a5xx_gpu->pm4_bo, gpu->aspace);
120
+ drm_gem_object_put_locked(a5xx_gpu->pm4_bo);
136121 a5xx_gpu->pm4_bo = NULL;
137122 }
138123
139124 if (a5xx_gpu->pfp_bo) {
140
- if (a5xx_gpu->pfp_iova)
141
- msm_gem_put_iova(a5xx_gpu->pfp_bo, gpu->aspace);
142
- drm_gem_object_unreference(a5xx_gpu->pfp_bo);
125
+ msm_gem_unpin_iova(a5xx_gpu->pfp_bo, gpu->aspace);
126
+ drm_gem_object_put_locked(a5xx_gpu->pfp_bo);
143127 a5xx_gpu->pfp_bo = NULL;
144128 }
145129
....@@ -157,31 +141,19 @@
157141 DEFINE_SIMPLE_ATTRIBUTE(reset_fops, NULL, reset_set, "%llx\n");
158142
159143
160
-int a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor)
144
+void a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor)
161145 {
162146 struct drm_device *dev;
163
- struct dentry *ent;
164
- int ret;
165147
166148 if (!minor)
167
- return 0;
149
+ return;
168150
169151 dev = minor->dev;
170152
171
- ret = drm_debugfs_create_files(a5xx_debugfs_list,
172
- ARRAY_SIZE(a5xx_debugfs_list),
173
- minor->debugfs_root, minor);
153
+ drm_debugfs_create_files(a5xx_debugfs_list,
154
+ ARRAY_SIZE(a5xx_debugfs_list),
155
+ minor->debugfs_root, minor);
174156
175
- if (ret) {
176
- dev_err(dev->dev, "could not install a5xx_debugfs_list\n");
177
- return ret;
178
- }
179
-
180
- ent = debugfs_create_file("reset", S_IWUGO,
181
- minor->debugfs_root,
182
- dev, &reset_fops);
183
- if (!ent)
184
- return -ENOMEM;
185
-
186
- return 0;
157
+ debugfs_create_file("reset", S_IWUGO, minor->debugfs_root, dev,
158
+ &reset_fops);
187159 }