aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0079-drm-amd-display-drop-register-logger-and-pid-tgid-ge.patch
blob: c385e4b50429faff963a9ab2006e073ee3a60640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
From 81582a138f5882b15fa34b0739897a5cd0d0f1a2 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Tue, 13 Dec 2016 16:41:07 +1000
Subject: [PATCH 0079/4131] drm/amd/display: drop register logger and pid/tgid
 getters

While I'm sure this is useful I think we should bring it back later.

It's usage of pid/tgid is incorrect, you have to get/put
pid/tgids not store them away.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c |  10 --
 drivers/gpu/drm/amd/display/dc/basics/Makefile     |   2 +-
 .../drm/amd/display/dc/basics/register_logger.c    | 197 ---------------------
 drivers/gpu/drm/amd/display/dc/dm_services.h       |  16 --
 .../drm/amd/display/include/dal_register_logger.h  |  42 -----
 5 files changed, 1 insertion(+), 266 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/basics/register_logger.c
 delete mode 100644 drivers/gpu/drm/amd/display/include/dal_register_logger.h

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
index 9c852a3..565be05 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
@@ -447,13 +447,3 @@ void dal_notify_setmode_complete(struct dc_context *ctx,
 	/*TODO*/
 }
 /* End of calls to notification */
-
-long dm_get_pid(void)
-{
-	return current->pid;
-}
-
-long dm_get_tgid(void)
-{
-	return current->tgid;
-}
diff --git a/drivers/gpu/drm/amd/display/dc/basics/Makefile b/drivers/gpu/drm/amd/display/dc/basics/Makefile
index a263cad..0658162 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/basics/Makefile
@@ -4,7 +4,7 @@
 # subcomponents.
 
 BASICS = conversion.o fixpt31_32.o fixpt32_32.o grph_object_id.o \
-	logger.o log_helpers.o register_logger.o signal_types.o vector.o
+	logger.o log_helpers.o signal_types.o vector.o
 
 AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
 
