Skip to content

Commit e3caadf

Browse files
committed
accel/ivpu: Remove d3hot_after_power_off WA
Always enter D3hot after entering D0i3 an all platforms. This minimizes power usage. Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240402104929.941186-3-jacek.lawrynowicz@linux.intel.com
1 parent f0cf7ff commit e3caadf

4 files changed

Lines changed: 14 additions & 20 deletions

File tree

drivers/accel/ivpu/ivpu_drv.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (C) 2020-2023 Intel Corporation
3+
* Copyright (C) 2020-2024 Intel Corporation
44
*/
55

66
#include <linux/firmware.h>
@@ -387,12 +387,15 @@ int ivpu_shutdown(struct ivpu_device *vdev)
387387
{
388388
int ret;
389389

390-
ivpu_prepare_for_reset(vdev);
390+
/* Save PCI state before powering down as it sometimes gets corrupted if NPU hangs */
391+
pci_save_state(to_pci_dev(vdev->drm.dev));
391392

392393
ret = ivpu_hw_power_down(vdev);
393394
if (ret)
394395
ivpu_warn(vdev, "Failed to power down HW: %d\n", ret);
395396

397+
pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot);
398+
396399
return ret;
397400
}
398401

@@ -560,11 +563,11 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
560563
/* Power up early so the rest of init code can access VPU registers */
561564
ret = ivpu_hw_power_up(vdev);
562565
if (ret)
563-
goto err_power_down;
566+
goto err_shutdown;
564567

565568
ret = ivpu_mmu_global_context_init(vdev);
566569
if (ret)
567-
goto err_power_down;
570+
goto err_shutdown;
568571

569572
ret = ivpu_mmu_init(vdev);
570573
if (ret)
@@ -601,10 +604,8 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
601604
ivpu_mmu_reserved_context_fini(vdev);
602605
err_mmu_gctx_fini:
603606
ivpu_mmu_global_context_fini(vdev);
604-
err_power_down:
605-
ivpu_hw_power_down(vdev);
606-
if (IVPU_WA(d3hot_after_power_off))
607-
pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot);
607+
err_shutdown:
608+
ivpu_shutdown(vdev);
608609
err_xa_destroy:
609610
xa_destroy(&vdev->db_xa);
610611
xa_destroy(&vdev->submitted_jobs_xa);
@@ -628,9 +629,8 @@ static void ivpu_bo_unbind_all_user_contexts(struct ivpu_device *vdev)
628629
static void ivpu_dev_fini(struct ivpu_device *vdev)
629630
{
630631
ivpu_pm_disable(vdev);
632+
ivpu_prepare_for_reset(vdev);
631633
ivpu_shutdown(vdev);
632-
if (IVPU_WA(d3hot_after_power_off))
633-
pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot);
634634

635635
ivpu_jobs_abort_all(vdev);
636636
ivpu_job_done_consumer_fini(vdev);

drivers/accel/ivpu/ivpu_drv.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
22
/*
3-
* Copyright (C) 2020-2023 Intel Corporation
3+
* Copyright (C) 2020-2024 Intel Corporation
44
*/
55

66
#ifndef __IVPU_DRV_H__
@@ -90,7 +90,6 @@
9090
struct ivpu_wa_table {
9191
bool punit_disabled;
9292
bool clear_runtime_mem;
93-
bool d3hot_after_power_off;
9493
bool interrupt_clear_with_0;
9594
bool disable_clock_relinquish;
9695
bool disable_d0i3_msg;

drivers/accel/ivpu/ivpu_hw_37xx.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (C) 2020-2023 Intel Corporation
3+
* Copyright (C) 2020-2024 Intel Corporation
44
*/
55

66
#include "ivpu_drv.h"
@@ -75,7 +75,6 @@ static void ivpu_hw_wa_init(struct ivpu_device *vdev)
7575
{
7676
vdev->wa.punit_disabled = false;
7777
vdev->wa.clear_runtime_mem = false;
78-
vdev->wa.d3hot_after_power_off = true;
7978

8079
REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, BUTTRESS_ALL_IRQ_MASK);
8180
if (REGB_RD32(VPU_37XX_BUTTRESS_INTERRUPT_STAT) == BUTTRESS_ALL_IRQ_MASK) {
@@ -86,7 +85,6 @@ static void ivpu_hw_wa_init(struct ivpu_device *vdev)
8685

8786
IVPU_PRINT_WA(punit_disabled);
8887
IVPU_PRINT_WA(clear_runtime_mem);
89-
IVPU_PRINT_WA(d3hot_after_power_off);
9088
IVPU_PRINT_WA(interrupt_clear_with_0);
9189
}
9290

drivers/accel/ivpu/ivpu_pm.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (C) 2020-2023 Intel Corporation
3+
* Copyright (C) 2020-2024 Intel Corporation
44
*/
55

66
#include <linux/highmem.h>
@@ -58,15 +58,12 @@ static int ivpu_suspend(struct ivpu_device *vdev)
5858
{
5959
int ret;
6060

61-
/* Save PCI state before powering down as it sometimes gets corrupted if NPU hangs */
62-
pci_save_state(to_pci_dev(vdev->drm.dev));
61+
ivpu_prepare_for_reset(vdev);
6362

6463
ret = ivpu_shutdown(vdev);
6564
if (ret)
6665
ivpu_err(vdev, "Failed to shutdown VPU: %d\n", ret);
6766

68-
pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot);
69-
7067
return ret;
7168
}
7269

0 commit comments

Comments
 (0)