gpu: nvgpu: add CSS hal to get max buffer size

Currently max_css_buffer_size is incorrectly stored in struct nvgpu_gr

Add a new hal g->ops.css.get_max_buffer_size() to get the size and
remove the variable from struct nvgpu_gr

Jira NVGPU-3125

Change-Id: If78fd86559526b84031051e281a98327a46fc11d
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2105652
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2019-04-25 14:30:51 +05:30
committed by mobile promotions
parent a0da2dee0f
commit c474f7c288
14 changed files with 19 additions and 5 deletions

View File

@@ -81,7 +81,6 @@ struct nvgpu_gr {
u32 fbp_en_mask; u32 fbp_en_mask;
u32 *fbp_rop_l2_en_mask; u32 *fbp_rop_l2_en_mask;
u32 max_css_buffer_size;
u32 max_ctxsw_ring_buffer_size; u32 max_ctxsw_ring_buffer_size;
struct nvgpu_mutex ctxsw_disable_mutex; struct nvgpu_mutex ctxsw_disable_mutex;

View File

@@ -599,3 +599,8 @@ int nvgpu_css_check_data_available(struct channel_gk20a *ch, u32 *pending,
*hw_overflow = nvgpu_css_get_overflow_status(g); *hw_overflow = nvgpu_css_get_overflow_status(g);
return 0; return 0;
} }
u32 nvgpu_css_get_max_buffer_size(struct gk20a *g)
{
return 0xffffffffU;
}

View File

