diff --git a/drivers/gpu/nvgpu/common/gr/gr_priv.h b/drivers/gpu/nvgpu/common/gr/gr_priv.h index 274770d2f..01b2f290f 100644 --- a/drivers/gpu/nvgpu/common/gr/gr_priv.h +++ b/drivers/gpu/nvgpu/common/gr/gr_priv.h @@ -81,7 +81,6 @@ struct nvgpu_gr { u32 fbp_en_mask; u32 *fbp_rop_l2_en_mask; - u32 max_css_buffer_size; u32 max_ctxsw_ring_buffer_size; struct nvgpu_mutex ctxsw_disable_mutex; diff --git a/drivers/gpu/nvgpu/common/perf/cyclestats_snapshot.c b/drivers/gpu/nvgpu/common/perf/cyclestats_snapshot.c index bf6fc83d5..9178f2079 100644 --- a/drivers/gpu/nvgpu/common/perf/cyclestats_snapshot.c +++ b/drivers/gpu/nvgpu/common/perf/cyclestats_snapshot.c @@ -599,3 +599,8 @@ int nvgpu_css_check_data_available(struct channel_gk20a *ch, u32 *pending, *hw_overflow = nvgpu_css_get_overflow_status(g); return 0; } + +u32 nvgpu_css_get_max_buffer_size(struct gk20a *g) +{ + return 0xffffffffU; +} diff --git a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c index 62963fc18..d5ff40c38 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c @@ -728,6 +728,7 @@ static const struct gpu_ops vgpu_gp10b_ops = { .set_handled_snapshots = NULL, .allocate_perfmon_ids = NULL, .release_perfmon_ids = NULL, + .get_max_buffer_size = vgpu_css_get_buffer_size, }, #endif .priv_ring = { diff --git a/drivers/gpu/nvgpu/common/vgpu/gr/gr_vgpu.c b/drivers/gpu/nvgpu/common/vgpu/gr/gr_vgpu.c index 6c81f15aa..5b59582b7 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gr/gr_vgpu.c +++ b/drivers/gpu/nvgpu/common/vgpu/gr/gr_vgpu.c @@ -1231,14 +1231,15 @@ void vgpu_gr_init_cyclestats(struct gk20a *g) { #if defined(CONFIG_GK20A_CYCLE_STATS) bool snapshots_supported = true; + u32 max_css_buffer_size; /* cyclestats not supported on vgpu */ nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, false); - g->gr->max_css_buffer_size = vgpu_css_get_buffer_size(g); + max_css_buffer_size = vgpu_css_get_buffer_size(g); /* snapshots not supported if the buffer size is 0 */ - if (g->gr->max_css_buffer_size == 0) { + if (max_css_buffer_size == 0) { snapshots_supported = false; } diff --git a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c index 0ea64822f..8cc9bcfe9 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c @@ -825,6 +825,7 @@ static const struct gpu_ops vgpu_gv11b_ops = { .set_handled_snapshots = NULL, .allocate_perfmon_ids = NULL, .release_perfmon_ids = NULL, + .get_max_buffer_size = vgpu_css_get_buffer_size, }, #endif .priv_ring = { diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c index 27eec3965..0d410c404 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c @@ -492,7 +492,6 @@ void 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); - g->gr->max_css_buffer_size = 0xffffffffU; #else (void)g; #endif diff --git a/drivers/gpu/nvgpu/hal/init/hal_gm20b.c b/drivers/gpu/nvgpu/hal/init/hal_gm20b.c index d5c3fa5b8..1e9569d04 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gm20b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gm20b.c @@ -1029,6 +1029,7 @@ static const struct gpu_ops gm20b_ops = { .release_perfmon_ids = nvgpu_css_release_perfmon_ids, .get_overflow_status = nvgpu_css_get_overflow_status, .get_pending_snapshots = nvgpu_css_get_pending_snapshots, + .get_max_buffer_size = nvgpu_css_get_max_buffer_size, }, #endif .falcon = { diff --git a/drivers/gpu/nvgpu/hal/init/hal_gp10b.c b/drivers/gpu/nvgpu/hal/init/hal_gp10b.c index f2e7e181f..971610d0c 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gp10b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gp10b.c @@ -1109,6 +1109,7 @@ static const struct gpu_ops gp10b_ops = { .release_perfmon_ids = nvgpu_css_release_perfmon_ids, .get_overflow_status = nvgpu_css_get_overflow_status, .get_pending_snapshots = nvgpu_css_get_pending_snapshots, + .get_max_buffer_size = nvgpu_css_get_max_buffer_size, }, #endif .falcon = { diff --git a/drivers/gpu/nvgpu/hal/init/hal_gv100.c b/drivers/gpu/nvgpu/hal/init/hal_gv100.c index 6a6ba0612..9e11a46d2 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gv100.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gv100.c @@ -1312,6 +1312,7 @@ static const struct gpu_ops gv100_ops = { .release_perfmon_ids = nvgpu_css_release_perfmon_ids, .get_overflow_status = nvgpu_css_get_overflow_status, .get_pending_snapshots = nvgpu_css_get_pending_snapshots, + .get_max_buffer_size = nvgpu_css_get_max_buffer_size, }, #endif .xve = { diff --git a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c index 8320255ad..973f976a2 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c @@ -1299,6 +1299,7 @@ static const struct gpu_ops gv11b_ops = { .release_perfmon_ids = nvgpu_css_release_perfmon_ids, .get_overflow_status = nvgpu_css_get_overflow_status, .get_pending_snapshots = nvgpu_css_get_pending_snapshots, + .get_max_buffer_size = nvgpu_css_get_max_buffer_size, }, #endif .falcon = { diff --git a/drivers/gpu/nvgpu/hal/init/hal_tu104.c b/drivers/gpu/nvgpu/hal/init/hal_tu104.c index c2407a8df..03bab4c37 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_tu104.c +++ b/drivers/gpu/nvgpu/hal/init/hal_tu104.c @@ -1357,6 +1357,7 @@ static const struct gpu_ops tu104_ops = { .release_perfmon_ids = nvgpu_css_release_perfmon_ids, .get_overflow_status = nvgpu_css_get_overflow_status, .get_pending_snapshots = nvgpu_css_get_pending_snapshots, + .get_max_buffer_size = nvgpu_css_get_max_buffer_size, }, #endif .xve = { diff --git a/drivers/gpu/nvgpu/include/nvgpu/cyclestats_snapshot.h b/drivers/gpu/nvgpu/include/nvgpu/cyclestats_snapshot.h index 97e076ba3..6beea09d3 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/cyclestats_snapshot.h +++ b/drivers/gpu/nvgpu/include/nvgpu/cyclestats_snapshot.h @@ -162,4 +162,6 @@ int nvgpu_css_flush(struct channel_gk20a *ch, void nvgpu_free_cyclestats_snapshot_data(struct gk20a *g); +u32 nvgpu_css_get_max_buffer_size(struct gk20a *g); + #endif /* CYCLESTATS_SNAPSHOT_H */ diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index 65ff6e972..a9a1ebf55 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -1646,6 +1646,7 @@ struct gpu_ops { struct gk20a_cs_snapshot_client *client); bool (*get_overflow_status)(struct gk20a *g); u32 (*get_pending_snapshots)(struct gk20a *g); + u32 (*get_max_buffer_size)(struct gk20a *g); } css; #endif struct { diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index 091256984..1ef00257a 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c @@ -336,7 +336,7 @@ gk20a_ctrl_ioctl_gpu_characteristics( gpu.sm_arch_spa_version = g->params.sm_arch_spa_version; gpu.sm_arch_warp_count = g->params.sm_arch_warp_count; - gpu.max_css_buffer_size = g->gr->max_css_buffer_size; + gpu.max_css_buffer_size = g->ops.css.get_max_buffer_size(g);; gpu.max_ctxsw_ring_buffer_size = g->gr->max_ctxsw_ring_buffer_size; gpu.gpu_ioctl_nr_last = NVGPU_GPU_IOCTL_LAST;