Skip to content

Commit 7806bad

Browse files
akacprowjlawryno
authored andcommitted
accel/ivpu: Prevent runtime suspend during context abort work
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
1 parent 4720e0a commit 7806bad

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/accel/ivpu/ivpu_job.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/bitfield.h>
99
#include <linux/highmem.h>
1010
#include <linux/pci.h>
11+
#include <linux/pm_runtime.h>
1112
#include <linux/module.h>
1213
#include <uapi/drm/ivpu_accel.h>
1314

@@ -965,6 +966,9 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
965966
unsigned long ctx_id;
966967
unsigned long id;
967968

969+
if (drm_WARN_ON(&vdev->drm, pm_runtime_get_if_active(vdev->drm.dev) <= 0))
970+
return;
971+
968972
if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
969973
ivpu_jsm_reset_engine(vdev, 0);
970974

@@ -987,7 +991,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
987991
ivpu_mmu_discard_events(vdev);
988992

989993
if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
990-
return;
994+
goto runtime_put;
991995

992996
ivpu_jsm_hws_resume_engine(vdev, 0);
993997
/*
@@ -1000,4 +1004,8 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
10001004
if (job->file_priv->aborted)
10011005
ivpu_job_signal_and_destroy(vdev, job->job_id, DRM_IVPU_JOB_STATUS_ABORTED);
10021006
mutex_unlock(&vdev->submitted_jobs_lock);
1007+
1008+
runtime_put:
1009+
pm_runtime_mark_last_busy(vdev->drm.dev);
1010+
pm_runtime_put_autosuspend(vdev->drm.dev);
10031011
}

0 commit comments

Comments
 (0)