Skip to content

Commit e53e004

Browse files
kwachowsjlawryno
authored andcommitted
accel/ivpu: Correct DCT interrupt handling
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 <[email protected]> Signed-off-by: Maciej Falkowski <[email protected]> Reviewed-by: Jeff Hugo <[email protected]> Signed-off-by: Jacek Lawrynowicz <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bbe5679 commit e53e004

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
@@ -428,32 +428,34 @@ int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent)
428428
active_us = (DCT_PERIOD_US * active_percent) / 100;
429429
inactive_us = DCT_PERIOD_US - active_us;
430430

431+
vdev->pm->dct_active_percent = active_percent;
432+
433+
ivpu_dbg(vdev, PM, "DCT requested %u%% (D0: %uus, D0i2: %uus)\n",
434+
active_percent, active_us, inactive_us);
435+
431436
ret = ivpu_jsm_dct_enable(vdev, active_us, inactive_us);
432437
if (ret) {
433438
ivpu_err_ratelimited(vdev, "Failed to enable DCT: %d\n", ret);
434439
return ret;
435440
}
436441

437-
vdev->pm->dct_active_percent = active_percent;
438-
439-
ivpu_dbg(vdev, PM, "DCT set to %u%% (D0: %uus, D0i2: %uus)\n",
440-
active_percent, active_us, inactive_us);
441442
return 0;
442443
}
443444

444445
int ivpu_pm_dct_disable(struct ivpu_device *vdev)
445446
{
446447
int ret;
447448

449+
vdev->pm->dct_active_percent = 0;
450+
451+
ivpu_dbg(vdev, PM, "DCT requested to be disabled\n");
452+
448453
ret = ivpu_jsm_dct_disable(vdev);
449454
if (ret) {
450455
ivpu_err_ratelimited(vdev, "Failed to disable DCT: %d\n", ret);
451456
return ret;
452457
}
453458

454-
vdev->pm->dct_active_percent = 0;
455-
456-
ivpu_dbg(vdev, PM, "DCT disabled\n");
457459
return 0;
458460
}
459461

@@ -466,7 +468,7 @@ void ivpu_pm_irq_dct_work_fn(struct work_struct *work)
466468
if (ivpu_hw_btrs_dct_get_request(vdev, &enable))
467469
return;
468470

469-
if (vdev->pm->dct_active_percent)
471+
if (enable)
470472
ret = ivpu_pm_dct_enable(vdev, DCT_DEFAULT_ACTIVE_PERCENT);
471473
else
472474
ret = ivpu_pm_dct_disable(vdev);

0 commit comments

Comments
 (0)