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/ioctl_ctrl.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/ioctl_ctrl.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c index e2285917..866ac39e 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | |||
@@ -86,7 +86,7 @@ int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) | |||
86 | */ | 86 | */ |
87 | priv->g = g; | 87 | priv->g = g; |
88 | 88 | ||
89 | if (!g->gr.sw_ready) { | 89 | if (!g->sw_ready) { |
90 | err = gk20a_busy(g); | 90 | err = gk20a_busy(g); |
91 | if (err) | 91 | if (err) |
92 | goto free_ref; | 92 | goto free_ref; |
@@ -1556,7 +1556,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg | |||
1556 | return -EFAULT; | 1556 | return -EFAULT; |
1557 | } | 1557 | } |
1558 | 1558 | ||
1559 | if (!g->gr.sw_ready) { | 1559 | if (!g->sw_ready) { |
1560 | err = gk20a_busy(g); | 1560 | err = gk20a_busy(g); |
1561 | if (err) | 1561 | if (err) |
1562 | return err; | 1562 | return err; |