On 05/03/17 18:35, Karol Herbst wrote:
We don't want to change anything on the GPU if it's suspended. Also we
need to increase the refcount on the pm_runtime counter so that the GPU
won't be suspended while reclocking.

Signed-off-by: Karol Herbst <karolher...@gmail.com>
---
 drm/nouveau/nvkm/subdev/clk/base.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drm/nouveau/nvkm/subdev/clk/base.c 
b/drm/nouveau/nvkm/subdev/clk/base.c
index bc65906e..143ce0ea 100644
--- a/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drm/nouveau/nvkm/subdev/clk/base.c
@@ -320,6 +320,7 @@ nvkm_clk_update_work(struct work_struct *work)
 {
        struct nvkm_clk *clk = container_of(work, typeof(*clk), work);
        struct nvkm_subdev *subdev = &clk->subdev;
+       struct device *dev = subdev->device->dev;
        int pstate;

        if (!atomic_xchg(&clk->waiting, 0))
@@ -345,7 +346,14 @@ nvkm_clk_update_work(struct work_struct *work)
                pstate = NVKM_CLK_PSTATE_DEFAULT;
        }

-       clk->func->update(clk, pstate);
+       // only call into the code if the GPU is powered on
+       if (!pm_runtime_suspended(dev)) {
+               // it would be a shame if the GPU goes into suspend
+               // while doing the reclock
+               pm_runtime_get_sync(dev);
+               clk->func->update(clk, pstate);
+               pm_runtime_put(dev);
+       }

Good catch! But Java has corrupted your mind :D Please use /* */ for comments.


        wake_up_all(&clk->wait);
        nvkm_notify_get(&clk->pwrsrc_ntfy);

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

Reply via email to