diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/gr_gm20b.c | 33 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/hw_ctxsw_prog_gm20b.h | 8 |
2 files changed, 41 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c index da1c1ab0..19340643 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/delay.h> /* for mdelay */ | 17 | #include <linux/delay.h> /* for mdelay */ |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/tegra-fuse.h> | 19 | #include <linux/tegra-fuse.h> |
20 | #include <linux/vmalloc.h> | ||
20 | 21 | ||
21 | #include "gk20a/gk20a.h" | 22 | #include "gk20a/gk20a.h" |
22 | #include "gk20a/gr_gk20a.h" | 23 | #include "gk20a/gr_gk20a.h" |
@@ -946,6 +947,37 @@ static int gr_gm20b_dump_gr_status_regs(struct gk20a *g, | |||
946 | gk20a_readl(g, gr_pri_gpc0_tpc0_tpccs_tpc_exception_r())); | 947 | gk20a_readl(g, gr_pri_gpc0_tpc0_tpccs_tpc_exception_r())); |
947 | gk20a_debug_output(o, "NV_PGRAPH_PRI_GPC0_TPC0_TPCCS_TPC_EXCEPTION_EN: 0x%x\n", | 948 | gk20a_debug_output(o, "NV_PGRAPH_PRI_GPC0_TPC0_TPCCS_TPC_EXCEPTION_EN: 0x%x\n", |
948 | gk20a_readl(g, gr_pri_gpc0_tpc0_tpccs_tpc_exception_en_r())); | 949 | gk20a_readl(g, gr_pri_gpc0_tpc0_tpccs_tpc_exception_en_r())); |
950 | |||
951 | return 0; | ||
952 | } | ||
953 | |||
954 | static int gr_gm20b_update_pc_sampling(struct channel_gk20a *c, | ||
955 | bool enable) | ||
956 | { | ||
957 | struct channel_ctx_gk20a *ch_ctx = &c->ch_ctx; | ||
958 | void *ctx_ptr = NULL; | ||
959 | u32 v; | ||
960 | |||
961 | gk20a_dbg_fn(""); | ||
962 | |||
963 | if (!ch_ctx || !ch_ctx->gr_ctx || c->vpr) | ||
964 | return -EINVAL; | ||
965 | |||
966 | ctx_ptr = vmap(ch_ctx->gr_ctx->pages, | ||
967 | PAGE_ALIGN(ch_ctx->gr_ctx->size) >> PAGE_SHIFT, | ||
968 | 0, pgprot_writecombine(PAGE_KERNEL)); | ||
969 | if (!ctx_ptr) | ||
970 | return -ENOMEM; | ||
971 | |||
972 | v = gk20a_mem_rd32(ctx_ptr, ctxsw_prog_main_image_pm_o()); | ||
973 | v &= ~ctxsw_prog_main_image_pm_pc_sampling_m(); | ||
974 | v |= ctxsw_prog_main_image_pm_pc_sampling_f(enable); | ||
975 | gk20a_mem_wr32(ctx_ptr + ctxsw_prog_main_image_pm_o(), 0, v); | ||
976 | |||
977 | vunmap(ctx_ptr); | ||
978 | |||
979 | gk20a_dbg_fn("done"); | ||
980 | |||
949 | return 0; | 981 | return 0; |
950 | } | 982 | } |
951 | 983 | ||
@@ -993,4 +1025,5 @@ void gm20b_init_gr(struct gpu_ops *gops) | |||
993 | gops->gr.update_ctxsw_preemption_mode = | 1025 | gops->gr.update_ctxsw_preemption_mode = |
994 | gr_gm20b_update_ctxsw_preemption_mode; | 1026 | gr_gm20b_update_ctxsw_preemption_mode; |
995 | gops->gr.dump_gr_regs = gr_gm20b_dump_gr_status_regs; | 1027 | gops->gr.dump_gr_regs = gr_gm20b_dump_gr_status_regs; |
1028 | gops->gr.update_pc_sampling = gr_gm20b_update_pc_sampling; | ||
996 | } | 1029 | } |
diff --git a/drivers/gpu/nvgpu/gm20b/hw_ctxsw_prog_gm20b.h b/drivers/gpu/nvgpu/gm20b/hw_ctxsw_prog_gm20b.h index ec44e9fb..cefd91e1 100644 --- a/drivers/gpu/nvgpu/gm20b/hw_ctxsw_prog_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/hw_ctxsw_prog_gm20b.h | |||
@@ -110,6 +110,14 @@ static inline u32 ctxsw_prog_main_image_pm_smpc_mode_no_ctxsw_f(void) | |||
110 | { | 110 | { |
111 | return 0x0; | 111 | return 0x0; |
112 | } | 112 | } |
113 | static inline u32 ctxsw_prog_main_image_pm_pc_sampling_f(u32 v) | ||
114 | { | ||
115 | return (v & 0x1) << 6; | ||
116 | } | ||
117 | static inline u32 ctxsw_prog_main_image_pm_pc_sampling_m(void) | ||
118 | { | ||
119 | return 0x1 << 6; | ||
120 | } | ||
113 | static inline u32 ctxsw_prog_main_image_pm_ptr_o(void) | 121 | static inline u32 ctxsw_prog_main_image_pm_ptr_o(void) |
114 | { | 122 | { |
115 | return 0x0000002c; | 123 | return 0x0000002c; |