diff options
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/gr_vgpu.c')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/gr_vgpu.c | 69 |
1 files changed, 20 insertions, 49 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c index 7f267f26..96d21c0a 100644 --- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c | |||
@@ -26,11 +26,12 @@ | |||
26 | #include <nvgpu/bug.h> | 26 | #include <nvgpu/bug.h> |
27 | 27 | ||
28 | #include "vgpu/vgpu.h" | 28 | #include "vgpu/vgpu.h" |
29 | #include "vgpu/gr_vgpu.h" | ||
29 | #include "gk20a/dbg_gpu_gk20a.h" | 30 | #include "gk20a/dbg_gpu_gk20a.h" |
30 | 31 | ||
31 | #include <nvgpu/hw/gk20a/hw_gr_gk20a.h> | 32 | #include <nvgpu/hw/gk20a/hw_gr_gk20a.h> |
32 | 33 | ||
33 | static void vgpu_gr_detect_sm_arch(struct gk20a *g) | 34 | void vgpu_gr_detect_sm_arch(struct gk20a *g) |
34 | { | 35 | { |
35 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); | 36 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); |
36 | 37 | ||
@@ -427,7 +428,7 @@ static void vgpu_gr_free_channel_pm_ctx(struct channel_gk20a *c) | |||
427 | pm_ctx->mem.gpu_va = 0; | 428 | pm_ctx->mem.gpu_va = 0; |
428 | } | 429 | } |
429 | 430 | ||
430 | static void vgpu_gr_free_channel_ctx(struct channel_gk20a *c, bool is_tsg) | 431 | void vgpu_gr_free_channel_ctx(struct channel_gk20a *c, bool is_tsg) |
431 | { | 432 | { |
432 | gk20a_dbg_fn(""); | 433 | gk20a_dbg_fn(""); |
433 | 434 | ||
@@ -484,7 +485,7 @@ static int vgpu_gr_tsg_bind_gr_ctx(struct tsg_gk20a *tsg) | |||
484 | return err; | 485 | return err; |
485 | } | 486 | } |
486 | 487 | ||
487 | static int vgpu_gr_alloc_obj_ctx(struct channel_gk20a *c, | 488 | int vgpu_gr_alloc_obj_ctx(struct channel_gk20a *c, |
488 | struct nvgpu_alloc_obj_ctx_args *args) | 489 | struct nvgpu_alloc_obj_ctx_args *args) |
489 | { | 490 | { |
490 | struct gk20a *g = c->g; | 491 | struct gk20a *g = c->g; |
@@ -666,7 +667,7 @@ cleanup: | |||
666 | return -ENOMEM; | 667 | return -ENOMEM; |
667 | } | 668 | } |
668 | 669 | ||
669 | static int vgpu_gr_bind_ctxsw_zcull(struct gk20a *g, struct gr_gk20a *gr, | 670 | int vgpu_gr_bind_ctxsw_zcull(struct gk20a *g, struct gr_gk20a *gr, |
670 | struct channel_gk20a *c, u64 zcull_va, | 671 | struct channel_gk20a *c, u64 zcull_va, |
671 | u32 mode) | 672 | u32 mode) |
672 | { | 673 | { |
@@ -686,7 +687,7 @@ static int vgpu_gr_bind_ctxsw_zcull(struct gk20a *g, struct gr_gk20a *gr, | |||
686 | return (err || msg.ret) ? -ENOMEM : 0; | 687 | return (err || msg.ret) ? -ENOMEM : 0; |
687 | } | 688 | } |
688 | 689 | ||
689 | static int vgpu_gr_get_zcull_info(struct gk20a *g, struct gr_gk20a *gr, | 690 | int vgpu_gr_get_zcull_info(struct gk20a *g, struct gr_gk20a *gr, |
690 | struct gr_zcull_info *zcull_params) | 691 | struct gr_zcull_info *zcull_params) |
691 | { | 692 | { |
692 | struct tegra_vgpu_cmd_msg msg; | 693 | struct tegra_vgpu_cmd_msg msg; |
@@ -717,14 +718,14 @@ static int vgpu_gr_get_zcull_info(struct gk20a *g, struct gr_gk20a *gr, | |||
717 | return 0; | 718 | return 0; |
718 | } | 719 | } |
719 | 720 | ||
720 | static u32 vgpu_gr_get_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) | 721 | u32 vgpu_gr_get_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) |
721 | { | 722 | { |
722 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); | 723 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); |
723 | 724 | ||
724 | return priv->constants.gpc_tpc_mask[gpc_index]; | 725 | return priv->constants.gpc_tpc_mask[gpc_index]; |
725 | } | 726 | } |
726 | 727 | ||
727 | static u32 vgpu_gr_get_max_fbps_count(struct gk20a *g) | 728 | u32 vgpu_gr_get_max_fbps_count(struct gk20a *g) |
728 | { | 729 | { |
729 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); | 730 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); |
730 | 731 | ||
@@ -733,7 +734,7 @@ static u32 vgpu_gr_get_max_fbps_count(struct gk20a *g) | |||
733 | return priv->constants.num_fbps; | 734 | return priv->constants.num_fbps; |
734 | } | 735 | } |
735 | 736 | ||
736 | static u32 vgpu_gr_get_fbp_en_mask(struct gk20a *g) | 737 | u32 vgpu_gr_get_fbp_en_mask(struct gk20a *g) |
737 | { | 738 | { |
738 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); | 739 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); |
739 | 740 | ||
@@ -742,7 +743,7 @@ static u32 vgpu_gr_get_fbp_en_mask(struct gk20a *g) | |||
742 | return priv->constants.fbp_en_mask; | 743 | return priv->constants.fbp_en_mask; |
743 | } | 744 | } |
744 | 745 | ||
745 | static u32 vgpu_gr_get_max_ltc_per_fbp(struct gk20a *g) | 746 | u32 vgpu_gr_get_max_ltc_per_fbp(struct gk20a *g) |
746 | { | 747 | { |
747 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); | 748 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); |
748 | 749 | ||
@@ -751,7 +752,7 @@ static u32 vgpu_gr_get_max_ltc_per_fbp(struct gk20a *g) | |||
751 | return priv->constants.ltc_per_fbp; | 752 | return priv->constants.ltc_per_fbp; |
752 | } | 753 | } |
753 | 754 | ||
754 | static u32 vgpu_gr_get_max_lts_per_ltc(struct gk20a *g) | 755 | u32 vgpu_gr_get_max_lts_per_ltc(struct gk20a *g) |
755 | { | 756 | { |
756 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); | 757 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); |
757 | 758 | ||
@@ -760,13 +761,13 @@ static u32 vgpu_gr_get_max_lts_per_ltc(struct gk20a *g) | |||
760 | return priv->constants.max_lts_per_ltc; | 761 | return priv->constants.max_lts_per_ltc; |
761 | } | 762 | } |
762 | 763 | ||
763 | static u32 *vgpu_gr_rop_l2_en_mask(struct gk20a *g) | 764 | u32 *vgpu_gr_rop_l2_en_mask(struct gk20a *g) |
764 | { | 765 | { |
765 | /* no one use it yet */ | 766 | /* no one use it yet */ |
766 | return NULL; | 767 | return NULL; |
767 | } | 768 | } |
768 | 769 | ||
769 | static int vgpu_gr_add_zbc(struct gk20a *g, struct gr_gk20a *gr, | 770 | int vgpu_gr_add_zbc(struct gk20a *g, struct gr_gk20a *gr, |
770 | struct zbc_entry *zbc_val) | 771 | struct zbc_entry *zbc_val) |
771 | { | 772 | { |
772 | struct tegra_vgpu_cmd_msg msg = {0}; | 773 | struct tegra_vgpu_cmd_msg msg = {0}; |
@@ -797,7 +798,7 @@ static int vgpu_gr_add_zbc(struct gk20a *g, struct gr_gk20a *gr, | |||
797 | return (err || msg.ret) ? -ENOMEM : 0; | 798 | return (err || msg.ret) ? -ENOMEM : 0; |
798 | } | 799 | } |
799 | 800 | ||
800 | static int vgpu_gr_query_zbc(struct gk20a *g, struct gr_gk20a *gr, | 801 | int vgpu_gr_query_zbc(struct gk20a *g, struct gr_gk20a *gr, |
801 | struct zbc_query_params *query_params) | 802 | struct zbc_query_params *query_params) |
802 | { | 803 | { |
803 | struct tegra_vgpu_cmd_msg msg = {0}; | 804 | struct tegra_vgpu_cmd_msg msg = {0}; |
@@ -997,7 +998,7 @@ int vgpu_gr_nonstall_isr(struct gk20a *g, | |||
997 | return 0; | 998 | return 0; |
998 | } | 999 | } |
999 | 1000 | ||
1000 | static int vgpu_gr_set_sm_debug_mode(struct gk20a *g, | 1001 | int vgpu_gr_set_sm_debug_mode(struct gk20a *g, |
1001 | struct channel_gk20a *ch, u64 sms, bool enable) | 1002 | struct channel_gk20a *ch, u64 sms, bool enable) |
1002 | { | 1003 | { |
1003 | struct tegra_vgpu_cmd_msg msg; | 1004 | struct tegra_vgpu_cmd_msg msg; |
@@ -1017,7 +1018,7 @@ static int vgpu_gr_set_sm_debug_mode(struct gk20a *g, | |||
1017 | return err ? err : msg.ret; | 1018 | return err ? err : msg.ret; |
1018 | } | 1019 | } |
1019 | 1020 | ||
1020 | static int vgpu_gr_update_smpc_ctxsw_mode(struct gk20a *g, | 1021 | int vgpu_gr_update_smpc_ctxsw_mode(struct gk20a *g, |
1021 | struct channel_gk20a *ch, bool enable) | 1022 | struct channel_gk20a *ch, bool enable) |
1022 | { | 1023 | { |
1023 | struct tegra_vgpu_cmd_msg msg; | 1024 | struct tegra_vgpu_cmd_msg msg; |
@@ -1041,7 +1042,7 @@ static int vgpu_gr_update_smpc_ctxsw_mode(struct gk20a *g, | |||
1041 | return err ? err : msg.ret; | 1042 | return err ? err : msg.ret; |
1042 | } | 1043 | } |
1043 | 1044 | ||
1044 | static int vgpu_gr_update_hwpm_ctxsw_mode(struct gk20a *g, | 1045 | int vgpu_gr_update_hwpm_ctxsw_mode(struct gk20a *g, |
1045 | struct channel_gk20a *ch, bool enable) | 1046 | struct channel_gk20a *ch, bool enable) |
1046 | { | 1047 | { |
1047 | struct channel_ctx_gk20a *ch_ctx = &ch->ch_ctx; | 1048 | struct channel_ctx_gk20a *ch_ctx = &ch->ch_ctx; |
@@ -1079,7 +1080,7 @@ static int vgpu_gr_update_hwpm_ctxsw_mode(struct gk20a *g, | |||
1079 | return err ? err : msg.ret; | 1080 | return err ? err : msg.ret; |
1080 | } | 1081 | } |
1081 | 1082 | ||
1082 | static int vgpu_gr_clear_sm_error_state(struct gk20a *g, | 1083 | int vgpu_gr_clear_sm_error_state(struct gk20a *g, |
1083 | struct channel_gk20a *ch, u32 sm_id) | 1084 | struct channel_gk20a *ch, u32 sm_id) |
1084 | { | 1085 | { |
1085 | struct gr_gk20a *gr = &g->gr; | 1086 | struct gr_gk20a *gr = &g->gr; |
@@ -1172,7 +1173,7 @@ done: | |||
1172 | return err; | 1173 | return err; |
1173 | } | 1174 | } |
1174 | 1175 | ||
1175 | static int vgpu_gr_suspend_contexts(struct gk20a *g, | 1176 | int vgpu_gr_suspend_contexts(struct gk20a *g, |
1176 | struct dbg_session_gk20a *dbg_s, | 1177 | struct dbg_session_gk20a *dbg_s, |
1177 | int *ctx_resident_ch_fd) | 1178 | int *ctx_resident_ch_fd) |
1178 | { | 1179 | { |
@@ -1180,7 +1181,7 @@ static int vgpu_gr_suspend_contexts(struct gk20a *g, | |||
1180 | ctx_resident_ch_fd, TEGRA_VGPU_CMD_SUSPEND_CONTEXTS); | 1181 | ctx_resident_ch_fd, TEGRA_VGPU_CMD_SUSPEND_CONTEXTS); |
1181 | } | 1182 | } |
1182 | 1183 | ||
1183 | static int vgpu_gr_resume_contexts(struct gk20a *g, | 1184 | int vgpu_gr_resume_contexts(struct gk20a *g, |
1184 | struct dbg_session_gk20a *dbg_s, | 1185 | struct dbg_session_gk20a *dbg_s, |
1185 | int *ctx_resident_ch_fd) | 1186 | int *ctx_resident_ch_fd) |
1186 | { | 1187 | { |
@@ -1213,33 +1214,3 @@ void vgpu_gr_handle_sm_esr_event(struct gk20a *g, | |||
1213 | 1214 | ||
1214 | nvgpu_mutex_release(&g->dbg_sessions_lock); | 1215 | nvgpu_mutex_release(&g->dbg_sessions_lock); |
1215 | } | 1216 | } |
1216 | |||
1217 | void vgpu_init_gr_ops(struct gpu_ops *gops) | ||
1218 | { | ||
1219 | gops->gr.detect_sm_arch = vgpu_gr_detect_sm_arch; | ||
1220 | gops->gr.free_channel_ctx = vgpu_gr_free_channel_ctx; | ||
1221 | gops->gr.alloc_obj_ctx = vgpu_gr_alloc_obj_ctx; | ||
1222 | gops->gr.alloc_gr_ctx = vgpu_gr_alloc_gr_ctx; | ||
1223 | gops->gr.free_gr_ctx = vgpu_gr_free_gr_ctx; | ||
1224 | gops->gr.bind_ctxsw_zcull = vgpu_gr_bind_ctxsw_zcull; | ||
1225 | gops->gr.get_zcull_info = vgpu_gr_get_zcull_info; | ||
1226 | gops->gr.get_gpc_tpc_mask = vgpu_gr_get_gpc_tpc_mask; | ||
1227 | gops->gr.get_max_fbps_count = vgpu_gr_get_max_fbps_count; | ||
1228 | gops->gr.get_fbp_en_mask = vgpu_gr_get_fbp_en_mask; | ||
1229 | gops->gr.get_max_ltc_per_fbp = vgpu_gr_get_max_ltc_per_fbp; | ||
1230 | gops->gr.get_max_lts_per_ltc = vgpu_gr_get_max_lts_per_ltc; | ||
1231 | gops->gr.get_rop_l2_en_mask = vgpu_gr_rop_l2_en_mask; | ||
1232 | gops->gr.zbc_set_table = vgpu_gr_add_zbc; | ||
1233 | gops->gr.zbc_query_table = vgpu_gr_query_zbc; | ||
1234 | gops->gr.init_ctx_state = vgpu_gr_init_ctx_state; | ||
1235 | gops->gr.set_sm_debug_mode = vgpu_gr_set_sm_debug_mode; | ||
1236 | gops->gr.update_smpc_ctxsw_mode = vgpu_gr_update_smpc_ctxsw_mode; | ||
1237 | gops->gr.update_hwpm_ctxsw_mode = vgpu_gr_update_hwpm_ctxsw_mode; | ||
1238 | gops->gr.clear_sm_error_state = vgpu_gr_clear_sm_error_state; | ||
1239 | gops->gr.suspend_contexts = vgpu_gr_suspend_contexts; | ||
1240 | gops->gr.resume_contexts = vgpu_gr_resume_contexts; | ||
1241 | gops->gr.commit_inst = vgpu_gr_commit_inst; | ||
1242 | gops->gr.dump_gr_regs = NULL; | ||
1243 | gops->gr.set_boosted_ctx = NULL; | ||
1244 | gops->gr.update_boosted_ctx = NULL; | ||
1245 | } | ||