Skip to content

Commit db37a5b

Browse files
Andrzej Kacprowskisgruszka
authored andcommitted
accel/ivpu/40xx: Capture D0i3 entry host and device timestamps
The driver needs to capture the D0i3 entry timestamp to calculate D0i3 residency time. The D0i3 residency time and the VPU timestamp are passed to the firmware at D0i3 exit (warm boot). Signed-off-by: Andrzej Kacprowski <[email protected]> Reviewed-by: Stanislaw Gruszka <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Signed-off-by: Stanislaw Gruszka <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 8b5cec3 commit db37a5b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/accel/ivpu/ivpu_hw_40xx.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,10 +879,18 @@ static bool ivpu_hw_40xx_is_idle(struct ivpu_device *vdev)
879879
REG_TEST_FLD(VPU_40XX_BUTTRESS_VPU_STATUS, IDLE, val);
880880
}
881881

882+
static void ivpu_hw_40xx_save_d0i3_entry_timestamp(struct ivpu_device *vdev)
883+
{
884+
vdev->hw->d0i3_entry_host_ts = ktime_get_boottime();
885+
vdev->hw->d0i3_entry_vpu_ts = REGV_RD64(VPU_40XX_CPU_SS_TIM_PERF_EXT_FREE_CNT);
886+
}
887+
882888
static int ivpu_hw_40xx_power_down(struct ivpu_device *vdev)
883889
{
884890
int ret = 0;
885891

892+
ivpu_hw_40xx_save_d0i3_entry_timestamp(vdev);
893+
886894
if (!ivpu_hw_40xx_is_idle(vdev) && ivpu_hw_40xx_reset(vdev))
887895
ivpu_warn(vdev, "Failed to reset the VPU\n");
888896

0 commit comments

Comments
 (0)