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:24 -0400
commitead314881633c128905c6aaeb5b6e4bf0cc1bb17 (patch)
treedb2ddac898dfe67ca1d3bd3cd8d2397a95f9aa17 /drivers/gpu/nvgpu/vgpu/gr_vgpu.c
parent843bbc726c7283666a18d9ff899350e0cef18330 (diff)
gpu: nvgpu: vgpu: add getting gr constants
move below attributes to constants: TEGRA_VGPU_ATTRIB_GPC_COUNT TEGRA_VGPU_ATTRIB_MAX_TPC_PER_GPC_COUNT TEGRA_VGPU_ATTRIB_MAX_TPC_COUNT TEGRA_VGPU_ATTRIB_NUM_FBPS TEGRA_VGPU_ATTRIB_FBP_EN_MASK TEGRA_VGPU_ATTRIB_MAX_LTC_PER_FBP TEGRA_VGPU_ATTRIB_MAX_LTS_PER_LTC JIRA VFND-2103 Change-Id: Ic2ac14a0f8a1cf19a996bcef20bef0003d3b9a3b Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: http://git-master/r/1194630 Reviewed-by: Automatic_Commit_Validation_User 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.c53
1 files changed, 15 insertions, 38 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index a2af0162..a5345764 100644
--- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -631,29 +631,22 @@ static u32 vgpu_gr_get_gpc_tpc_count(struct gk20a *g, u32 gpc_index)
631 631
632static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) 632static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
633{ 633{
634 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
634 u32 gpc_index; 635 u32 gpc_index;
635 636
636 gk20a_dbg_fn(""); 637 gk20a_dbg_fn("");
637 638
638 if (vgpu_get_attribute(vgpu_get_handle(g), 639 gr->max_gpc_count = priv->constants.max_gpc_count;
639 TEGRA_VGPU_ATTRIB_GPC_COUNT, &gr->gpc_count)) 640 gr->gpc_count = priv->constants.gpc_count;
640 return -ENOMEM; 641 gr->max_tpc_per_gpc_count = priv->constants.max_tpc_per_gpc_count;
641
642 if (vgpu_get_attribute(vgpu_get_handle(g),
643 TEGRA_VGPU_ATTRIB_MAX_TPC_PER_GPC_COUNT,
644 &gr->max_tpc_per_gpc_count))
645 return -ENOMEM;
646
647 if (vgpu_get_attribute(vgpu_get_handle(g),
648 TEGRA_VGPU_ATTRIB_MAX_TPC_COUNT,
649 &gr->max_tpc_count))
650 return -ENOMEM;
651 642
652 if (vgpu_get_attribute(vgpu_get_handle(g), 643 if (vgpu_get_attribute(vgpu_get_handle(g),
653 TEGRA_VGPU_ATTRIB_TPC_COUNT, 644 TEGRA_VGPU_ATTRIB_TPC_COUNT,
654 &gr->tpc_count)) 645 &gr->tpc_count))
655 return -ENOMEM; 646 return -ENOMEM;
656 647
648 gr->max_tpc_count = gr->max_gpc_count * gr->max_tpc_per_gpc_count;
649
657 gr->gpc_tpc_count = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); 650 gr->gpc_tpc_count = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL);
658 if (!gr->gpc_tpc_count) 651 if (!gr->gpc_tpc_count)
659 goto cleanup; 652 goto cleanup;
@@ -682,7 +675,7 @@ static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
682 g->ops.gr.init_fs_state(g); 675 g->ops.gr.init_fs_state(g);
683 return 0; 676 return 0;
684cleanup: 677cleanup:
685 gk20a_err(dev_from_gk20a(g), "%s: out of memory\n", __func__); 678 gk20a_err(dev_from_gk20a(g), "%s: out of memory", __func__);
686 679
687 kfree(gr->gpc_tpc_count); 680 kfree(gr->gpc_tpc_count);
688 gr->gpc_tpc_count = NULL; 681 gr->gpc_tpc_count = NULL;
@@ -759,54 +752,38 @@ static u32 vgpu_gr_get_gpc_tpc_mask(struct gk20a *g, u32 gpc_index)
759 752
760static u32 vgpu_gr_get_max_fbps_count(struct gk20a *g) 753static u32 vgpu_gr_get_max_fbps_count(struct gk20a *g)
761{ 754{
762 u32 max_fbps_count = 0; 755 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
763 756
764 gk20a_dbg_fn(""); 757 gk20a_dbg_fn("");
765 758
766 if (vgpu_get_attribute(vgpu_get_handle(g), 759 return priv->constants.num_fbps;
767 TEGRA_VGPU_ATTRIB_NUM_FBPS, &max_fbps_count))
768 gk20a_err(dev_from_gk20a(g), "failed to retrieve num fbps");
769
770 return max_fbps_count;
771} 760}
772 761
773static u32 vgpu_gr_get_fbp_en_mask(struct gk20a *g) 762static u32 vgpu_gr_get_fbp_en_mask(struct gk20a *g)
774{ 763{
775 u32 fbp_en_mask = 0; 764 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
776 765
777 gk20a_dbg_fn(""); 766 gk20a_dbg_fn("");
778 767
779 if (vgpu_get_attribute(vgpu_get_handle(g), 768 return priv->constants.fbp_en_mask;
780 TEGRA_VGPU_ATTRIB_FBP_EN_MASK, &fbp_en_mask))
781 gk20a_err(dev_from_gk20a(g), "failed to retrieve fbp en mask");
782
783 return fbp_en_mask;
784} 769}
785 770
786static u32 vgpu_gr_get_max_ltc_per_fbp(struct gk20a *g) 771static u32 vgpu_gr_get_max_ltc_per_fbp(struct gk20a *g)
787{ 772{
788 u32 val = 0; 773 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
789 774
790 gk20a_dbg_fn(""); 775 gk20a_dbg_fn("");
791 776
792 if (vgpu_get_attribute(vgpu_get_handle(g), 777 return priv->constants.ltc_per_fbp;
793 TEGRA_VGPU_ATTRIB_MAX_LTC_PER_FBP, &val))
794 gk20a_err(dev_from_gk20a(g), "failed to retrieve max ltc per fbp");
795
796 return val;
797} 778}
798 779
799static u32 vgpu_gr_get_max_lts_per_ltc(struct gk20a *g) 780static u32 vgpu_gr_get_max_lts_per_ltc(struct gk20a *g)
800{ 781{
801 u32 val = 0; 782 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
802 783
803 gk20a_dbg_fn(""); 784 gk20a_dbg_fn("");
804 785
805 if (vgpu_get_attribute(vgpu_get_handle(g), 786 return priv->constants.max_lts_per_ltc;
806 TEGRA_VGPU_ATTRIB_MAX_LTS_PER_LTC, &val))
807 gk20a_err(dev_from_gk20a(g), "failed to retrieve lts per ltc");
808
809 return val;
810} 787}
811 788
812static u32 *vgpu_gr_rop_l2_en_mask(struct gk20a *g) 789static u32 *vgpu_gr_rop_l2_en_mask(struct gk20a *g)