summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c13
-rw-r--r--drivers/gpu/nvgpu/os/linux/module.c5
3 files changed, 17 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
index f393e799..7ed4c714 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
@@ -1747,6 +1747,7 @@ enum {
1747#define GK20A_SIM_IORESOURCE_MEM 2 1747#define GK20A_SIM_IORESOURCE_MEM 2
1748 1748
1749void gk20a_busy_noresume(struct gk20a *g); 1749void gk20a_busy_noresume(struct gk20a *g);
1750int gk20a_busy_try_noresume(struct gk20a *g);
1750void gk20a_idle_nosuspend(struct gk20a *g); 1751void gk20a_idle_nosuspend(struct gk20a *g);
1751int __must_check gk20a_busy(struct gk20a *g); 1752int __must_check gk20a_busy(struct gk20a *g);
1752void gk20a_idle(struct gk20a *g); 1753void gk20a_idle(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
index 227a7d57..3ccc6b0a 100644
--- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
@@ -568,19 +568,28 @@ static int gk20a_ctrl_get_fbp_l2_masks(
568static int nvgpu_gpu_ioctl_l2_fb_ops(struct gk20a *g, 568static int nvgpu_gpu_ioctl_l2_fb_ops(struct gk20a *g,
569 struct nvgpu_gpu_l2_fb_args *args) 569 struct nvgpu_gpu_l2_fb_args *args)
570{ 570{
571 int err = 0; 571 int ret = 0;
572 572
573 if ((!args->l2_flush && !args->fb_flush) || 573 if ((!args->l2_flush && !args->fb_flush) ||
574 (!args->l2_flush && args->l2_invalidate)) 574 (!args->l2_flush && args->l2_invalidate))
575 return -EINVAL; 575 return -EINVAL;
576 576
577 ret = gk20a_busy_try_noresume(g);
578
579 /* return if device is already powered off */
580 if (ret == 0)
581 return 0;
582
577 if (args->l2_flush) 583 if (args->l2_flush)
578 g->ops.mm.l2_flush(g, args->l2_invalidate ? true : false); 584 g->ops.mm.l2_flush(g, args->l2_invalidate ? true : false);
579 585
580 if (args->fb_flush) 586 if (args->fb_flush)
581 g->ops.mm.fb_flush(g); 587 g->ops.mm.fb_flush(g);
582 588
583 return err; 589 if (ret > 0)
590 gk20a_idle_nosuspend(g);
591
592 return 0;
584} 593}
585 594
586static int nvgpu_gpu_ioctl_set_mmu_debug_mode( 595static int nvgpu_gpu_ioctl_set_mmu_debug_mode(
diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c
index c453bced..964fc651 100644
--- a/drivers/gpu/nvgpu/os/linux/module.c
+++ b/drivers/gpu/nvgpu/os/linux/module.c
@@ -109,6 +109,11 @@ void gk20a_busy_noresume(struct gk20a *g)
109 pm_runtime_get_noresume(dev_from_gk20a(g)); 109 pm_runtime_get_noresume(dev_from_gk20a(g));
110} 110}
111 111
112int gk20a_busy_try_noresume(struct gk20a *g)
113{
114 return pm_runtime_get_if_in_use(dev_from_gk20a(g));
115}
116
112/* 117/*
113 * Check if the device can go busy. 118 * Check if the device can go busy.
114 */ 119 */