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>
This commit is contained in:
Vaibhav Kachore
2018-08-20 15:25:06 +05:30
committed by mobile promotions
parent eb97fc52a9
commit 064ba6a7ef
3 changed files with 66 additions and 11 deletions

View File

@@ -308,27 +308,27 @@ static int gk20a_fecs_trace_ring_read(struct gk20a *g, int index)
entry.tag, entry.timestamp, r->context_id,
r->new_context_id);
switch (entry.tag) {
case NVGPU_CTXSW_TAG_RESTORE_START:
case NVGPU_CTXSW_TAG_CONTEXT_START:
switch (nvgpu_gpu_ctxsw_tags_to_common_tags(entry.tag)) {
case NVGPU_GPU_CTXSW_TAG_RESTORE_START:
case NVGPU_GPU_CTXSW_TAG_CONTEXT_START:
entry.context_id = r->new_context_id;
entry.pid = new_pid;
break;
case NVGPU_CTXSW_TAG_CTXSW_REQ_BY_HOST:
case NVGPU_CTXSW_TAG_FE_ACK:
case NVGPU_CTXSW_TAG_FE_ACK_WFI:
case NVGPU_CTXSW_TAG_FE_ACK_GFXP:
case NVGPU_CTXSW_TAG_FE_ACK_CTAP:
case NVGPU_CTXSW_TAG_FE_ACK_CILP:
case NVGPU_CTXSW_TAG_SAVE_END:
case NVGPU_GPU_CTXSW_TAG_CTXSW_REQ_BY_HOST:
case NVGPU_GPU_CTXSW_TAG_FE_ACK:
case NVGPU_GPU_CTXSW_TAG_FE_ACK_WFI:
case NVGPU_GPU_CTXSW_TAG_FE_ACK_GFXP:
case NVGPU_GPU_CTXSW_TAG_FE_ACK_CTAP:
case NVGPU_GPU_CTXSW_TAG_FE_ACK_CILP:
case NVGPU_GPU_CTXSW_TAG_SAVE_END:
entry.context_id = r->context_id;
entry.pid = cur_pid;
break;
default:
/* tags are not guaranteed to start at the beginning */
WARN_ON(entry.tag && (entry.tag != NVGPU_CTXSW_TAG_INVALID_TIMESTAMP));
WARN_ON(entry.tag && (entry.tag != NVGPU_GPU_CTXSW_TAG_INVALID_TIMESTAMP));
continue;
}

View File

@@ -29,6 +29,21 @@ struct gk20a;
struct tsg_gk20a;
struct channel_gk20a;
#define NVGPU_GPU_CTXSW_TAG_SOF 0x00
#define NVGPU_GPU_CTXSW_TAG_CTXSW_REQ_BY_HOST 0x01
#define NVGPU_GPU_CTXSW_TAG_FE_ACK 0x02
#define NVGPU_GPU_CTXSW_TAG_FE_ACK_WFI 0x0a
#define NVGPU_GPU_CTXSW_TAG_FE_ACK_GFXP 0x0b
#define NVGPU_GPU_CTXSW_TAG_FE_ACK_CTAP 0x0c
#define NVGPU_GPU_CTXSW_TAG_FE_ACK_CILP 0x0d
#define NVGPU_GPU_CTXSW_TAG_SAVE_END 0x03
#define NVGPU_GPU_CTXSW_TAG_RESTORE_START 0x04
#define NVGPU_GPU_CTXSW_TAG_CONTEXT_START 0x05
#define NVGPU_GPU_CTXSW_TAG_ENGINE_RESET 0xfe
#define NVGPU_GPU_CTXSW_TAG_INVALID_TIMESTAMP 0xff
#define NVGPU_GPU_CTXSW_TAG_LAST \
NVGPU_GPU_CTXSW_TAG_INVALID_TIMESTAMP
/*
* The binary format of 'struct nvgpu_gpu_ctxsw_trace_entry' introduced here
* 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);
int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, struct vm_area_struct *vma);
#endif
u8 nvgpu_gpu_ctxsw_tags_to_common_tags(u8 tags);
#endif

View File

@@ -743,3 +743,41 @@ void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg)
#endif
trace_gk20a_channel_reset(~0, tsg->tsgid);
}
/*
* 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_*
*/
u8 nvgpu_gpu_ctxsw_tags_to_common_tags(u8 tags)
{
switch (tags){
case NVGPU_CTXSW_TAG_SOF:
return NVGPU_GPU_CTXSW_TAG_SOF;
case NVGPU_CTXSW_TAG_CTXSW_REQ_BY_HOST:
return NVGPU_GPU_CTXSW_TAG_CTXSW_REQ_BY_HOST;
case NVGPU_CTXSW_TAG_FE_ACK:
return NVGPU_GPU_CTXSW_TAG_FE_ACK;
case NVGPU_CTXSW_TAG_FE_ACK_WFI:
return NVGPU_GPU_CTXSW_TAG_FE_ACK_WFI;
case NVGPU_CTXSW_TAG_FE_ACK_GFXP:
return NVGPU_GPU_CTXSW_TAG_FE_ACK_GFXP;
case NVGPU_CTXSW_TAG_FE_ACK_CTAP:
return NVGPU_GPU_CTXSW_TAG_FE_ACK_CTAP;
case NVGPU_CTXSW_TAG_FE_ACK_CILP:
return NVGPU_GPU_CTXSW_TAG_FE_ACK_CILP;
case NVGPU_CTXSW_TAG_SAVE_END:
return NVGPU_GPU_CTXSW_TAG_SAVE_END;
case NVGPU_CTXSW_TAG_RESTORE_START:
return NVGPU_GPU_CTXSW_TAG_RESTORE_START;
case NVGPU_CTXSW_TAG_CONTEXT_START:
return NVGPU_GPU_CTXSW_TAG_CONTEXT_START;
case NVGPU_CTXSW_TAG_ENGINE_RESET:
return NVGPU_GPU_CTXSW_TAG_ENGINE_RESET;
case NVGPU_CTXSW_TAG_INVALID_TIMESTAMP:
return NVGPU_GPU_CTXSW_TAG_INVALID_TIMESTAMP;
}
WARN_ON(1);
return tags;
}