Skip to content

Commit 92d812d

Browse files
kwachowsgregkh
authored andcommitted
accel/ivpu: Correct DCT interrupt handling
[ Upstream commit e53e004 ] Fix improper use of dct_active_percent field in DCT interrupt handler causing DCT to never get enabled. Set dct_active_percent internally before IPC to ensure correct driver value even if IPC fails. Set default DCT value to 30 accordingly to HW architecture specification. Fixes: a19bffb ("accel/ivpu: Implement DCT handling") Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com> Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Link: https://lore.kernel.org/r/20250416102616.384577-1-maciej.falkowski@linux.intel.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 174161d commit 92d812d

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

drivers/accel/ivpu/ivpu_hw_btrs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define PLL_PROFILING_FREQ_DEFAULT 38400000
1515
#define PLL_PROFILING_FREQ_HIGH 400000000
1616

17-
#define DCT_DEFAULT_ACTIVE_PERCENT 15u
17+
#define DCT_DEFAULT_ACTIVE_PERCENT 30u
1818
#define DCT_PERIOD_US 35300u
1919

2020
int ivpu_hw_btrs_info_init(struct ivpu_device *vdev);

drivers/accel/ivpu/ivpu_pm.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,32 +421,34 @@ int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent)
421421
active_us = (DCT_PERIOD_US * active_percent) / 100;
422422
inactive_us = DCT_PERIOD_US - active_us;
423423

424+
vdev->pm->dct_active_percent = active_percent;
425+
426+
ivpu_dbg(vdev, PM, "DCT requested %u%% (D0: %uus, D0i2: %uus)\n",
427+
active_percent, active_us, inactive_us);
428+
424429
ret = ivpu_jsm_dct_enable(vdev, active_us, inactive_us);
425430
if (ret) {
426431
ivpu_err_ratelimited(vdev, "Filed to enable DCT: %d\n", ret);
427432
return ret;
428433
}
429434

430-
vdev->pm->dct_active_percent = active_percent;
431-
432-
ivpu_dbg(vdev, PM, "DCT set to %u%% (D0: %uus, D0i2: %uus)\n",
433-
active_percent, active_us, inactive_us);
434435
return 0;
435436
}
436437

437438
int ivpu_pm_dct_disable(struct ivpu_device *vdev)
438439
{
439440
int ret;
440441

442+
vdev->pm->dct_active_percent = 0;
443+
444+
ivpu_dbg(vdev, PM, "DCT requested to be disabled\n");
445+
441446
ret = ivpu_jsm_dct_disable(vdev);
442447
if (ret) {
443448
ivpu_err_ratelimited(vdev, "Filed to disable DCT: %d\n", ret);
444449
return ret;
445450
}
446451

447-
vdev->pm->dct_active_percent = 0;
448-
449-
ivpu_dbg(vdev, PM, "DCT disabled\n");
450452
return 0;
451453
}
452454

@@ -458,7 +460,7 @@ void ivpu_pm_dct_irq_thread_handler(struct ivpu_device *vdev)
458460
if (ivpu_hw_btrs_dct_get_request(vdev, &enable))
459461
return;
460462

461-
if (vdev->pm->dct_active_percent)
463+
if (enable)
462464
ret = ivpu_pm_dct_enable(vdev, DCT_DEFAULT_ACTIVE_PERCENT);
463465
else
464466
ret = ivpu_pm_dct_disable(vdev);

0 commit comments

Comments
 (0)