Skip to content

Commit 828d630

Browse files
jlawrynosgruszka
authored andcommitted
accel/ivpu: Don't enter d0i3 during FLR
Avoid HW bug on some platforms where we enter D0i3 state and CPU is in low power states (C8 or above). Fixes: 852be13 ("accel/ivpu: Add PM support") Cc: [email protected] Signed-off-by: Jacek Lawrynowicz <[email protected]> Reviewed-by: Stanislaw Gruszka <[email protected]> Signed-off-by: Stanislaw Gruszka <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent fa8391a commit 828d630

File tree

6 files changed

+21
-4
lines changed

6 files changed

+21
-4
lines changed

drivers/accel/ivpu/ivpu_drv.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,19 @@ int ivpu_boot(struct ivpu_device *vdev)
367367
return 0;
368368
}
369369

370-
int ivpu_shutdown(struct ivpu_device *vdev)
370+
void ivpu_prepare_for_reset(struct ivpu_device *vdev)
371371
{
372-
int ret;
373-
374372
ivpu_hw_irq_disable(vdev);
375373
disable_irq(vdev->irq);
376374
ivpu_ipc_disable(vdev);
377375
ivpu_mmu_disable(vdev);
376+
}
377+
378+
int ivpu_shutdown(struct ivpu_device *vdev)
379+
{
380+
int ret;
381+
382+
ivpu_prepare_for_reset(vdev);
378383

379384
ret = ivpu_hw_power_down(vdev);
380385
if (ret)

drivers/accel/ivpu/ivpu_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ void ivpu_file_priv_put(struct ivpu_file_priv **link);
151151

152152
int ivpu_boot(struct ivpu_device *vdev);
153153
int ivpu_shutdown(struct ivpu_device *vdev);
154+
void ivpu_prepare_for_reset(struct ivpu_device *vdev);
154155

155156
static inline u8 ivpu_revision(struct ivpu_device *vdev)
156157
{

drivers/accel/ivpu/ivpu_hw.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct ivpu_hw_ops {
1313
int (*power_up)(struct ivpu_device *vdev);
1414
int (*boot_fw)(struct ivpu_device *vdev);
1515
int (*power_down)(struct ivpu_device *vdev);
16+
int (*reset)(struct ivpu_device *vdev);
1617
bool (*is_idle)(struct ivpu_device *vdev);
1718
void (*wdt_disable)(struct ivpu_device *vdev);
1819
void (*diagnose_failure)(struct ivpu_device *vdev);
@@ -91,6 +92,13 @@ static inline int ivpu_hw_power_down(struct ivpu_device *vdev)
9192
return vdev->hw->ops->power_down(vdev);
9293
};
9394

95+
static inline int ivpu_hw_reset(struct ivpu_device *vdev)
96+
{
97+
ivpu_dbg(vdev, PM, "HW reset\n");
98+
99+
return vdev->hw->ops->reset(vdev);
100+
};
101+
94102
static inline void ivpu_hw_wdt_disable(struct ivpu_device *vdev)
95103
{
96104
vdev->hw->ops->wdt_disable(vdev);

drivers/accel/ivpu/ivpu_hw_37xx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,7 @@ const struct ivpu_hw_ops ivpu_hw_37xx_ops = {
10291029
.power_up = ivpu_hw_37xx_power_up,
10301030
.is_idle = ivpu_hw_37xx_is_idle,
10311031
.power_down = ivpu_hw_37xx_power_down,
1032+
.reset = ivpu_hw_37xx_reset,
10321033
.boot_fw = ivpu_hw_37xx_boot_fw,
10331034
.wdt_disable = ivpu_hw_37xx_wdt_disable,
10341035
.diagnose_failure = ivpu_hw_37xx_diagnose_failure,

drivers/accel/ivpu/ivpu_hw_40xx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,7 @@ const struct ivpu_hw_ops ivpu_hw_40xx_ops = {
11791179
.power_up = ivpu_hw_40xx_power_up,
11801180
.is_idle = ivpu_hw_40xx_is_idle,
11811181
.power_down = ivpu_hw_40xx_power_down,
1182+
.reset = ivpu_hw_40xx_reset,
11821183
.boot_fw = ivpu_hw_40xx_boot_fw,
11831184
.wdt_disable = ivpu_hw_40xx_wdt_disable,
11841185
.diagnose_failure = ivpu_hw_40xx_diagnose_failure,

drivers/accel/ivpu/ivpu_pm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev)
261261
ivpu_dbg(vdev, PM, "Pre-reset..\n");
262262
atomic_inc(&vdev->pm->reset_counter);
263263
atomic_set(&vdev->pm->in_reset, 1);
264-
ivpu_shutdown(vdev);
264+
ivpu_prepare_for_reset(vdev);
265+
ivpu_hw_reset(vdev);
265266
ivpu_pm_prepare_cold_boot(vdev);
266267
ivpu_jobs_abort_all(vdev);
267268
ivpu_dbg(vdev, PM, "Pre-reset done.\n");

0 commit comments

Comments
 (0)