All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeffrey Hugo <quic_jhugo@quicinc.com>
To: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,
	<dri-devel@lists.freedesktop.org>
Cc: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>,
	Oded Gabbay <ogabbay@kernel.org>,
	Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Subject: Re: [PATCH 7/7] accel/ivpu: Fix VPU clock calculation
Date: Wed, 22 Mar 2023 08:52:56 -0600	[thread overview]
Message-ID: <56d8982a-6d86-19d2-74ca-efede0414af7@quicinc.com> (raw)
In-Reply-To: <20230322091900.1982453-8-stanislaw.gruszka@linux.intel.com>

On 3/22/2023 3:19 AM, Stanislaw Gruszka wrote:
> VPU cpu clock frequency depends on the workpoint configuration
> that was granted by the punit. Previously driver was passing
> incorrect frequency to the VPU firmware.

This looks like past tense.  I believe the preference is to use the 
present tense for commit text.  Something like "the driver calculates 
the wrong frequency because it ignores the workpoint config and this 
causes X.  Fix this by using the workpoint config in the freq calculations".

Should this have a fixes tag?  Sounds like this addresses a bug.

> Co-developed-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
> ---
>   drivers/accel/ivpu/ivpu_hw_mtl.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/accel/ivpu/ivpu_hw_mtl.c b/drivers/accel/ivpu/ivpu_hw_mtl.c
> index 98c8a4aa25f0..382ec127be8e 100644
> --- a/drivers/accel/ivpu/ivpu_hw_mtl.c
> +++ b/drivers/accel/ivpu/ivpu_hw_mtl.c
> @@ -29,7 +29,6 @@
>   
>   #define PLL_REF_CLK_FREQ	     (50 * 1000000)
>   #define PLL_SIMULATION_FREQ	     (10 * 1000000)
> -#define PLL_RATIO_TO_FREQ(x)	     ((x) * PLL_REF_CLK_FREQ)
>   #define PLL_DEFAULT_EPP_VALUE	     0x80
>   
>   #define TIM_SAFE_ENABLE		     0xf1d0dead
> @@ -789,6 +788,19 @@ static void ivpu_hw_mtl_wdt_disable(struct ivpu_device *vdev)
>   	REGV_WR32(MTL_VPU_CPU_SS_TIM_GEN_CONFIG, val);
>   }
>   
> +static u32 ivpu_hw_mtl_pll_to_freq(u32 ratio, u32 config)
> +{
> +	u32 pll_clock = PLL_REF_CLK_FREQ * ratio;
> +	u32 cpu_clock;
> +
> +	if ((config & 0xff) == PLL_RATIO_4_3)
> +		cpu_clock = pll_clock * 2 / 4;
> +	else
> +		cpu_clock = pll_clock * 2 / 5;
> +
> +	return cpu_clock;
> +}
> +
>   /* Register indirect accesses */
>   static u32 ivpu_hw_mtl_reg_pll_freq_get(struct ivpu_device *vdev)
>   {
> @@ -800,7 +812,7 @@ static u32 ivpu_hw_mtl_reg_pll_freq_get(struct ivpu_device *vdev)
>   	if (!ivpu_is_silicon(vdev))
>   		return PLL_SIMULATION_FREQ;
>   
> -	return PLL_RATIO_TO_FREQ(pll_curr_ratio);
> +	return ivpu_hw_mtl_pll_to_freq(pll_curr_ratio, vdev->hw->config);
>   }
>   
>   static u32 ivpu_hw_mtl_reg_telemetry_offset_get(struct ivpu_device *vdev)


  reply	other threads:[~2023-03-22 14:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  9:18 [PATCH 0/7] acell/ivpu: Fixes for 6.3 Stanislaw Gruszka
2023-03-22  9:18 ` [PATCH 1/7] accel/ivpu: Do not access HW registers after unbind Stanislaw Gruszka
2023-03-22 14:16   ` Jeffrey Hugo
2023-03-22  9:18 ` [PATCH 2/7] accel/ivpu: Cancel recovery work Stanislaw Gruszka
2023-03-22 14:21   ` Jeffrey Hugo
2023-03-22 14:55     ` Stanislaw Gruszka
2023-03-22  9:18 ` [PATCH 3/7] accel/ivpu: Do not use SSID 1 Stanislaw Gruszka
2023-03-22 14:25   ` Jeffrey Hugo
2023-03-22 15:10     ` Stanislaw Gruszka
2023-03-22  9:18 ` [PATCH 4/7] accel/ivpu: Fix power down sequence Stanislaw Gruszka
2023-03-22 14:28   ` Jeffrey Hugo
2023-03-22  9:18 ` [PATCH 5/7] accel/ivpu: Disable buttress on device removal Stanislaw Gruszka
2023-03-22 14:33   ` Jeffrey Hugo
2023-03-22  9:18 ` [PATCH 6/7] accel/ivpu: Remove support for 1 tile SKUs Stanislaw Gruszka
2023-03-22 14:36   ` Jeffrey Hugo
2023-03-22  9:19 ` [PATCH 7/7] accel/ivpu: Fix VPU clock calculation Stanislaw Gruszka
2023-03-22 14:52   ` Jeffrey Hugo [this message]
2023-03-22 16:28     ` Stanislaw Gruszka
2023-03-23 11:00       ` Stanislaw Gruszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56d8982a-6d86-19d2-74ca-efede0414af7@quicinc.com \
    --to=quic_jhugo@quicinc.com \
    --cc=andrzej.kacprowski@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=ogabbay@kernel.org \
    --cc=stanislaw.gruszka@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.