summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2016-07-26 20:48:58 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-08-15 14:41:25 -0400
commitdeffbf8ee2017d4ea804f35946673dd0f6e0fcf2 (patch)
tree811b5d8a5da49d27a6581301772df54eacc8a55a /drivers/gpu/nvgpu/vgpu/gr_vgpu.c
parentead314881633c128905c6aaeb5b6e4bf0cc1bb17 (diff)
gpu: nvgpu: vgpu: get constants of gpc_tpc_count/mask arrays
It'll cover multi-gpcs. JIRA VFND-2103 Change-Id: Ie82bdaad360294696c5a679d694f6f0e2364ca2e Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: http://git-master/r/1194631 GVS: Gerrit_Virtual_Submit Reviewed-by: Vladislav Buzov <vbuzov@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/gr_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index a5345764..87faa2f2 100644
--- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -617,18 +617,6 @@ static int vgpu_gr_free_obj_ctx(struct channel_gk20a *c,
617 return 0; 617 return 0;
618} 618}
619 619
620static u32 vgpu_gr_get_gpc_tpc_count(struct gk20a *g, u32 gpc_index)
621{
622 u32 data;
623
624 WARN_ON(gpc_index > 0);
625
626 if (vgpu_get_attribute(vgpu_get_handle(g),
627 TEGRA_VGPU_ATTRIB_GPC0_TPC_COUNT, &data))
628 gk20a_err(dev_from_gk20a(g), "failed to retrieve gpc0_tpc_count");
629 return data;
630}
631
632static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) 620static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
633{ 621{
634 struct vgpu_priv_data *priv = vgpu_get_priv_data(g); 622 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
@@ -640,11 +628,6 @@ static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
640 gr->gpc_count = priv->constants.gpc_count; 628 gr->gpc_count = priv->constants.gpc_count;
641 gr->max_tpc_per_gpc_count = priv->constants.max_tpc_per_gpc_count; 629 gr->max_tpc_per_gpc_count = priv->constants.max_tpc_per_gpc_count;
642 630
643 if (vgpu_get_attribute(vgpu_get_handle(g),
644 TEGRA_VGPU_ATTRIB_TPC_COUNT,
645 &gr->tpc_count))
646 return -ENOMEM;
647
648 gr->max_tpc_count = gr->max_gpc_count * gr->max_tpc_per_gpc_count; 631 gr->max_tpc_count = gr->max_gpc_count * gr->max_tpc_per_gpc_count;
649 632
650 gr->gpc_tpc_count = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); 633 gr->gpc_tpc_count = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL);
@@ -660,9 +643,12 @@ static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
660 if (!gr->sm_to_cluster) 643 if (!gr->sm_to_cluster)
661 goto cleanup; 644 goto cleanup;
662 645
646 gr->tpc_count = 0;
663 for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) { 647 for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) {
664 gr->gpc_tpc_count[gpc_index] = 648 gr->gpc_tpc_count[gpc_index] =
665 vgpu_gr_get_gpc_tpc_count(g, gpc_index); 649 priv->constants.gpc_tpc_count[gpc_index];
650
651 gr->tpc_count += gr->gpc_tpc_count[gpc_index];
666 652
667 if (g->ops.gr.get_gpc_tpc_mask) 653 if (g->ops.gr.get_gpc_tpc_mask)
668 gr->gpc_tpc_mask[gpc_index] = 654 gr->gpc_tpc_mask[gpc_index] =
@@ -739,15 +725,9 @@ static int vgpu_gr_get_zcull_info(struct gk20a *g, struct gr_gk20a *gr,
739 725
740static u32 vgpu_gr_get_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) 726static u32 vgpu_gr_get_gpc_tpc_mask(struct gk20a *g, u32 gpc_index)
741{ 727{
742 u32 data; 728 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
743
744 WARN_ON(gpc_index > 0);
745
746 if (vgpu_get_attribute(vgpu_get_handle(g),
747 TEGRA_VGPU_ATTRIB_GPC0_TPC_MASK, &data))
748 gk20a_err(dev_from_gk20a(g), "failed to retrieve gpc0_tpc_mask");
749 729
750 return data; 730 return priv->constants.gpc_tpc_mask[gpc_index];
751} 731}
752 732
753static u32 vgpu_gr_get_max_fbps_count(struct gk20a *g) 733static u32 vgpu_gr_get_max_fbps_count(struct gk20a *g)