Skip to contentSkip to conversation

accel/ivpu: Don't enter d0i3 during FLR

PATCH In review Stanislaw Gruszka 2 participants 2 messages Oct 24, 2023 – Oct 27, 2023 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accel/ivpu: Don't enter d0i3 during FLR

commit 828d63042aeca132a93938b98dc7f1a6c97bbc51 upstream.

Avoid HW bug on some platforms where we enter D0i3 state and CPU is in low power states (C8 or above).

-

---
 drivers/accel/ivpu/ivpu_drv.c    | 11 ++++++++---
 drivers/accel/ivpu/ivpu_drv.h    |  1 +
 drivers/accel/ivpu/ivpu_hw.h     |  8 ++++++++
 drivers/accel/ivpu/ivpu_hw_mtl.c |  1 +
 drivers/accel/ivpu/ivpu_pm.c     |  3 ++-
 5 files changed, 20 insertions(+), 4 deletions(-)
drivers/accel/ivpu/ivpu_drv.c +8 -3
index 8396db2b5203..13e11437bee5 100644
@@ -343,14 +343,19 @@ int ivpu_boot(struct ivpu_device *vdev)
 	return 0;
 }
 
-int ivpu_shutdown(struct ivpu_device *vdev)
+void ivpu_prepare_for_reset(struct ivpu_device *vdev)
 {
-	int ret;
-
 	ivpu_hw_irq_disable(vdev);
 	disable_irq(vdev->irq);
 	ivpu_ipc_disable(vdev);
 	ivpu_mmu_disable(vdev);
+}
+
+int ivpu_shutdown(struct ivpu_device *vdev)
+{
+	int ret;
+
+	ivpu_prepare_for_reset(vdev);
 
 	ret = ivpu_hw_power_down(vdev);
 	if (ret)
drivers/accel/ivpu/ivpu_drv.h +1 -0
index 399dc5dcefd7..343b15e56799 100644
@@ -144,6 +144,7 @@ void ivpu_file_priv_put(struct ivpu_file_priv **link);
 
 int ivpu_boot(struct ivpu_device *vdev);
 int ivpu_shutdown(struct ivpu_device *vdev);
+void ivpu_prepare_for_reset(struct ivpu_device *vdev);
 
 static inline bool ivpu_is_mtl(struct ivpu_device *vdev)
 {
drivers/accel/ivpu/ivpu_hw.h +8 -0
index 50a9304ab09c..dac59f1c1e05 100644
@@ -13,6 +13,7 @@ struct ivpu_hw_ops {
 	int (*power_up)(struct ivpu_device *vdev);
 	int (*boot_fw)(struct ivpu_device *vdev);
 	int (*power_down)(struct ivpu_device *vdev);
+	int (*reset)(struct ivpu_device *vdev);
 	bool (*is_idle)(struct ivpu_device *vdev);
 	void (*wdt_disable)(struct ivpu_device *vdev);
 	void (*diagnose_failure)(struct ivpu_device *vdev);
@@ -90,6 +91,13 @@ static inline int ivpu_hw_power_down(struct ivpu_device *vdev)
 	return vdev->hw->ops->power_down(vdev);
 };
 
+static inline int ivpu_hw_reset(struct ivpu_device *vdev)
+{
+	ivpu_dbg(vdev, PM, "HW reset\n");
+
+	return vdev->hw->ops->reset(vdev);
+};
+
 static inline void ivpu_hw_wdt_disable(struct ivpu_device *vdev)
 {
 	vdev->hw->ops->wdt_disable(vdev);
drivers/accel/ivpu/ivpu_hw_mtl.c +1 -0
index 2a5dd3a5dc46..d21c16b5e6f8 100644
@@ -1041,6 +1041,7 @@ const struct ivpu_hw_ops ivpu_hw_mtl_ops = {
 	.power_up = ivpu_hw_mtl_power_up,
 	.is_idle = ivpu_hw_mtl_is_idle,
 	.power_down = ivpu_hw_mtl_power_down,
+	.reset = ivpu_hw_mtl_reset,
 	.boot_fw = ivpu_hw_mtl_boot_fw,
 	.wdt_disable = ivpu_hw_mtl_wdt_disable,
 	.diagnose_failure = ivpu_hw_mtl_diagnose_failure,
drivers/accel/ivpu/ivpu_pm.c +2 -1
index aa4d56dc52b3..86ec828dd1df 100644
@@ -260,7 +260,8 @@ void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev)
 
 	ivpu_dbg(vdev, PM, "Pre-reset..\n");
 	atomic_set(&vdev->pm->in_reset, 1);
-	ivpu_shutdown(vdev);
+	ivpu_prepare_for_reset(vdev);
+	ivpu_hw_reset(vdev);
 	ivpu_pm_prepare_cold_boot(vdev);
 	ivpu_jobs_abort_all(vdev);
 	ivpu_dbg(vdev, PM, "Pre-reset done.\n");
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 10 lines · Stanislaw Gruszka

commit 828d63042aeca132a93938b98dc7f1a6c97bbc51 upstream.

Avoid HW bug on some platforms where we enter D0i3 state and CPU is in low power states (C8 or above).

Quoted 8 lines

-

---
 drivers/accel/ivpu/ivpu_drv.c    | 11 ++++++++---
 drivers/accel/ivpu/ivpu_drv.h    |  1 +
 drivers/accel/ivpu/ivpu_hw.h     |  8 ++++++++
 drivers/accel/ivpu/ivpu_hw_mtl.c |  1 +
 drivers/accel/ivpu/ivpu_pm.c     |  3 ++-
 5 files changed, 20 insertions(+), 4 deletions(-)

Now queued up, thanks.

greg k-h