@@ -728,6 +728,7 @@ static const struct gpu_ops vgpu_gp10b_ops = {
.set_handled_snapshots = NULL, .set_handled_snapshots = NULL,
.allocate_perfmon_ids = NULL, .allocate_perfmon_ids = NULL,
.release_perfmon_ids = NULL, .release_perfmon_ids = NULL,
.get_max_buffer_size = vgpu_css_get_buffer_size,
}, },
#endif #endif
.priv_ring = { .priv_ring = {

View File

@@ -1231,14 +1231,15 @@ void vgpu_gr_init_cyclestats(struct gk20a *g)
{ {
#if defined(CONFIG_GK20A_CYCLE_STATS) #if defined(CONFIG_GK20A_CYCLE_STATS)
bool snapshots_supported = true; bool snapshots_supported = true;
u32 max_css_buffer_size;
/* cyclestats not supported on vgpu */ /* cyclestats not supported on vgpu */
nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, false); 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 */ /* 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; snapshots_supported = false;
} }

View File

@@ -825,6 +825,7 @@ static const struct gpu_ops vgpu_gv11b_ops = {
.set_handled_snapshots = NULL, .set_handled_snapshots = NULL,
.allocate_perfmon_ids = NULL, .allocate_perfmon_ids = NULL,
.release_perfmon_ids = NULL, .release_perfmon_ids = NULL,
.get_max_buffer_size = vgpu_css_get_buffer_size,
}, },
#endif #endif
.priv_ring = { .priv_ring = {

View File

@@ -492,7 +492,6 @@ void gr_gm20b_init_cyclestats(struct gk20a *g)
#if defined(CONFIG_GK20A_CYCLE_STATS) #if defined(CONFIG_GK20A_CYCLE_STATS)
nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, true);
nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT, true);
g->gr->max_css_buffer_size = 0xffffffffU;
#else #else
(void)g; (void)g;
#endif #endif

View File

@@ -1029,6 +1029,7 @@ static const struct gpu_ops gm20b_ops = {
.release_perfmon_ids = nvgpu_css_release_perfmon_ids, .release_perfmon_ids = nvgpu_css_release_perfmon_ids,
.get_overflow_status = nvgpu_css_get_overflow_status, .get_overflow_status = nvgpu_css_get_overflow_status,
.get_pending_snapshots = nvgpu_css_get_pending_snapshots, .get_pending_snapshots = nvgpu_css_get_pending_snapshots,
.get_max_buffer_size = nvgpu_css_get_max_buffer_size,
}, },
#endif #endif
.falcon = { .falcon = {

View File

@@ -1109,6 +1109,7 @@ static const struct gpu_ops gp10b_ops = {
.release_perfmon_ids = nvgpu_css_release_perfmon_ids, .release_perfmon_ids = nvgpu_css_release_perfmon_ids,
.get_overflow_status = nvgpu_css_get_overflow_status, .get_overflow_status = nvgpu_css_get_overflow_status,
.get_pending_snapshots = nvgpu_css_get_pending_snapshots, .get_pending_snapshots = nvgpu_css_get_pending_snapshots,
.get_max_buffer_size = nvgpu_css_get_max_buffer_size,
}, },
#endif #endif
.falcon = { .falcon = {

View File

@@ -1312,6 +1312,7 @@ static const struct gpu_ops gv100_ops = {
.release_perfmon_ids = nvgpu_css_release_perfmon_ids, .release_perfmon_ids = nvgpu_css_release_perfmon_ids,
.get_overflow_status = nvgpu_css_get_overflow_status, .get_overflow_status = nvgpu_css_get_overflow_status,
.get_pending_snapshots = nvgpu_css_get_pending_snapshots, .get_pending_snapshots = nvgpu_css_get_pending_snapshots,
.get_max_buffer_size = nvgpu_css_get_max_buffer_size,
}, },
#endif #endif
.xve = { .xve = {

View File

@@ -1299,6 +1299,7 @@ static const struct gpu_ops gv11b_ops = {
.release_perfmon_ids = nvgpu_css_release_perfmon_ids, .release_perfmon_ids = nvgpu_css_release_perfmon_ids,
.get_overflow_status = nvgpu_css_get_overflow_status, .get_overflow_status = nvgpu_css_get_overflow_status,
.get_pending_snapshots = nvgpu_css_get_pending_snapshots, .get_pending_snapshots = nvgpu_css_get_pending_snapshots,
.get_max_buffer_size = nvgpu_css_get_max_buffer_size,
}, },
#endif #endif
.falcon = { .falcon = {

View File

@@ -1357,6 +1357,7 @@ static const struct gpu_ops tu104_ops = {
.release_perfmon_ids = nvgpu_css_release_perfmon_ids, .release_perfmon_ids = nvgpu_css_release_perfmon_ids,
.get_overflow_status = nvgpu_css_get_overflow_status, .get_overflow_status = nvgpu_css_get_overflow_status,
.get_pending_snapshots = nvgpu_css_get_pending_snapshots, .get_pending_snapshots = nvgpu_css_get_pending_snapshots,
.get_max_buffer_size = nvgpu_css_get_max_buffer_size,
}, },
#endif #endif
.xve = { .xve = {

View File

@@ -162,4 +162,6 @@ int nvgpu_css_flush(struct channel_gk20a *ch,
void nvgpu_free_cyclestats_snapshot_data(struct gk20a *g); void nvgpu_free_cyclestats_snapshot_data(struct gk20a *g);
u32 nvgpu_css_get_max_buffer_size(struct gk20a *g);
#endif /* CYCLESTATS_SNAPSHOT_H */ #endif /* CYCLESTATS_SNAPSHOT_H */

View File

@@ -1646,6 +1646,7 @@ struct gpu_ops {
struct gk20a_cs_snapshot_client *client); struct gk20a_cs_snapshot_client *client);
bool (*get_overflow_status)(struct gk20a *g); bool (*get_overflow_status)(struct gk20a *g);
u32 (*get_pending_snapshots)(struct gk20a *g); u32 (*get_pending_snapshots)(struct gk20a *g);
u32 (*get_max_buffer_size)(struct gk20a *g);
} css; } css;
#endif #endif
struct { struct {

View File

@@ -336,7 +336,7 @@ gk20a_ctrl_ioctl_gpu_characteristics(
gpu.sm_arch_spa_version = g->params.sm_arch_spa_version; gpu.sm_arch_spa_version = g->params.sm_arch_spa_version;
gpu.sm_arch_warp_count = g->params.sm_arch_warp_count; 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.max_ctxsw_ring_buffer_size = g->gr->max_ctxsw_ring_buffer_size;
gpu.gpu_ioctl_nr_last = NVGPU_GPU_IOCTL_LAST; gpu.gpu_ioctl_nr_last = NVGPU_GPU_IOCTL_LAST;