diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 069dfc955..44786e4b8 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -822,7 +822,8 @@ static int gk20a_pm_prepare_poweroff(struct device *dev) * serviced. */ disable_irq(g->irq_stall); - disable_irq(g->irq_nonstall); + if (g->irq_stall != g->irq_nonstall) + disable_irq(g->irq_nonstall); ret |= gk20a_gr_suspend(g); ret |= gk20a_mm_suspend(g); @@ -907,6 +908,15 @@ int gk20a_pm_finalize_poweron(struct device *dev) if (err) goto done; + /* + * Before probing the GPU make sure the GPU's state is cleared. This is + * relevant for rebind operations. + */ + if (g->ops.xve.reset_gpu && !g->gpu_reset_done) { + g->ops.xve.reset_gpu(g); + g->gpu_reset_done = true; + } + if (g->ops.bios.init) err = g->ops.bios.init(g); if (err) diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 30a3252a9..ff354bc86 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -832,6 +832,7 @@ struct gk20a { void __iomem *bar1; void __iomem *bar1_saved; + bool gpu_reset_done; bool power_on; bool suspended; diff --git a/drivers/gpu/nvgpu/pci.c b/drivers/gpu/nvgpu/pci.c index ed681c750..88b743bce 100644 --- a/drivers/gpu/nvgpu/pci.c +++ b/drivers/gpu/nvgpu/pci.c @@ -400,6 +400,8 @@ static void nvgpu_pci_remove(struct pci_dev *pdev) platform->remove(g->dev); gk20a_dbg(gpu_dbg_shutdown, "Platform remove done.\b"); + enable_irq(g->irq_stall); + kfree(g); }