From e0f2afe5eb43fb32490ccabd504879c3e3e54623 Mon Sep 17 00:00:00 2001 From: David Nieto Date: Mon, 13 Mar 2017 20:23:03 -0700 Subject: gpu: nvgpu: refactor teardown to support unbind This change refactors the teardown in remove to ensure that it is possible to unload the driver while leaving fds open. This is achieved by making sure that the SW state is kept alive till all fds are closed and by checking that subsequent calls to ioctls after the teardown fail. Normally, this would be achieved ny calls into gk20a_busy(), but in kickoff we dont call into that to reduce latency, so we need to check the driver status directly, and also in some of the functions as we need to make sure the ioctl does not dereference the device or platform struct bug 200277762 JIRA: EVLR-1023 Change-Id: I163e47a08c29d4d5b3ab79f0eb531ef234f40bde Signed-off-by: David Nieto Reviewed-on: http://git-master/r/1320219 Reviewed-by: Terje Bergstrom Reviewed-by: svccoveritychecker Reviewed-by: Shreshtha Sahu Reviewed-by: Vijayakumar Subbu --- drivers/gpu/nvgpu/gk20a/gk20a.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 30f1b371..f4ca5649 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -877,6 +877,9 @@ struct gk20a { atomic_t nonstall_ops; struct work_struct nonstall_fn_work; struct workqueue_struct *nonstall_work_queue; + + bool is_fmodel; + struct kref refcount; struct resource *reg_mem; @@ -987,7 +990,7 @@ struct gk20a { bool global_profiler_reservation_held; int profiler_reservation_count; - void (*remove_support)(struct device *); + void (*remove_support)(struct gk20a *); u64 pg_ingating_time_us; u64 pg_ungating_time_us; @@ -1455,7 +1458,7 @@ extern struct class nvgpu_class; int gk20a_pm_init(struct device *dev); int gk20a_pm_finalize_poweron(struct device *dev); -void gk20a_remove_support(struct device *dev); +void gk20a_remove_support(struct gk20a *g); static inline struct tsg_gk20a *tsg_gk20a_from_ch(struct channel_gk20a *ch) { -- cgit v1.2.2