summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/module.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-07-27 15:15:19 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-03 11:44:58 -0400
commite1df72771ba5e5331888f5bfc171f71bd8f4aed7 (patch)
tree26e367639be69587c2ba577a2b0a4ea8cb91efce /drivers/gpu/nvgpu/common/linux/module.c
parent11e29991acd25baef5b786605e136b5e71737b8e (diff)
gpu: nvgpu: Move isr related fields from gk20a
Move fields in struct gk20a related to interrupt handling into Linux specific nvgpu_os_linux. At the same time move the counter logic from function in HAL into Linux specific code, and two Linux specific power management functions from generic gk20a.c to Linux specific module.c. JIRA NVGPU-123 Change-Id: I0a08fd2e81297c8dff7a85c263ded928496c4de0 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1528177 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sourab Gupta <sourabg@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/module.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index d19a7a45..cbfe6ad7 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -136,6 +136,7 @@ void gk20a_idle(struct gk20a *g)
136int gk20a_pm_finalize_poweron(struct device *dev) 136int gk20a_pm_finalize_poweron(struct device *dev)
137{ 137{
138 struct gk20a *g = get_gk20a(dev); 138 struct gk20a *g = get_gk20a(dev);
139 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
139 struct gk20a_platform *platform = gk20a_get_platform(dev); 140 struct gk20a_platform *platform = gk20a_get_platform(dev);
140 int err, nice_value; 141 int err, nice_value;
141 142
@@ -163,10 +164,10 @@ int gk20a_pm_finalize_poweron(struct device *dev)
163 set_user_nice(current, -20); 164 set_user_nice(current, -20);
164 165
165 /* Enable interrupt workqueue */ 166 /* Enable interrupt workqueue */
166 if (!g->nonstall_work_queue) { 167 if (!l->nonstall_work_queue) {
167 g->nonstall_work_queue = alloc_workqueue("%s", 168 l->nonstall_work_queue = alloc_workqueue("%s",
168 WQ_HIGHPRI, 1, "mc_nonstall"); 169 WQ_HIGHPRI, 1, "mc_nonstall");
169 INIT_WORK(&g->nonstall_fn_work, nvgpu_intr_nonstall_cb); 170 INIT_WORK(&l->nonstall_fn_work, nvgpu_intr_nonstall_cb);
170 } 171 }
171 172
172 err = gk20a_finalize_poweron(g); 173 err = gk20a_finalize_poweron(g);
@@ -827,6 +828,34 @@ static int gk20a_pm_init(struct device *dev)
827 return err; 828 return err;
828} 829}
829 830
831/*
832 * Start the process for unloading the driver. Set NVGPU_DRIVER_IS_DYING.
833 */
834void gk20a_driver_start_unload(struct gk20a *g)
835{
836 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
837
838 gk20a_dbg(gpu_dbg_shutdown, "Driver is now going down!\n");
839
840 down_write(&g->busy_lock);
841 __nvgpu_set_enabled(g, NVGPU_DRIVER_IS_DYING, true);
842 up_write(&g->busy_lock);
843
844 if (g->is_virtual)
845 return;
846
847 gk20a_wait_for_idle(dev_from_gk20a(g));
848
849 nvgpu_wait_for_deferred_interrupts(g);
850 gk20a_channel_cancel_pending_sema_waits(g);
851
852 if (l->nonstall_work_queue) {
853 cancel_work_sync(&l->nonstall_fn_work);
854 destroy_workqueue(l->nonstall_work_queue);
855 l->nonstall_work_queue = NULL;
856 }
857}
858
830static inline void set_gk20a(struct platform_device *pdev, struct gk20a *gk20a) 859static inline void set_gk20a(struct platform_device *pdev, struct gk20a *gk20a)
831{ 860{
832 gk20a_get_platform(&pdev->dev)->g = gk20a; 861 gk20a_get_platform(&pdev->dev)->g = gk20a;