summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
diff options
context:
space:
mode:
authorAingara Paramakuru <aparamakuru@nvidia.com>2014-11-12 15:00:22 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:12:13 -0400
commit0cc118c08c30e54073e5b8729c859a08ddbe3785 (patch)
tree26adeaa2f81290bd6fe1300a5e779309afc07775 /drivers/gpu/nvgpu/vgpu/gr_vgpu.c
parent3fc88e50b84d13ff1e6ddaa910105d7e2f247c38 (diff)
gpu: nvgpu: vgpu: fix crash during init
gops->gr.detect_sm_arch was not populated for vgpu. Also, populate some members of the PMU VM struct as they are used to report GPU characteristics to userspace. Bug 1576949 Change-Id: I9ddc361d1418b942da97a82b553aac81f5f51182 Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com> Reviewed-on: http://git-master/r/601931 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/gr_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index 6f8baa4b..46b48b33 100644
--- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -583,6 +583,32 @@ static int vgpu_gr_get_zcull_info(struct gk20a *g, struct gr_gk20a *gr,
583 return 0; 583 return 0;
584} 584}
585 585
586static void vgpu_gr_detect_sm_arch(struct gk20a *g)
587{
588 struct gk20a_platform *platform = gk20a_get_platform(g->dev);
589 u32 v = 0, raw_version, version = 0;
590
591 gk20a_dbg_fn("");
592
593 if (vgpu_get_attribute(platform->virt_handle,
594 TEGRA_VGPU_ATTRIB_GPC0_TPC0_SM_ARCH, &v))
595 gk20a_err(dev_from_gk20a(g), "failed to retrieve SM arch");
596
597 raw_version = gr_gpc0_tpc0_sm_arch_spa_version_v(v);
598 if (raw_version == gr_gpc0_tpc0_sm_arch_spa_version_smkepler_lp_v())
599 version = 0x320; /* SM 3.2 */
600 else
601 gk20a_err(dev_from_gk20a(g), "Unknown SM version 0x%x",
602 raw_version);
603
604 /* on Kepler, SM version == SPA version */
605 g->gpu_characteristics.sm_arch_spa_version = version;
606 g->gpu_characteristics.sm_arch_sm_version = version;
607
608 g->gpu_characteristics.sm_arch_warp_count =
609 gr_gpc0_tpc0_sm_arch_warp_count_v(v);
610}
611
586static void vgpu_remove_gr_support(struct gr_gk20a *gr) 612static void vgpu_remove_gr_support(struct gr_gk20a *gr)
587{ 613{
588 gk20a_dbg_fn(""); 614 gk20a_dbg_fn("");
@@ -684,4 +710,5 @@ void vgpu_init_gr_ops(struct gpu_ops *gops)
684 gops->gr.free_obj_ctx = vgpu_gr_free_obj_ctx; 710 gops->gr.free_obj_ctx = vgpu_gr_free_obj_ctx;
685 gops->gr.bind_ctxsw_zcull = vgpu_gr_bind_ctxsw_zcull; 711 gops->gr.bind_ctxsw_zcull = vgpu_gr_bind_ctxsw_zcull;
686 gops->gr.get_zcull_info = vgpu_gr_get_zcull_info; 712 gops->gr.get_zcull_info = vgpu_gr_get_zcull_info;
713 gops->gr.detect_sm_arch = vgpu_gr_detect_sm_arch;
687} 714}