From a9ce91f910ca730a3abadb9e7491e3504af30d86 Mon Sep 17 00:00:00 2001 From: seshendra Gadagottu Date: Wed, 5 Jul 2017 22:47:20 -0700 Subject: gpu: nvgpu: add syncpoint read map For sync-point read map: 1. Added nvgpu_mem memory allocator in gk20a struct and allocated memory for this in gk20a_finalize_poweron() and freed this memory in gk20a_remove(). 2. Added "u64 syncpt_ro_map_gpu_va" in vm_gk20a struct for read map in vm. Added nvgpu_quiesce() in nvgpu_remove() before freeing syncpoint read map to ensure that nvgpu is idle. JIRA GPUT19X-2 Change-Id: I7cbfec57f0992682dd833a1b0d92d694bcaf1eb3 Signed-off-by: seshendra Gadagottu Reviewed-on: https://git-master.nvidia.com/r/1514338 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/module.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/linux') diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index ac64041e..52f987b2 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -1026,9 +1027,16 @@ int nvgpu_remove(struct device *dev, struct class *class) struct gk20a *g = get_gk20a(dev); struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct gk20a_platform *platform = gk20a_get_platform(dev); + int err; gk20a_dbg_fn(""); + err = nvgpu_quiesce(g); + WARN(err, "gpu failed to idle during driver removal"); + + if (nvgpu_mem_is_valid(&g->syncpt_mem)) + nvgpu_dma_free(g, &g->syncpt_mem); + if (platform->has_cde) gk20a_cde_destroy(l); @@ -1061,7 +1069,7 @@ int nvgpu_remove(struct device *dev, struct class *class) gk20a_dbg_fn("removed"); - return 0; + return err; } static int __exit gk20a_remove(struct platform_device *pdev) -- cgit v1.2.2