]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
accel/ivpu: Prevent runtime suspend during context abort work
authorAndrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Tue, 4 Feb 2025 08:46:18 +0000 (09:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 12:54:40 +0000 (13:54 +0100)
[ Upstream commit 7806bad76ac397a767f0c369534133c71c73b157 ]

Increment the runtime PM counter when entering
ivpu_context_abort_work_fn() to prevent the device
from suspending while the function is executing.

Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250204084622.2422544-3-jacek.lawrynowicz@linux.intel.com
Stable-dep-of: 9f6c63285737 ("accel/ivpu: Ensure rpm_runtime_put in case of engine reset/resume fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/accel/ivpu/ivpu_job.c

index e631098718b1510a43317b825b82c7f952dfe9f4..a0dca1c253b74d643ef5959823f1b4903263fe5f 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/bitfield.h>
 #include <linux/highmem.h>
 #include <linux/pci.h>
+#include <linux/pm_runtime.h>
 #include <linux/module.h>
 #include <uapi/drm/ivpu_accel.h>
 
@@ -848,6 +849,9 @@ void ivpu_context_abort_thread_handler(struct work_struct *work)
        struct ivpu_job *job;
        unsigned long id;
 
+       if (drm_WARN_ON(&vdev->drm, pm_runtime_get_if_active(vdev->drm.dev) <= 0))
+               return;
+
        if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
                if (ivpu_jsm_reset_engine(vdev, 0))
                        return;
@@ -864,7 +868,7 @@ void ivpu_context_abort_thread_handler(struct work_struct *work)
        mutex_unlock(&vdev->context_list_lock);
 
        if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
-               return;
+               goto runtime_put;
 
        if (ivpu_jsm_hws_resume_engine(vdev, 0))
                return;
@@ -878,4 +882,8 @@ void ivpu_context_abort_thread_handler(struct work_struct *work)
                if (job->file_priv->aborted)
                        ivpu_job_signal_and_destroy(vdev, job->job_id, DRM_IVPU_JOB_STATUS_ABORTED);
        mutex_unlock(&vdev->submitted_jobs_lock);
+
+runtime_put:
+       pm_runtime_mark_last_busy(vdev->drm.dev);
+       pm_runtime_put_autosuspend(vdev->drm.dev);
 }