diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2018-01-16 08:38:13 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-01-20 05:19:02 -0500 |
commit | 3ccf5c85fbc329cc5a72b86f83379d7a151a1f5a (patch) | |
tree | dcf5471132826f285b5ad0c38b789ff177a8fec9 /drivers/gpu/nvgpu/common/linux/module.c | |
parent | 4021d42cbb37c6d7cd30bd132d1d08d004422917 (diff) |
gpu: nvgpu: add g->sw_ready flag
Fix a race condition where we'd still be booting up the gpu and/or
initializing the driver but elsewhere assume that all is done already.
Some userspace APIs to make sure that we're ready by testing
g->gr.sw_ready, but this flag is set in the middle of bootup; there are
other things after gr initialization. Add a new flag that is enabled
after bootup is fully complete at the end of finalize_poweron, and
change the checks in user API paths to test the new flag only.
These checks are only in the ioctl paths for ctrl, dbg and tsg, and in
the ctrl device's opening path.
The gr.sw_ready flag is still left there to signify whether just gr has
had its bookkeeping initialized.
Bug 200370011
Change-Id: I2995500e06de46430d9b835de1e9d60b3f01744e
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1640124
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/module.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/module.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index d74d824f..c153b56f 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c | |||
@@ -290,6 +290,8 @@ int gk20a_pm_finalize_poweron(struct device *dev) | |||
290 | return err; | 290 | return err; |
291 | } | 291 | } |
292 | 292 | ||
293 | g->sw_ready = true; | ||
294 | |||
293 | done: | 295 | done: |
294 | if (err) | 296 | if (err) |
295 | g->power_on = false; | 297 | g->power_on = false; |
@@ -1041,6 +1043,7 @@ void gk20a_driver_start_unload(struct gk20a *g) | |||
1041 | /* GR SW ready needs to be invalidated at this time with the busy lock | 1043 | /* GR SW ready needs to be invalidated at this time with the busy lock |
1042 | * held to prevent a racing condition on the gr/mm code */ | 1044 | * held to prevent a racing condition on the gr/mm code */ |
1043 | g->gr.sw_ready = false; | 1045 | g->gr.sw_ready = false; |
1046 | g->sw_ready = false; | ||
1044 | up_write(&l->busy_lock); | 1047 | up_write(&l->busy_lock); |
1045 | 1048 | ||
1046 | if (g->is_virtual) | 1049 | if (g->is_virtual) |