diff --git a/drivers/gpu/drm/amd/display/dc/basics/register_logger.c b/drivers/gpu/drm/amd/display/dc/basics/register_logger.c
deleted file mode 100644
index b8d57d9..0000000
--- a/drivers/gpu/drm/amd/display/dc/basics/register_logger.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright 2012-15 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: AMD
- *
- */
-
-#include "dm_services.h"
-#include "include/dal_types.h"
-#include "include/logger_interface.h"
-#include "logger.h"
-
-/******************************************************************************
- * Register Logger.
- * A facility to create register R/W logs.
- * Currently used for DAL Test.
- *****************************************************************************/
-
-/******************************************************************************
- * Private structures
- *****************************************************************************/
-struct dal_reg_dump_stack_location {
-	const char *current_caller_func;
-	long current_pid;
-	long current_tgid;
-	uint32_t rw_count;/* register access counter for current function. */
-};
-
-/* This the maximum number of nested calls to the 'reg_dump' facility. */
-#define DAL_REG_DUMP_STACK_MAX_SIZE 32
-
-struct dal_reg_dump_stack {
-	int32_t stack_pointer;
-	struct dal_reg_dump_stack_location
-		stack_locations[DAL_REG_DUMP_STACK_MAX_SIZE];
-	uint32_t total_rw_count; /* Total count for *all* functions. */
-};
-
-static struct dal_reg_dump_stack reg_dump_stack = {0};
-
-/******************************************************************************
- * Private functions
- *****************************************************************************/
-
-/* Check if current process is the one which requested register dump.
- * The reason for the check:
- * mmCRTC_STATUS_FRAME_COUNT is accessed by dal_controller_get_vblank_counter().
- * Which runs all the time when at least one display is connected.
- * (Triggered by drm_mode_page_flip_ioctl()). */
-static bool is_reg_dump_process(void)
-{
-	uint32_t i;
-
-	/* walk the list of our processes */
-	for (i = 0; i < reg_dump_stack.stack_pointer; i++) {
-		struct dal_reg_dump_stack_location *stack_location
-					= &reg_dump_stack.stack_locations[i];
-
-		if (stack_location->current_pid == dm_get_pid()
-			&& stack_location->current_tgid == dm_get_tgid())
-			return true;
-	}
-
-	return false;
-}
-
-static bool dal_reg_dump_stack_is_empty(void)
-{
-	if (reg_dump_stack.stack_pointer <= 0)
-		return true;
-	else
-		return false;
-}
-
-static struct dal_reg_dump_stack_location *dal_reg_dump_stack_push(void)
-{
-	struct dal_reg_dump_stack_location *current_location = NULL;
-
-	if (reg_dump_stack.stack_pointer >= DAL_REG_DUMP_STACK_MAX_SIZE) {
-		/* stack is full */
-		dm_output_to_console("[REG_DUMP]: %s: stack is full!\n",
-				__func__);
-	} else {
-		current_location =
-		&reg_dump_stack.stack_locations[reg_dump_stack.stack_pointer];
-		++reg_dump_stack.stack_pointer;
-	}
-
-	return current_location;
-}
-
-static struct dal_reg_dump_stack_location *dal_reg_dump_stack_pop(void)
-{
-	struct dal_reg_dump_stack_location *current_location = NULL;
-
-	if (dal_reg_dump_stack_is_empty()) {
-		/* stack is empty */
-		dm_output_to_console("[REG_DUMP]: %s: stack is empty!\n",
-				__func__);
-	} else {
-		--reg_dump_stack.stack_pointer;
-		current_location =
-		&reg_dump_stack.stack_locations[reg_dump_stack.stack_pointer];
-	}
-
-	return current_location;
-}
-
-/******************************************************************************
- * Public functions
- *****************************************************************************/
-
-void dal_reg_logger_push(const char *caller_func)
-{
-	struct dal_reg_dump_stack_location *free_stack_location;
-
-	free_stack_location = dal_reg_dump_stack_push();
-
-	if (NULL == free_stack_location)
-		return;
-
-	memset(free_stack_location, 0, sizeof(*free_stack_location));
-
-	free_stack_location->current_caller_func = caller_func;
-	free_stack_location->current_pid = dm_get_pid();
-	free_stack_location->current_tgid = dm_get_tgid();
-
-	dm_output_to_console("[REG_DUMP]:%s - start (pid:%ld, tgid:%ld)\n",
-		caller_func,
-		free_stack_location->current_pid,
-		free_stack_location->current_tgid);
-}
-
-void dal_reg_logger_pop(void)
-{
-	struct dal_reg_dump_stack_location *top_stack_location;
-
-	top_stack_location = dal_reg_dump_stack_pop();
-
-	if (NULL == top_stack_location) {
-		dm_output_to_console("[REG_DUMP]:%s - Stack is Empty!\n",
-				__func__);
-		return;
-	}
-
-	dm_output_to_console(
-	"[REG_DUMP]:%s - end."\
-	" Reg R/W Count: Total=%d Function=%d. (pid:%ld, tgid:%ld)\n",
-			top_stack_location->current_caller_func,
-			reg_dump_stack.total_rw_count,
-			top_stack_location->rw_count,
-			dm_get_pid(),
-			dm_get_tgid());
-
-	memset(top_stack_location, 0, sizeof(*top_stack_location));
-}
-
-void dal_reg_logger_rw_count_increment(void)
-{
-	++reg_dump_stack.total_rw_count;
-
-	++reg_dump_stack.stack_locations
-		[reg_dump_stack.stack_pointer - 1].rw_count;
-}
-
-bool dal_reg_logger_should_dump_register(void)
-{
-	if (true == dal_reg_dump_stack_is_empty())
-		return false;
-
-	if (false == is_reg_dump_process())
-		return false;
-
-	return true;
-}
-
-/******************************************************************************
- * End of File.
- *****************************************************************************/
diff --git a/drivers/gpu/drm/amd/display/dc/dm_services.h b/drivers/gpu/drm/amd/display/dc/dm_services.h
index 7a3f103..f3f9a401 100644
--- a/drivers/gpu/drm/amd/display/dc/dm_services.h
+++ b/drivers/gpu/drm/amd/display/dc/dm_services.h
@@ -109,12 +109,6 @@ static inline uint32_t dm_read_reg_func(
 
 	value = cgs_read_register(ctx->cgs_device, address);
 
-#if defined(__DAL_REGISTER_LOGGER__)
-	if (true == dal_reg_logger_should_dump_register()) {
-		dal_reg_logger_rw_count_increment();
-		DRM_INFO("%s DC_READ_REG: 0x%x 0x%x\n", func_name, address, value);
-	}
-#endif
 	return value;
 }
 
@@ -127,13 +121,6 @@ static inline void dm_write_reg_func(
 	uint32_t value,
 	const char *func_name)
 {
-#if defined(__DAL_REGISTER_LOGGER__)
-	if (true == dal_reg_logger_should_dump_register()) {
-		dal_reg_logger_rw_count_increment();
-		DRM_INFO("%s DC_WRITE_REG: 0x%x 0x%x\n", func_name, address, value);
-	}
-#endif
-
 	if (address == 0) {
 		DC_ERR("invalid register write. address = 0");
 		return;
@@ -418,7 +405,4 @@ bool dm_dmcu_set_pipe(struct dc_context *ctx, unsigned int controller_id);
 #define dm_log_to_buffer(buffer, size, fmt, args)\
 	vsnprintf(buffer, size, fmt, args)
 
-long dm_get_pid(void);
-long dm_get_tgid(void);
-
 #endif /* __DM_SERVICES_H__ */
diff --git a/drivers/gpu/drm/amd/display/include/dal_register_logger.h b/drivers/gpu/drm/amd/display/include/dal_register_logger.h
deleted file mode 100644
index 00dfcd7..0000000
--- a/drivers/gpu/drm/amd/display/include/dal_register_logger.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2012-15 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: AMD
- *
- */
-
-#ifndef __DAL_REGISTER_LOGGER__
-#define __DAL_REGISTER_LOGGER__
-
-/****************
- * API functions
- ***************/
-
-/* dal_reg_logger_push - begin Register Logging */
-void dal_reg_logger_push(const char *caller_func);
-/* dal_reg_logger_pop - stop Register Logging */
-void dal_reg_logger_pop(void);
-
-/* for internal use of the Logger only */
-void dal_reg_logger_rw_count_increment(void);
-bool dal_reg_logger_should_dump_register(void);
-
-#endif /* __DAL_REGISTER_LOGGER__ */
-- 
2.7.4