From cddf69c549c5c6fb2c69e4620636e96c698a4201 Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Tue, 7 Nov 2017 16:05:58 -0800 Subject: gpu: nvgpu: vgpu: cyclestat characteristics fixes Fix characteristics for cyclestats: - SUPPORT_TSG and SUPPORT_CYCLE_STATS_SNAPSHOT were assigned the same value - For vgpu, SUPPORT_CYCLE_STATS was set redundantly (but differently) - For vgpu, if the css buffer size is 0, set the support flag to False JIRA ESRM-88 Bug 200296210 Change-Id: Iaf98dafec55f171b5968c2a8248290284bf30922 Signed-off-by: Peter Daifuku Reviewed-on: https://git-master.nvidia.com/r/1593939 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Konsta Holtta Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/enabled.h | 18 +++++++++--------- drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c | 14 ++++++++++++-- drivers/gpu/nvgpu/vgpu/vgpu.c | 1 - 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h index 82f9e6d2..f2b5dbf7 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h +++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h @@ -78,28 +78,28 @@ struct gk20a; /* NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT is available */ #define NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT 33 /* Both gpu driver and device support TSG */ -#define NVGPU_SUPPORT_TSG 33 +#define NVGPU_SUPPORT_TSG 34 /* Fast deterministic submits with no job tracking are supported */ -#define NVGPU_SUPPORT_DETERMINISTIC_SUBMIT_NO_JOBTRACKING 34 +#define NVGPU_SUPPORT_DETERMINISTIC_SUBMIT_NO_JOBTRACKING 35 /* Deterministic submits are supported even with job tracking */ -#define NVGPU_SUPPORT_DETERMINISTIC_SUBMIT_FULL 35 +#define NVGPU_SUPPORT_DETERMINISTIC_SUBMIT_FULL 36 /* NVGPU_SUBMIT_GPFIFO_FLAGS_RESCHEDULE_RUNLIST is available */ -#define NVGPU_SUPPORT_RESCHEDULE_RUNLIST 36 +#define NVGPU_SUPPORT_RESCHEDULE_RUNLIST 37 /* NVGPU_GPU_IOCTL_GET_EVENT_FD is available */ -#define NVGPU_SUPPORT_DEVICE_EVENTS 37 +#define NVGPU_SUPPORT_DEVICE_EVENTS 38 /* FECS context switch tracing is available */ -#define NVGPU_SUPPORT_FECS_CTXSW_TRACE 38 +#define NVGPU_SUPPORT_FECS_CTXSW_TRACE 39 /* NVGPU_GPU_IOCTL_SET_DETERMINISTIC_OPTS is available */ -#define NVGPU_SUPPORT_DETERMINISTIC_OPTS 39 +#define NVGPU_SUPPORT_DETERMINISTIC_OPTS 40 /* * Security flags */ -#define NVGPU_SEC_SECUREGPCCS 40 -#define NVGPU_SEC_PRIVSECURITY 41 +#define NVGPU_SEC_SECUREGPCCS 41 +#define NVGPU_SEC_PRIVSECURITY 42 /* * PMU flags. diff --git a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c index 56b1edbc..fca6525a 100644 --- a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c +++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c @@ -30,10 +30,20 @@ void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g) { #if defined(CONFIG_GK20A_CYCLE_STATS) - __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, true); - __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT, true); + bool snapshots_supported = true; + + /* cyclestats not supported on vgpu */ + __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, false); + g->gpu_characteristics.max_css_buffer_size = vgpu_css_get_buffer_size(g); + + /* snapshots not supported if the buffer size is 0 */ + if (g->gpu_characteristics.max_css_buffer_size == 0) + snapshots_supported = false; + + __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT, + snapshots_supported); #endif } diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index 2cd99e8c..c753fd97 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c @@ -371,7 +371,6 @@ int vgpu_init_gpu_characteristics(struct gk20a *g) g->gpu_characteristics.map_buffer_batch_limit = 0; /* features vgpu does not support */ - __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, false); __nvgpu_set_enabled(g, NVGPU_SUPPORT_RESCHEDULE_RUNLIST, false); return 0; -- cgit v1.2.2