* [PATCH] accel/ivpu: Correct DCT interrupt handling
@ 2025-04-16 10:26 Maciej Falkowski
2025-04-18 15:29 ` Jeff Hugo
2025-04-25 8:51 ` Jacek Lawrynowicz
0 siblings, 2 replies; 3+ messages in thread
From: Maciej Falkowski @ 2025-04-16 10:26 UTC (permalink / raw)
To: dri-devel
Cc: oded.gabbay, quic_jhugo, jacek.lawrynowicz, lizhi.hou,
Karol Wachowski, Maciej Falkowski
From: Karol Wachowski <karol.wachowski@intel.com>
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: a19bffb10c46 ("accel/ivpu: Implement DCT handling")
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
---
drivers/accel/ivpu/ivpu_hw_btrs.h | 2 +-
drivers/accel/ivpu/ivpu_pm.c | 18 ++++++++++--------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_hw_btrs.h b/drivers/accel/ivpu/ivpu_hw_btrs.h
index 300f749971d4..d2d82651976d 100644
--- a/drivers/accel/ivpu/ivpu_hw_btrs.h
+++ b/drivers/accel/ivpu/ivpu_hw_btrs.h
@@ -14,7 +14,7 @@
#define PLL_PROFILING_FREQ_DEFAULT 38400000
#define PLL_PROFILING_FREQ_HIGH 400000000
-#define DCT_DEFAULT_ACTIVE_PERCENT 15u
+#define DCT_DEFAULT_ACTIVE_PERCENT 30u
#define DCT_PERIOD_US 35300u
int ivpu_hw_btrs_info_init(struct ivpu_device *vdev);
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index 1fe03fc16bbc..ea30db181cd7 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -448,16 +448,17 @@ int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent)
active_us = (DCT_PERIOD_US * active_percent) / 100;
inactive_us = DCT_PERIOD_US - active_us;
+ vdev->pm->dct_active_percent = active_percent;
+
+ ivpu_dbg(vdev, PM, "DCT requested %u%% (D0: %uus, D0i2: %uus)\n",
+ active_percent, active_us, inactive_us);
+
ret = ivpu_jsm_dct_enable(vdev, active_us, inactive_us);
if (ret) {
ivpu_err_ratelimited(vdev, "Failed to enable DCT: %d\n", ret);
return ret;
}
- vdev->pm->dct_active_percent = active_percent;
-
- ivpu_dbg(vdev, PM, "DCT set to %u%% (D0: %uus, D0i2: %uus)\n",
- active_percent, active_us, inactive_us);
return 0;
}
@@ -465,15 +466,16 @@ int ivpu_pm_dct_disable(struct ivpu_device *vdev)
{
int ret;
+ vdev->pm->dct_active_percent = 0;
+
+ ivpu_dbg(vdev, PM, "DCT requested to be disabled\n");
+
ret = ivpu_jsm_dct_disable(vdev);
if (ret) {
ivpu_err_ratelimited(vdev, "Failed to disable DCT: %d\n", ret);
return ret;
}
- vdev->pm->dct_active_percent = 0;
-
- ivpu_dbg(vdev, PM, "DCT disabled\n");
return 0;
}
@@ -486,7 +488,7 @@ void ivpu_pm_irq_dct_work_fn(struct work_struct *work)
if (ivpu_hw_btrs_dct_get_request(vdev, &enable))
return;
- if (vdev->pm->dct_active_percent)
+ if (enable)
ret = ivpu_pm_dct_enable(vdev, DCT_DEFAULT_ACTIVE_PERCENT);
else
ret = ivpu_pm_dct_disable(vdev);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] accel/ivpu: Correct DCT interrupt handling
2025-04-16 10:26 [PATCH] accel/ivpu: Correct DCT interrupt handling Maciej Falkowski
@ 2025-04-18 15:29 ` Jeff Hugo
2025-04-25 8:51 ` Jacek Lawrynowicz
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Hugo @ 2025-04-18 15:29 UTC (permalink / raw)
To: Maciej Falkowski, dri-devel
Cc: oded.gabbay, jacek.lawrynowicz, lizhi.hou, Karol Wachowski
On 4/16/2025 4:26 AM, Maciej Falkowski wrote:
> From: Karol Wachowski <karol.wachowski@intel.com>
>
> 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: a19bffb10c46 ("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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] accel/ivpu: Correct DCT interrupt handling
2025-04-16 10:26 [PATCH] accel/ivpu: Correct DCT interrupt handling Maciej Falkowski
2025-04-18 15:29 ` Jeff Hugo
@ 2025-04-25 8:51 ` Jacek Lawrynowicz
1 sibling, 0 replies; 3+ messages in thread
From: Jacek Lawrynowicz @ 2025-04-25 8:51 UTC (permalink / raw)
To: Maciej Falkowski, dri-devel
Cc: oded.gabbay, quic_jhugo, lizhi.hou, Karol Wachowski
Applied to drm-misc-fixes
On 4/16/2025 12:26 PM, Maciej Falkowski wrote:
> From: Karol Wachowski <karol.wachowski@intel.com>
>
> 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: a19bffb10c46 ("accel/ivpu: Implement DCT handling")
> Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
> Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
> ---
> drivers/accel/ivpu/ivpu_hw_btrs.h | 2 +-
> drivers/accel/ivpu/ivpu_pm.c | 18 ++++++++++--------
> 2 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/accel/ivpu/ivpu_hw_btrs.h b/drivers/accel/ivpu/ivpu_hw_btrs.h
> index 300f749971d4..d2d82651976d 100644
> --- a/drivers/accel/ivpu/ivpu_hw_btrs.h
> +++ b/drivers/accel/ivpu/ivpu_hw_btrs.h
> @@ -14,7 +14,7 @@
> #define PLL_PROFILING_FREQ_DEFAULT 38400000
> #define PLL_PROFILING_FREQ_HIGH 400000000
>
> -#define DCT_DEFAULT_ACTIVE_PERCENT 15u
> +#define DCT_DEFAULT_ACTIVE_PERCENT 30u
> #define DCT_PERIOD_US 35300u
>
> int ivpu_hw_btrs_info_init(struct ivpu_device *vdev);
> diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
> index 1fe03fc16bbc..ea30db181cd7 100644
> --- a/drivers/accel/ivpu/ivpu_pm.c
> +++ b/drivers/accel/ivpu/ivpu_pm.c
> @@ -448,16 +448,17 @@ int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent)
> active_us = (DCT_PERIOD_US * active_percent) / 100;
> inactive_us = DCT_PERIOD_US - active_us;
>
> + vdev->pm->dct_active_percent = active_percent;
> +
> + ivpu_dbg(vdev, PM, "DCT requested %u%% (D0: %uus, D0i2: %uus)\n",
> + active_percent, active_us, inactive_us);
> +
> ret = ivpu_jsm_dct_enable(vdev, active_us, inactive_us);
> if (ret) {
> ivpu_err_ratelimited(vdev, "Failed to enable DCT: %d\n", ret);
> return ret;
> }
>
> - vdev->pm->dct_active_percent = active_percent;
> -
> - ivpu_dbg(vdev, PM, "DCT set to %u%% (D0: %uus, D0i2: %uus)\n",
> - active_percent, active_us, inactive_us);
> return 0;
> }
>
> @@ -465,15 +466,16 @@ int ivpu_pm_dct_disable(struct ivpu_device *vdev)
> {
> int ret;
>
> + vdev->pm->dct_active_percent = 0;
> +
> + ivpu_dbg(vdev, PM, "DCT requested to be disabled\n");
> +
> ret = ivpu_jsm_dct_disable(vdev);
> if (ret) {
> ivpu_err_ratelimited(vdev, "Failed to disable DCT: %d\n", ret);
> return ret;
> }
>
> - vdev->pm->dct_active_percent = 0;
> -
> - ivpu_dbg(vdev, PM, "DCT disabled\n");
> return 0;
> }
>
> @@ -486,7 +488,7 @@ void ivpu_pm_irq_dct_work_fn(struct work_struct *work)
> if (ivpu_hw_btrs_dct_get_request(vdev, &enable))
> return;
>
> - if (vdev->pm->dct_active_percent)
> + if (enable)
> ret = ivpu_pm_dct_enable(vdev, DCT_DEFAULT_ACTIVE_PERCENT);
> else
> ret = ivpu_pm_dct_disable(vdev);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-25 8:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 10:26 [PATCH] accel/ivpu: Correct DCT interrupt handling Maciej Falkowski
2025-04-18 15:29 ` Jeff Hugo
2025-04-25 8:51 ` Jacek Lawrynowicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).