aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0458-drm-amd-amdgpu-Enable-ability-to-print-register-stat.patch
blob: a2e6a8f1f16cb3aa064676bc494d4d7a79c95cda (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
From 0f09539c772af43949b4358c6b45fe30a9b14861 Mon Sep 17 00:00:00 2001
From: Tom St Denis <tom.stdenis@amd.com>
Date: Mon, 28 Mar 2016 08:21:52 -0400
Subject: [PATCH 0458/1110] drm/amd/amdgpu: Enable ability to print register
 status

Added file "amdgpu_print_status" to debugfs and you can
cat it to have the dmesg log populated with register values
from various IP blocks.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 42 ++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 9663d17..f03fa47 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -47,6 +47,8 @@
 
 static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
 static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);
+static int amdgpu_debugfs_status_init(struct amdgpu_device *adev);
+
 
 static const char *amdgpu_asic_name[] = {
 	"BONAIRE",
@@ -1110,6 +1112,15 @@ const struct amdgpu_ip_block_version * amdgpu_get_ip_block(
 	return NULL;
 }
 
+void amdgpu_print_status(struct amdgpu_device *adev)
+{
+	int i;
+
+	for (i = 0; i < adev->num_ip_blocks; i++)
+		if (adev->ip_blocks[i].funcs->print_status)
+			adev->ip_blocks[i].funcs->print_status(adev);
+}
+
 /**
  * amdgpu_ip_block_version_cmp
  *
@@ -1258,6 +1269,8 @@ static int amdgpu_init(struct amdgpu_device *adev)
 		adev->ip_block_status[i].hw = true;
 	}
 
+	amdgpu_debugfs_status_init(adev);
+
 	return 0;
 }
 
@@ -2162,3 +2175,32 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
 }
 static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev) { }
 #endif
+
+/*
+ * Status debugfs
+ */
+#if defined(CONFIG_DEBUG_FS)
+static int amdgpu_debugfs_print_status(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *)m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct amdgpu_device *adev = dev->dev_private;
+
+	amdgpu_print_status(adev);
+
+	return 0;
+}
+
+static struct drm_info_list amdgpu_debugfs_status_list[] = {
+	{"amdgpu_print_status", &amdgpu_debugfs_print_status, 0, NULL},
+};
+#endif
+
+static int amdgpu_debugfs_status_init(struct amdgpu_device *adev)
+{
+#if defined(CONFIG_DEBUG_FS)
+	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_status_list, 1);
+#else
+	return 0;
+#endif
+}
-- 
2.7.4