From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,
Oded Gabbay <ogabbay@kernel.org>,
Jeffrey Hugo <quic_jhugo@quicinc.com>,
Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Subject: [PATCH 2/7] accel/ivpu: Cancel recovery work
Date: Wed, 22 Mar 2023 10:18:55 +0100 [thread overview]
Message-ID: <20230322091900.1982453-3-stanislaw.gruszka@linux.intel.com> (raw)
In-Reply-To: <20230322091900.1982453-1-stanislaw.gruszka@linux.intel.com>
Prevent running recovery_work after device is removed.
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.c | 2 ++
drivers/accel/ivpu/ivpu_pm.c | 15 +++++++++++++--
drivers/accel/ivpu/ivpu_pm.h | 1 +
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index ac06bbfca920..d9e311b40348 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -580,6 +580,8 @@ static void ivpu_dev_fini(struct ivpu_device *vdev)
ivpu_pm_disable(vdev);
ivpu_shutdown(vdev);
ivpu_job_done_thread_fini(vdev);
+ ivpu_pm_cancel_recovery(vdev);
+
ivpu_ipc_fini(vdev);
ivpu_fw_fini(vdev);
ivpu_mmu_global_context_fini(vdev);
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index a880f1dd857e..df2e98cc0a56 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -98,11 +98,17 @@ static int ivpu_resume(struct ivpu_device *vdev)
static void ivpu_pm_recovery_work(struct work_struct *work)
{
struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work);
- struct ivpu_device *vdev = pm->vdev;
+ struct ivpu_device *vdev = pm->vdev;
char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL};
int ret;
- ret = pci_reset_function(to_pci_dev(vdev->drm.dev));
+retry:
+ ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
+ if (ret == -EAGAIN && !drm_dev_is_unplugged(&vdev->drm)) {
+ cond_resched();
+ goto retry;
+ }
+
if (ret)
ivpu_err(vdev, "Failed to reset VPU: %d\n", ret);
@@ -302,6 +308,11 @@ int ivpu_pm_init(struct ivpu_device *vdev)
return 0;
}
+void ivpu_pm_cancel_recovery(struct ivpu_device *vdev)
+{
+ cancel_work_sync(&vdev->pm->recovery_work);
+}
+
void ivpu_pm_enable(struct ivpu_device *vdev)
{
struct device *dev = vdev->drm.dev;
diff --git a/drivers/accel/ivpu/ivpu_pm.h b/drivers/accel/ivpu/ivpu_pm.h
index dc1b3758e13f..baca98187255 100644
--- a/drivers/accel/ivpu/ivpu_pm.h
+++ b/drivers/accel/ivpu/ivpu_pm.h
@@ -21,6 +21,7 @@ struct ivpu_pm_info {
int ivpu_pm_init(struct ivpu_device *vdev);
void ivpu_pm_enable(struct ivpu_device *vdev);
void ivpu_pm_disable(struct ivpu_device *vdev);
+void ivpu_pm_cancel_recovery(struct ivpu_device *vdev);
int ivpu_pm_suspend_cb(struct device *dev);
int ivpu_pm_resume_cb(struct device *dev);
--
2.25.1
next prev parent reply other threads:[~2023-03-22 9:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 9:18 [PATCH 0/7] acell/ivpu: Fixes for 6.3 Stanislaw Gruszka
2023-03-22 9:18 ` [PATCH 1/7] accel/ivpu: Do not access HW registers after unbind Stanislaw Gruszka
2023-03-22 14:16 ` Jeffrey Hugo
2023-03-22 9:18 ` Stanislaw Gruszka [this message]
2023-03-22 14:21 ` [PATCH 2/7] accel/ivpu: Cancel recovery work Jeffrey Hugo
2023-03-22 14:55 ` Stanislaw Gruszka
2023-03-22 9:18 ` [PATCH 3/7] accel/ivpu: Do not use SSID 1 Stanislaw Gruszka
2023-03-22 14:25 ` Jeffrey Hugo
2023-03-22 15:10 ` Stanislaw Gruszka
2023-03-22 9:18 ` [PATCH 4/7] accel/ivpu: Fix power down sequence Stanislaw Gruszka
2023-03-22 14:28 ` Jeffrey Hugo
2023-03-22 9:18 ` [PATCH 5/7] accel/ivpu: Disable buttress on device removal Stanislaw Gruszka
2023-03-22 14:33 ` Jeffrey Hugo
2023-03-22 9:18 ` [PATCH 6/7] accel/ivpu: Remove support for 1 tile SKUs Stanislaw Gruszka
2023-03-22 14:36 ` Jeffrey Hugo
2023-03-22 9:19 ` [PATCH 7/7] accel/ivpu: Fix VPU clock calculation Stanislaw Gruszka
2023-03-22 14:52 ` Jeffrey Hugo
2023-03-22 16:28 ` Stanislaw Gruszka
2023-03-23 11:00 ` Stanislaw Gruszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230322091900.1982453-3-stanislaw.gruszka@linux.intel.com \
--to=stanislaw.gruszka@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacek.lawrynowicz@linux.intel.com \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox