summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorVaibhav Kachore <vkachore@nvidia.com>2018-08-20 05:55:06 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-08-31 15:16:10 -0400
commit064ba6a7ef236a7bb1085715c6ab37810f230bbf (patch)
tree007ab66696c49eda8dc02b1def57b69d3176dbc2 /drivers/gpu
parenteb97fc52a96887d9d85cbdc18eaa7d72eade43b2 (diff)
gpu: nvgpu: convert linux nvgpu ctxsw tags
Convert linux nvgpu ctxsw tags type of the form of NVGPU_CTXSW_TAG_* into common nvgpu ctxsw tags type of the form of NVGPU_GPU_CTXSW_TAG_* EVLR-3078 Change-Id: I337487722c103c05003457f74ad6e05bf3bd38fc Signed-off-by: Vaibhav Kachore <vkachore@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1803209 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c22
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/ctxsw_trace.h17
-rw-r--r--drivers/gpu/nvgpu/os/linux/ctxsw_trace.c38
3 files changed, 66 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
index 50077a62..e775c10b 100644
--- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
@@ -308,27 +308,27 @@ static int gk20a_fecs_trace_ring_read(struct gk20a *g, int index)
308 entry.tag, entry.timestamp, r->context_id, 308 entry.tag, entry.timestamp, r->context_id,
309 r->new_context_id); 309 r->new_context_id);
310 310
311 switch (entry.tag) { 311 switch (nvgpu_gpu_ctxsw_tags_to_common_tags(entry.tag)) {
312 case NVGPU_CTXSW_TAG_RESTORE_START: 312 case NVGPU_GPU_CTXSW_TAG_RESTORE_START:
313 case NVGPU_CTXSW_TAG_CONTEXT_START: 313 case NVGPU_GPU_CTXSW_TAG_CONTEXT_START:
314 entry.context_id = r->new_context_id; 314 entry.context_id = r->new_context_id;
315 entry.pid = new_pid; 315 entry.pid = new_pid;
316 break; 316 break;
317 317
318 case NVGPU_CTXSW_TAG_CTXSW_REQ_BY_HOST: 318 case NVGPU_GPU_CTXSW_TAG_CTXSW_REQ_BY_HOST:
319 case NVGPU_CTXSW_TAG_FE_ACK: 319 case NVGPU_GPU_CTXSW_TAG_FE_ACK:
320 case NVGPU_CTXSW_TAG_FE_ACK_WFI: 320 case NVGPU_GPU_CTXSW_TAG_FE_ACK_WFI:
321 case NVGPU_CTXSW_TAG_FE_ACK_GFXP: 321 case NVGPU_GPU_CTXSW_TAG_FE_ACK_GFXP:
322 case NVGPU_CTXSW_TAG_FE_ACK_CTAP: 322 case NVGPU_GPU_CTXSW_TAG_FE_ACK_CTAP:
323 case NVGPU_CTXSW_TAG_FE_ACK_CILP: 323 case NVGPU_GPU_CTXSW_TAG_FE_ACK_CILP:
324 case NVGPU_CTXSW_TAG_SAVE_END: 324 case NVGPU_GPU_CTXSW_TAG_SAVE_END:
325 entry.context_id = r->context_id; 325 entry.context_id = r->context_id;
326 entry.pid = cur_pid; 326 entry.pid = cur_pid;
327 break; 327 break;
328 328
329 default: 329 default:
330 /* tags are not guaranteed to start at the beginning */ 330 /* tags are not guaranteed to start at the beginning */
331 WARN_ON(entry.tag && (entry.tag != NVGPU_CTXSW_TAG_INVALID_TIMESTAMP)); 331 WARN_ON(entry.tag && (entry.tag != NVGPU_GPU_CTXSW_TAG_INVALID_TIMESTAMP));
332 continue; 332 continue;
333 } 333 }
334 334
diff --git a/drivers/gpu/nvgpu/include/nvgpu/ctxsw_trace.h b/drivers/gpu/nvgpu/include/nvgpu/ctxsw_trace.h
index 6e54d1cc..9dd6833f 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/ctxsw_trace.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/ctxsw_trace.h
@@ -29,6 +29,21 @@ struct gk20a;
29struct tsg_gk20a; 29struct tsg_gk20a;
30struct channel_gk20a; 30struct channel_gk20a;
31 31
32#define NVGPU_GPU_CTXSW_TAG_SOF 0x00
33#define NVGPU_GPU_CTXSW_TAG_CTXSW_REQ_BY_HOST 0x01
34#define NVGPU_GPU_CTXSW_TAG_FE_ACK 0x02
35#define NVGPU_GPU_CTXSW_TAG_FE_ACK_WFI 0x0a
36#define NVGPU_GPU_CTXSW_TAG_FE_ACK_GFXP 0x0b
37#define NVGPU_GPU_CTXSW_TAG_FE_ACK_CTAP 0x0c
38#define NVGPU_GPU_CTXSW_TAG_FE_ACK_CILP 0x0d
39#define NVGPU_GPU_CTXSW_TAG_SAVE_END 0x03
40#define NVGPU_GPU_CTXSW_TAG_RESTORE_START 0x04
41#define NVGPU_GPU_CTXSW_TAG_CONTEXT_START 0x05
42#define NVGPU_GPU_CTXSW_TAG_ENGINE_RESET 0xfe
43#define NVGPU_GPU_CTXSW_TAG_INVALID_TIMESTAMP 0xff
44#define NVGPU_GPU_CTXSW_TAG_LAST \
45 NVGPU_GPU_CTXSW_TAG_INVALID_TIMESTAMP
46
32/* 47/*
33 * The binary format of 'struct nvgpu_gpu_ctxsw_trace_entry' introduced here 48 * The binary format of 'struct nvgpu_gpu_ctxsw_trace_entry' introduced here
34 * should match that of 'struct nvgpu_ctxsw_trace_entry' defined in uapi 49 * should match that of 'struct nvgpu_ctxsw_trace_entry' defined in uapi
@@ -64,4 +79,6 @@ int gk20a_ctxsw_dev_ring_free(struct gk20a *g);
64int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, struct vm_area_struct *vma); 79int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, struct vm_area_struct *vma);
65#endif 80#endif
66 81
82u8 nvgpu_gpu_ctxsw_tags_to_common_tags(u8 tags);
83
67#endif 84#endif
diff --git a/drivers/gpu/nvgpu/os/linux/ctxsw_trace.c b/drivers/gpu/nvgpu/os/linux/ctxsw_trace.c
index a8f5f815..4983061b 100644
--- a/drivers/gpu/nvgpu/os/linux/ctxsw_trace.c
+++ b/drivers/gpu/nvgpu/os/linux/ctxsw_trace.c
@@ -743,3 +743,41 @@ void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg)
743#endif 743#endif
744 trace_gk20a_channel_reset(~0, tsg->tsgid); 744 trace_gk20a_channel_reset(~0, tsg->tsgid);
745} 745}
746
747/*
748 * Convert linux nvgpu ctxsw tags type of the form of NVGPU_CTXSW_TAG_*
749 * into common nvgpu ctxsw tags type of the form of NVGPU_GPU_CTXSW_TAG_*
750 */
751
752u8 nvgpu_gpu_ctxsw_tags_to_common_tags(u8 tags)
753{
754 switch (tags){
755 case NVGPU_CTXSW_TAG_SOF:
756 return NVGPU_GPU_CTXSW_TAG_SOF;
757 case NVGPU_CTXSW_TAG_CTXSW_REQ_BY_HOST:
758 return NVGPU_GPU_CTXSW_TAG_CTXSW_REQ_BY_HOST;
759 case NVGPU_CTXSW_TAG_FE_ACK:
760 return NVGPU_GPU_CTXSW_TAG_FE_ACK;
761 case NVGPU_CTXSW_TAG_FE_ACK_WFI:
762 return NVGPU_GPU_CTXSW_TAG_FE_ACK_WFI;
763 case NVGPU_CTXSW_TAG_FE_ACK_GFXP:
764 return NVGPU_GPU_CTXSW_TAG_FE_ACK_GFXP;
765 case NVGPU_CTXSW_TAG_FE_ACK_CTAP:
766 return NVGPU_GPU_CTXSW_TAG_FE_ACK_CTAP;
767 case NVGPU_CTXSW_TAG_FE_ACK_CILP:
768 return NVGPU_GPU_CTXSW_TAG_FE_ACK_CILP;
769 case NVGPU_CTXSW_TAG_SAVE_END:
770 return NVGPU_GPU_CTXSW_TAG_SAVE_END;
771 case NVGPU_CTXSW_TAG_RESTORE_START:
772 return NVGPU_GPU_CTXSW_TAG_RESTORE_START;
773 case NVGPU_CTXSW_TAG_CONTEXT_START:
774 return NVGPU_GPU_CTXSW_TAG_CONTEXT_START;
775 case NVGPU_CTXSW_TAG_ENGINE_RESET:
776 return NVGPU_GPU_CTXSW_TAG_ENGINE_RESET;
777 case NVGPU_CTXSW_TAG_INVALID_TIMESTAMP:
778 return NVGPU_GPU_CTXSW_TAG_INVALID_TIMESTAMP;
779 }
780
781 WARN_ON(1);
782 return tags;
783}