Skip to content

Commit

Permalink
accel/ivpu/40xx: Capture D0i3 entry host and device timestamps
Browse files Browse the repository at this point in the history
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 <andrzej.kacprowski@linux.intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231028133415.1169975-8-stanislaw.gruszka@linux.intel.com
  • Loading branch information
Andrzej Kacprowski authored and Stanislaw Gruszka committed Oct 30, 2023
1 parent 8b5cec3 commit db37a5b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/accel/ivpu/ivpu_hw_40xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,10 +879,18 @@ static bool ivpu_hw_40xx_is_idle(struct ivpu_device *vdev)
REG_TEST_FLD(VPU_40XX_BUTTRESS_VPU_STATUS, IDLE, val);
}

static void ivpu_hw_40xx_save_d0i3_entry_timestamp(struct ivpu_device *vdev)
{
vdev->hw->d0i3_entry_host_ts = ktime_get_boottime();
vdev->hw->d0i3_entry_vpu_ts = REGV_RD64(VPU_40XX_CPU_SS_TIM_PERF_EXT_FREE_CNT);
}

static int ivpu_hw_40xx_power_down(struct ivpu_device *vdev)
{
int ret = 0;

ivpu_hw_40xx_save_d0i3_entry_timestamp(vdev);

if (!ivpu_hw_40xx_is_idle(vdev) && ivpu_hw_40xx_reset(vdev))
ivpu_warn(vdev, "Failed to reset the VPU\n");

Expand Down

0 comments on commit db37a5b

Please sign in to comment.