From 843bbc726c7283666a18d9ff899350e0cef18330 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Mon, 25 Jul 2016 15:12:08 -0700 Subject: gpu: nvgpu: vgpu: add getting sm version constants move below attributes to constants: TEGRA_VGPU_ATTRIB_GPC0_TPC0_SM_ARCH JIRA VFND-2103 Change-Id: I5d6aa8f4a49e65307989ef02d223c3ee31fcdeed Signed-off-by: Richard Zhao Reviewed-on: http://git-master/r/1190481 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Vladislav Buzov --- drivers/gpu/nvgpu/vgpu/gk20a/vgpu_gr_gk20a.c | 29 ---------------------------- drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c | 21 -------------------- drivers/gpu/nvgpu/vgpu/gr_vgpu.c | 15 ++++++++++++++ include/linux/tegra_vgpu.h | 5 ++++- 4 files changed, 19 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/nvgpu/vgpu/gk20a/vgpu_gr_gk20a.c b/drivers/gpu/nvgpu/vgpu/gk20a/vgpu_gr_gk20a.c index a8526457..0ba8db56 100644 --- a/drivers/gpu/nvgpu/vgpu/gk20a/vgpu_gr_gk20a.c +++ b/drivers/gpu/nvgpu/vgpu/gk20a/vgpu_gr_gk20a.c @@ -13,37 +13,9 @@ #include -#include "gk20a/hw_gr_gk20a.h" #include "gk20a/gk20a.h" -#include "vgpu/vgpu.h" #include "vgpu_gr_gk20a.h" -static void vgpu_gk20a_detect_sm_arch(struct gk20a *g) -{ - u32 v = 0, raw_version, version = 0; - - gk20a_dbg_fn(""); - - if (vgpu_get_attribute(vgpu_get_handle(g), - TEGRA_VGPU_ATTRIB_GPC0_TPC0_SM_ARCH, &v)) - gk20a_err(dev_from_gk20a(g), "failed to retrieve SM arch"); - - raw_version = gr_gpc0_tpc0_sm_arch_spa_version_v(v); - - if (raw_version == gr_gpc0_tpc0_sm_arch_spa_version_smkepler_lp_v()) - version = 0x320; /* SM 3.2 */ - else - gk20a_err(dev_from_gk20a(g), "Unknown SM version 0x%x", - raw_version); - - /* on Kepler, SM version == SPA version */ - g->gpu_characteristics.sm_arch_spa_version = version; - g->gpu_characteristics.sm_arch_sm_version = version; - - g->gpu_characteristics.sm_arch_warp_count = - gr_gpc0_tpc0_sm_arch_warp_count_v(v); -} - static int vgpu_gk20a_init_fs_state(struct gk20a *g) { struct gr_gk20a *gr = &g->gr; @@ -73,6 +45,5 @@ static int vgpu_gk20a_init_fs_state(struct gk20a *g) void vgpu_gk20a_init_gr_ops(struct gpu_ops *gops) { - gops->gr.detect_sm_arch = vgpu_gk20a_detect_sm_arch; gops->gr.init_fs_state = vgpu_gk20a_init_fs_state; } diff --git a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c index aaddd218..8e44eda4 100644 --- a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c +++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c @@ -13,29 +13,9 @@ #include -#include "gm20b/hw_gr_gm20b.h" #include "gk20a/gk20a.h" -#include "vgpu/vgpu.h" #include "vgpu_gr_gm20b.h" -static void vgpu_gm20b_detect_sm_arch(struct gk20a *g) -{ - u32 v = 0; - - gk20a_dbg_fn(""); - - if (vgpu_get_attribute(vgpu_get_handle(g), - TEGRA_VGPU_ATTRIB_GPC0_TPC0_SM_ARCH, &v)) - gk20a_err(dev_from_gk20a(g), "failed to retrieve SM arch"); - - g->gpu_characteristics.sm_arch_spa_version = - gr_gpc0_tpc0_sm_arch_spa_version_v(v); - g->gpu_characteristics.sm_arch_sm_version = - gr_gpc0_tpc0_sm_arch_sm_version_v(v); - g->gpu_characteristics.sm_arch_warp_count = - gr_gpc0_tpc0_sm_arch_warp_count_v(v); -} - static int vgpu_gm20b_init_fs_state(struct gk20a *g) { struct gr_gk20a *gr = &g->gr; @@ -60,6 +40,5 @@ static int vgpu_gm20b_init_fs_state(struct gk20a *g) void vgpu_gm20b_init_gr_ops(struct gpu_ops *gops) { - gops->gr.detect_sm_arch = vgpu_gm20b_detect_sm_arch; gops->gr.init_fs_state = vgpu_gm20b_init_fs_state; } diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c index bb52347f..a2af0162 100644 --- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c @@ -17,6 +17,20 @@ #include "gk20a/hw_gr_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h" +static void vgpu_gr_detect_sm_arch(struct gk20a *g) +{ + struct vgpu_priv_data *priv = vgpu_get_priv_data(g); + + gk20a_dbg_fn(""); + + g->gpu_characteristics.sm_arch_sm_version = + priv->constants.sm_arch_sm_version; + g->gpu_characteristics.sm_arch_spa_version = + priv->constants.sm_arch_spa_version; + g->gpu_characteristics.sm_arch_warp_count = + priv->constants.sm_arch_warp_count; +} + static int vgpu_gr_commit_inst(struct channel_gk20a *c, u64 gpu_va) { struct tegra_vgpu_cmd_msg msg; @@ -1095,6 +1109,7 @@ static int vgpu_gr_update_hwpm_ctxsw_mode(struct gk20a *g, void vgpu_init_gr_ops(struct gpu_ops *gops) { + gops->gr.detect_sm_arch = vgpu_gr_detect_sm_arch; gops->gr.free_channel_ctx = vgpu_gr_free_channel_ctx; gops->gr.alloc_obj_ctx = vgpu_gr_alloc_obj_ctx; gops->gr.free_obj_ctx = vgpu_gr_free_obj_ctx; diff --git a/include/linux/tegra_vgpu.h b/include/linux/tegra_vgpu.h index ef4c36d9..d30ae41d 100644 --- a/include/linux/tegra_vgpu.h +++ b/include/linux/tegra_vgpu.h @@ -120,7 +120,7 @@ enum { TEGRA_VGPU_ATTRIB_MAX_TPC_COUNT = 6, TEGRA_VGPU_ATTRIB_PMC_BOOT_0 = 7, /* deprecated */ TEGRA_VGPU_ATTRIB_L2_SIZE = 8, /* deprecated */ - TEGRA_VGPU_ATTRIB_GPC0_TPC0_SM_ARCH = 9, + TEGRA_VGPU_ATTRIB_GPC0_TPC0_SM_ARCH = 9, /* deprecated */ TEGRA_VGPU_ATTRIB_NUM_FBPS = 10, TEGRA_VGPU_ATTRIB_FBP_EN_MASK = 11, TEGRA_VGPU_ATTRIB_MAX_LTC_PER_FBP = 12, @@ -417,6 +417,9 @@ struct tegra_vgpu_constants_params { u32 slices_per_ltc; u32 comptags_per_cacheline; u32 comptag_lines; + u32 sm_arch_sm_version; + u32 sm_arch_spa_version; + u32 sm_arch_warp_count; }; struct tegra_vgpu_cmd_msg { -- cgit v1.2.2