diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/pmu_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index 177e3525..eb62caaf 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | |||
@@ -170,11 +170,22 @@ static void set_pmu_cmdline_args_falctracesize_v1( | |||
170 | pmu->args_v1.falc_trace_size = size; | 170 | pmu->args_v1.falc_trace_size = size; |
171 | } | 171 | } |
172 | 172 | ||
173 | int find_hex_in_string(char *strings, struct gk20a *g) | ||
174 | { | ||
175 | u32 i = 0, j = strlen(strings); | ||
176 | for (; i < j; i++) { | ||
177 | if (strings[i] == '%') | ||
178 | if (strings[i + 1] == 'x' || strings[i + 1] == 'X') | ||
179 | return i; | ||
180 | } | ||
181 | return 0xFF; | ||
182 | } | ||
173 | 183 | ||
174 | void printtrace(struct pmu_gk20a *pmu) | 184 | void printtrace(struct pmu_gk20a *pmu) |
175 | { | 185 | { |
176 | u32 i = 0, j = 0; | 186 | u32 i = 0, j = 0, k, l, m, count; |
177 | char *trace = pmu->trace_buf.cpuva; | 187 | char *trace = pmu->trace_buf.cpuva; |
188 | char part_str[40], buf[0x40]; | ||
178 | u32 *trace1 = pmu->trace_buf.cpuva; | 189 | u32 *trace1 = pmu->trace_buf.cpuva; |
179 | struct gk20a *g = gk20a_from_pmu(pmu); | 190 | struct gk20a *g = gk20a_from_pmu(pmu); |
180 | gk20a_err(dev_from_gk20a(g), "Dump pmutrace"); | 191 | gk20a_err(dev_from_gk20a(g), "Dump pmutrace"); |
@@ -184,13 +195,21 @@ void printtrace(struct pmu_gk20a *pmu) | |||
184 | break; | 195 | break; |
185 | if (j == 0x40) | 196 | if (j == 0x40) |
186 | return; | 197 | return; |
187 | gk20a_err(dev_from_gk20a(g), "Index %d: ", | 198 | count = scnprintf(buf, 0x40, "Index %x: ", trace1[(i / 4)]); |
188 | trace1[(i / 4)]); | 199 | k = find_hex_in_string((trace+i+20), g); |
189 | gk20a_err(dev_from_gk20a(g), | 200 | l = 0; |
190 | "Params: 0x%x 0x%x 0x%x 0x%x Message: ", | 201 | m = 0; |
191 | trace1[(i / 4) + 1], trace1[(i / 4) + 2], | 202 | while (k < 0xFF) { |
192 | trace1[(i / 4) + 3], trace1[(i / 4) + 4]); | 203 | strncpy(part_str, (trace+i+20+m), k); |
193 | gk20a_err(dev_from_gk20a(g), "%s", (trace+i+20)); | 204 | part_str[k] = 0; |
205 | count += scnprintf((buf + count), 0x40, "%s0x%x", | ||
206 | part_str, trace1[(i / 4) + 1 + l]); | ||
207 | l++; | ||
208 | m += k + 2; | ||
209 | k = find_hex_in_string((trace+i+20+m), g); | ||
210 | } | ||
211 | count += scnprintf((buf + count), 0x40, "%s", (trace+i+20+m)); | ||
212 | gk20a_err(dev_from_gk20a(g), "%s", buf); | ||
194 | } | 213 | } |
195 | } | 214 | } |
196 | 215 | ||
@@ -3979,8 +3998,9 @@ static int falc_trace_show(struct seq_file *s, void *data) | |||
3979 | { | 3998 | { |
3980 | struct gk20a *g = s->private; | 3999 | struct gk20a *g = s->private; |
3981 | struct pmu_gk20a *pmu = &g->pmu; | 4000 | struct pmu_gk20a *pmu = &g->pmu; |
3982 | u32 i = 0, j = 0; | 4001 | u32 i = 0, j = 0, k, l, m; |
3983 | char *trace = pmu->trace_buf.cpuva; | 4002 | char *trace = pmu->trace_buf.cpuva; |
4003 | char part_str[40]; | ||
3984 | u32 *trace1 = pmu->trace_buf.cpuva; | 4004 | u32 *trace1 = pmu->trace_buf.cpuva; |
3985 | for (i = 0; i < GK20A_PMU_TRACE_BUFSIZE; i += 0x40) { | 4005 | for (i = 0; i < GK20A_PMU_TRACE_BUFSIZE; i += 0x40) { |
3986 | for (j = 0; j < 0x40; j++) | 4006 | for (j = 0; j < 0x40; j++) |
@@ -3989,10 +4009,19 @@ static int falc_trace_show(struct seq_file *s, void *data) | |||
3989 | if (j == 0x40) | 4009 | if (j == 0x40) |
3990 | return 0; | 4010 | return 0; |
3991 | seq_printf(s, "Index %x: ", trace1[(i / 4)]); | 4011 | seq_printf(s, "Index %x: ", trace1[(i / 4)]); |
3992 | seq_printf(s, "Params: 0x%x 0x%x 0x%x 0x%x Message: ", | 4012 | k = find_hex_in_string((trace+i+20), g); |
3993 | trace1[(i / 4) + 1], trace1[(i / 4) + 2], | 4013 | l = 0; |
3994 | trace1[(i / 4) + 3], trace1[(i / 4) + 4]); | 4014 | m = 0; |
3995 | seq_printf(s, "%s", (trace+i+20)); | 4015 | while (k < 0xFF) { |
4016 | strncpy(part_str, (trace+i+20+m), k); | ||
4017 | part_str[k] = 0; | ||
4018 | seq_printf(s, "%s0x%x", part_str, | ||
4019 | trace1[(i / 4) + 1 + l]); | ||
4020 | l++; | ||
4021 | m += k + 2; | ||
4022 | k = find_hex_in_string((trace+i+20+m), g); | ||
4023 | } | ||
4024 | seq_printf(s, "%s", (trace+i+20+m)); | ||
3996 | } | 4025 | } |
3997 | return 0; | 4026 | return 0; |
3998 | } | 4027 | } |