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 <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1320219
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
(cherry picked from commit e0f2afe5eb)
Reviewed-on: http://git-master/r/1327755
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
This commit is contained in:
David Nieto
2017-03-13 20:23:03 -07:00
committed by mobile promotions
parent ccccde66e7
commit abee92ab92
10 changed files with 91 additions and 61 deletions

View File

@@ -681,6 +681,12 @@ void gk20a_ce_delete_context(struct device *dev,
u32 ce_ctx_id)
{
struct gk20a *g = gk20a_from_dev(dev);
gk20a_ce_delete_context_priv(g, ce_ctx_id);
}
void gk20a_ce_delete_context_priv(struct gk20a *g,
u32 ce_ctx_id)
{
struct gk20a_ce_app *ce_app = &g->ce_app;
struct gk20a_gpu_ctx *ce_ctx, *ce_ctx_save;