summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
diff options
context:
space:
mode:
authorPeter Boonstoppel <pboonstoppel@nvidia.com>2017-01-10 13:22:54 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-14 17:54:46 -0500
commit907adfd785e3a3582b2649c48bf4c32f41745e3f (patch)
tree5ffa4118738135d4b33e9b6d1de035b87ef8b351 /drivers/gpu/nvgpu/gp10b/gr_gp10b.c
parent4fb3161ba3bb1c8481b1ca426a44aa4ee3ad744e (diff)
gpu: nvgpu: Add NVGPU_IOCTL_CHANNEL_SET_BOOSTED_CTX
This ioctl can be used on gp10b to set a flag in the context header indicating this context should be run at elevated clock frequency. FECS ctxsw ucode will read this flag as part of the context switch and will request higher GPU clock frequencies from BPMP for the duration of the context execution. Bug 1819874 Change-Id: I84bf580923d95585095716d49cea24e58c9440ed Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com> Reviewed-on: http://git-master/r/1292746 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/gr_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
index a7aa4003..e680e753 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
@@ -2060,6 +2060,49 @@ clean_up:
2060 return err; 2060 return err;
2061} 2061}
2062 2062
2063static int gr_gp10b_set_boosted_ctx(struct channel_gk20a *ch,
2064 bool boost)
2065{
2066 struct gr_ctx_desc *gr_ctx = ch->ch_ctx.gr_ctx;
2067 struct gk20a *g = ch->g;
2068 struct mem_desc *mem = &gr_ctx->mem;
2069 int err = 0;
2070
2071 gr_ctx->boosted_ctx = boost;
2072
2073 if (gk20a_mem_begin(g, mem))
2074 return -ENOMEM;
2075
2076 err = gk20a_disable_channel_tsg(g, ch);
2077 if (err)
2078 goto unmap_ctx;
2079
2080 err = gk20a_fifo_preempt(g, ch);
2081 if (err)
2082 goto enable_ch;
2083
2084 if (g->ops.gr.update_boosted_ctx)
2085 g->ops.gr.update_boosted_ctx(g, mem, gr_ctx);
2086 else
2087 err = -ENOSYS;
2088
2089enable_ch:
2090 gk20a_enable_channel_tsg(g, ch);
2091unmap_ctx:
2092 gk20a_mem_end(g, mem);
2093
2094 return err;
2095}
2096
2097static void gr_gp10b_update_boosted_ctx(struct gk20a *g, struct mem_desc *mem,
2098 struct gr_ctx_desc *gr_ctx) {
2099 u32 v;
2100
2101 v = ctxsw_prog_main_image_pmu_options_boost_clock_frequencies_f(
2102 gr_ctx->boosted_ctx);
2103 gk20a_mem_wr(g, mem, ctxsw_prog_main_image_pmu_options_o(), v);
2104}
2105
2063static int gr_gp10b_set_preemption_mode(struct channel_gk20a *ch, 2106static int gr_gp10b_set_preemption_mode(struct channel_gk20a *ch,
2064 u32 graphics_preempt_mode, 2107 u32 graphics_preempt_mode,
2065 u32 compute_preempt_mode) 2108 u32 compute_preempt_mode)
@@ -2271,4 +2314,6 @@ void gp10b_init_gr(struct gpu_ops *gops)
2271 gops->gr.get_preemption_mode_flags = gr_gp10b_get_preemption_mode_flags; 2314 gops->gr.get_preemption_mode_flags = gr_gp10b_get_preemption_mode_flags;
2272 gops->gr.fuse_override = gp10b_gr_fuse_override; 2315 gops->gr.fuse_override = gp10b_gr_fuse_override;
2273 gops->gr.load_smid_config = gr_gp10b_load_smid_config; 2316 gops->gr.load_smid_config = gr_gp10b_load_smid_config;
2317 gops->gr.set_boosted_ctx = gr_gp10b_set_boosted_ctx;
2318 gops->gr.update_boosted_ctx = gr_gp10b_update_boosted_ctx;
2274} 2319}