summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-01-10 19:26:56 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-24 18:15:22 -0500
commit4feb078717fe7986bc0dfdfbfc3f10e5d1d1fa63 (patch)
treef882124086b9af30333c1633ee10e5535ca80552 /drivers/gpu
parent6715361156343afc6024513a6618ee4c89cbf49b (diff)
gpu: nvgpu: Make driver rebind work
Make the GPU bind and rebind operations work when the driver is idle. This required two changes. 1. Reset the GPU before doing SW init for PCI GPUs. This clears the SW state which may be stale in the case of a rebind attempt. 2. Cleanup the interrupt enable/disables. Firstly there was one place where nvgpu would accidentally disable the stalling interrupt twice when the stalling interrupt and non-stalling interrupt are the same. Secondly make sure when exiting nvgpu that the interrupt enable/disables are balanced. Leaving the interrupt in the -1 disable state means that next time the driver runs interrupts never quite get enabled. Bug 1816516 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1287643 Reviewed-on: http://git-master/r/1287649 (cherry picked from commit aa15af0aae5d0a95a8e765469be4354ab7ddd9f8) Change-Id: I945e21c1fbb3f096834acf850616b71b2aab9ee3 Reviewed-on: http://git-master/r/1292700 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c12
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/pci.c2
3 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 069dfc95..44786e4b 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)
822 * serviced. 822 * serviced.
823 */ 823 */
824 disable_irq(g->irq_stall); 824 disable_irq(g->irq_stall);
825 disable_irq(g->irq_nonstall); 825 if (g->irq_stall != g->irq_nonstall)
826 disable_irq(g->irq_nonstall);
826 827
827 ret |= gk20a_gr_suspend(g); 828 ret |= gk20a_gr_suspend(g);
828 ret |= gk20a_mm_suspend(g); 829 ret |= gk20a_mm_suspend(g);
@@ -907,6 +908,15 @@ int gk20a_pm_finalize_poweron(struct device *dev)
907 if (err) 908 if (err)
908 goto done; 909 goto done;
909 910
911 /*
912 * Before probing the GPU make sure the GPU's state is cleared. This is
913 * relevant for rebind operations.
914 */
915 if (g->ops.xve.reset_gpu && !g->gpu_reset_done) {
916 g->ops.xve.reset_gpu(g);
917 g->gpu_reset_done = true;
918 }
919
910 if (g->ops.bios.init) 920 if (g->ops.bios.init)
911 err = g->ops.bios.init(g); 921 err = g->ops.bios.init(g);
912 if (err) 922 if (err)
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 30a3252a..ff354bc8 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -832,6 +832,7 @@ struct gk20a {
832 void __iomem *bar1; 832 void __iomem *bar1;
833 void __iomem *bar1_saved; 833 void __iomem *bar1_saved;
834 834
835 bool gpu_reset_done;
835 bool power_on; 836 bool power_on;
836 bool suspended; 837 bool suspended;
837 838
diff --git a/drivers/gpu/nvgpu/pci.c b/drivers/gpu/nvgpu/pci.c
index ed681c75..88b743bc 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)
400 platform->remove(g->dev); 400 platform->remove(g->dev);
401 gk20a_dbg(gpu_dbg_shutdown, "Platform remove done.\b"); 401 gk20a_dbg(gpu_dbg_shutdown, "Platform remove done.\b");
402 402
403 enable_irq(g->irq_stall);
404
403 kfree(g); 405 kfree(g);
404} 406}
405 407