diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c index e2285917b..866ac39eb 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) */ priv->g = g; - if (!g->gr.sw_ready) { + if (!g->sw_ready) { err = gk20a_busy(g); if (err) goto free_ref; @@ -1556,7 +1556,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg return -EFAULT; } - if (!g->gr.sw_ready) { + if (!g->sw_ready) { err = gk20a_busy(g); if (err) return err; diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c b/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c index 9372fca8f..ebb869c39 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c @@ -1835,7 +1835,7 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd, return -EFAULT; } - if (!g->gr.sw_ready) { + if (!g->sw_ready) { err = gk20a_busy(g); if (err) return err; diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index 931a32644..03577b974 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c @@ -458,7 +458,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd, return -EFAULT; } - if (!g->gr.sw_ready) { + if (!g->sw_ready) { err = gk20a_busy(g); if (err) return err; diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index d74d824f9..c153b56fa 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) return err; } + g->sw_ready = true; + done: if (err) g->power_on = false; @@ -1041,6 +1043,7 @@ void gk20a_driver_start_unload(struct gk20a *g) /* GR SW ready needs to be invalidated at this time with the busy lock * held to prevent a racing condition on the gr/mm code */ g->gr.sw_ready = false; + g->sw_ready = false; up_write(&l->busy_lock); if (g->is_virtual) diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c index 9d2eab924..86f1877d1 100644 --- a/drivers/gpu/nvgpu/common/linux/sysfs.c +++ b/drivers/gpu/nvgpu/common/linux/sysfs.c @@ -815,6 +815,7 @@ static ssize_t tpc_fs_mask_store(struct device *dev, g->gr.ctx_vars.local_golden_image = NULL; g->gr.ctx_vars.golden_image_initialized = false; g->gr.ctx_vars.golden_image_size = 0; + /* Cause next poweron to reinit just gr */ g->gr.sw_ready = false; } diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c index 0d04d6e4f..d0c9e66de 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c @@ -505,6 +505,8 @@ int vgpu_pm_finalize_poweron(struct device *dev) gk20a_sched_ctrl_init(g); gk20a_channel_resume(g); + g->sw_ready = true; + done: return err; } diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 0ce3b50d8..31855250b 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1133,6 +1133,7 @@ struct gk20a { bool gpu_reset_done; bool power_on; bool suspended; + bool sw_ready; u32 log_mask; u32 log_trace;