summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2018-01-09 13:47:40 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-12 15:42:57 -0500
commitece3d958b306f00dad76ed6f9b83ce136b4769f2 (patch)
tree81d1bdce3311575661e3f30d7dbf957d1d1c330f /drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
parent44a1208fecab46f6e660d0315579c86cb6f32d0a (diff)
gpu: nvgpu: Combine gk20a and gp10b free_gr_ctx
gp10b version of free_gr_ctx was created to keep gp10b source code changes out from the mainline. gp10b was merged back to mainline a while ago, so this separation is no longer needed. Merge the two variants. Change-Id: I954b3b677e98e4248f95641ea22e0def4e583c66 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1635127 Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
index a0662956..e8790587 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
@@ -21,6 +21,7 @@
21#include <nvgpu/kmem.h> 21#include <nvgpu/kmem.h>
22#include <nvgpu/bug.h> 22#include <nvgpu/bug.h>
23#include <nvgpu/error_notifier.h> 23#include <nvgpu/error_notifier.h>
24#include <nvgpu/dma.h>
24 25
25#include "vgpu.h" 26#include "vgpu.h"
26#include "gr_vgpu.h" 27#include "gr_vgpu.h"
@@ -317,23 +318,31 @@ int vgpu_gr_alloc_gr_ctx(struct gk20a *g,
317void vgpu_gr_free_gr_ctx(struct gk20a *g, struct vm_gk20a *vm, 318void vgpu_gr_free_gr_ctx(struct gk20a *g, struct vm_gk20a *vm,
318 struct gr_ctx_desc *gr_ctx) 319 struct gr_ctx_desc *gr_ctx)
319{ 320{
321 struct tegra_vgpu_cmd_msg msg;
322 struct tegra_vgpu_gr_ctx_params *p = &msg.params.gr_ctx;
323 int err;
324
320 gk20a_dbg_fn(""); 325 gk20a_dbg_fn("");
321 326
322 if (gr_ctx && gr_ctx->mem.gpu_va) { 327 if (!gr_ctx || !gr_ctx->mem.gpu_va)
323 struct tegra_vgpu_cmd_msg msg; 328 return;
324 struct tegra_vgpu_gr_ctx_params *p = &msg.params.gr_ctx;
325 int err;
326 329
327 msg.cmd = TEGRA_VGPU_CMD_GR_CTX_FREE;
328 msg.handle = vgpu_get_handle(g);
329 p->gr_ctx_handle = gr_ctx->virt_ctx;
330 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
331 WARN_ON(err || msg.ret);
332 330
333 __nvgpu_vm_free_va(vm, gr_ctx->mem.gpu_va, 331 msg.cmd = TEGRA_VGPU_CMD_GR_CTX_FREE;
334 gmmu_page_size_kernel); 332 msg.handle = vgpu_get_handle(g);
335 nvgpu_kfree(g, gr_ctx); 333 p->gr_ctx_handle = gr_ctx->virt_ctx;
336 } 334 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
335 WARN_ON(err || msg.ret);
336
337 __nvgpu_vm_free_va(vm, gr_ctx->mem.gpu_va,
338 gmmu_page_size_kernel);
339
340 nvgpu_dma_unmap_free(vm, &gr_ctx->pagepool_ctxsw_buffer);
341 nvgpu_dma_unmap_free(vm, &gr_ctx->betacb_ctxsw_buffer);
342 nvgpu_dma_unmap_free(vm, &gr_ctx->spill_ctxsw_buffer);
343 nvgpu_dma_unmap_free(vm, &gr_ctx->preempt_ctxsw_buffer);
344
345 nvgpu_kfree(g, gr_ctx);
337} 346}
338 347
339static void vgpu_gr_free_channel_gr_ctx(struct channel_gk20a *c) 348static void vgpu_gr_free_channel_gr_ctx(struct channel_gk20a *c)