summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106/gr_gp106.c
diff options
context:
space:
mode:
authorPeter Daifuku <pdaifuku@nvidia.com>2019-01-25 18:06:46 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2019-01-31 01:18:04 -0500
commitd39781054f63a510b0eaccee5e1099d7ae6ce132 (patch)
tree484198d2d4be323f6db334bacd764498311b004f /drivers/gpu/nvgpu/gp106/gr_gp106.c
parent61bb9dc40395257fa1dc15d267496e3deb32a3e5 (diff)
gpu: nvgpu: allocate ctxsw buffers once only
In *_set_ctxsw_preemption_mode, only allocate buffers the first time through. Bug 200418468 Change-Id: I22d06463416615b9a9d671c32b6fe76b602a2623 Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2004301 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Satish Arora <satisha@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106/gr_gp106.c')
-rw-r--r--drivers/gpu/nvgpu/gp106/gr_gp106.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/gp106/gr_gp106.c b/drivers/gpu/nvgpu/gp106/gr_gp106.c
index 2de0ae87..59915ad4 100644
--- a/drivers/gpu/nvgpu/gp106/gr_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/gr_gp106.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP106 GPU GR 2 * GP106 GPU GR
3 * 3 *
4 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
@@ -189,36 +189,39 @@ int gr_gp106_set_ctxsw_preemption_mode(struct gk20a *g,
189 nvgpu_log_info(g, "gfxp context attrib_cb_size=%d", 189 nvgpu_log_info(g, "gfxp context attrib_cb_size=%d",
190 attrib_cb_size); 190 attrib_cb_size);
191 191
192 err = gr_gp10b_alloc_buffer(vm, 192 /* Only allocate buffers the first time through */
193 if (!nvgpu_mem_is_valid(&gr_ctx->preempt_ctxsw_buffer)) {
194 err = gr_gp10b_alloc_buffer(vm,
193 g->gr.ctx_vars.preempt_image_size, 195 g->gr.ctx_vars.preempt_image_size,
194 &gr_ctx->preempt_ctxsw_buffer); 196 &gr_ctx->preempt_ctxsw_buffer);
195 if (err) { 197 if (err) {
196 nvgpu_err(g, "cannot allocate preempt buffer"); 198 nvgpu_err(g, "cannot allocate preempt buffer");
197 goto fail; 199 goto fail;
198 } 200 }
199 201
200 err = gr_gp10b_alloc_buffer(vm, 202 err = gr_gp10b_alloc_buffer(vm,
201 spill_size, 203 spill_size,
202 &gr_ctx->spill_ctxsw_buffer); 204 &gr_ctx->spill_ctxsw_buffer);
203 if (err) { 205 if (err) {
204 nvgpu_err(g, "cannot allocate spill buffer"); 206 nvgpu_err(g, "cannot allocate spill buffer");
205 goto fail_free_preempt; 207 goto fail_free_preempt;
206 } 208 }
207 209
208 err = gr_gp10b_alloc_buffer(vm, 210 err = gr_gp10b_alloc_buffer(vm,
209 attrib_cb_size, 211 attrib_cb_size,
210 &gr_ctx->betacb_ctxsw_buffer); 212 &gr_ctx->betacb_ctxsw_buffer);
211 if (err) { 213 if (err) {
212 nvgpu_err(g, "cannot allocate beta buffer"); 214 nvgpu_err(g, "cannot allocate beta buffer");
213 goto fail_free_spill; 215 goto fail_free_spill;
214 } 216 }
215 217
216 err = gr_gp10b_alloc_buffer(vm, 218 err = gr_gp10b_alloc_buffer(vm,
217 pagepool_size, 219 pagepool_size,
218 &gr_ctx->pagepool_ctxsw_buffer); 220 &gr_ctx->pagepool_ctxsw_buffer);
219 if (err) { 221 if (err) {
220 nvgpu_err(g, "cannot allocate page pool"); 222 nvgpu_err(g, "cannot allocate page pool");
221 goto fail_free_betacb; 223 goto fail_free_betacb;
224 }
222 } 225 }
223 226
224 gr_ctx->graphics_preempt_mode = graphics_preempt_mode; 227 gr_ctx->graphics_preempt_mode = graphics_preempt_mode;