Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Vivekanandan, Balasubramani" <balasubramani.vivekanandan@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>,
	<intel-gfx@lists.freedesktop.org>,
	 <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/4] drm/i915/gt: Replace TIMESTAMP_OVERRIDE readout
Date: Mon, 24 Feb 2025 19:25:04 +0530	[thread overview]
Message-ID: <Z7x6OJRYc-1Y0opW@bvivekan-mobl1> (raw)
In-Reply-To: <20250221003843.443559-8-matthew.d.roper@intel.com>

On 20.02.2025 16:38, Matt Roper wrote:
> The whole GT CS clock initialization area is poorly documented in the
> specs and a lot of this code seems to have been inherited from the
> Windows driver team long ago.  There's nothing in the specs that
> specifically explains using the display reference frequency, as taken
> from TIMESTAMP_OVERRIDE register, to determine the GT command streamer
> clock.  But if the goal is just to get the display reference clock, we
> already have existing display code that takes care of that in a more
> straightforward manner (i.e., by either reading the strap register or
> using a per-platform constant).  Let's drop the usage of
> TIMESTAMP_OVERRIDE (which is a bit questionable to begin with since this
> is a display debug register) and replace it with a call to our existing
> display function.
> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

Looks good to me.

Reviewed-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>

Regards,
Bala

> ---
>  .../gpu/drm/i915/gt/intel_gt_clock_utils.c    | 31 ++++++-------------
>  1 file changed, 9 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c b/drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c
> index 6e63505fe478..adc21c3322da 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c
> @@ -11,23 +11,6 @@
>  #include "intel_gt_regs.h"
>  #include "soc/intel_dram.h"
>  
> -static u32 read_reference_ts_freq(struct intel_uncore *uncore)
> -{
> -	u32 ts_override = intel_uncore_read(uncore, GEN9_TIMESTAMP_OVERRIDE);
> -	u32 base_freq, frac_freq;
> -
> -	base_freq = ((ts_override & GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_MASK) >>
> -		     GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_SHIFT) + 1;
> -	base_freq *= 1000000;
> -
> -	frac_freq = ((ts_override &
> -		      GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_MASK) >>
> -		     GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_SHIFT);
> -	frac_freq = 1000000 / (frac_freq + 1);
> -
> -	return base_freq + frac_freq;
> -}
> -
>  static u32 gen11_get_crystal_clock_freq(struct intel_uncore *uncore,
>  					u32 rpm_config_reg)
>  {
> @@ -64,12 +47,14 @@ static u32 gen11_read_clock_frequency(struct intel_uncore *uncore)
>  	 * We do not, and we assume nobody else does.
>  	 *
>  	 * First figure out the reference frequency. There are 2 ways
> -	 * we can compute the frequency, either through the
> -	 * TIMESTAMP_OVERRIDE register or through RPM_CONFIG. CTC_MODE
> -	 * tells us which one we should use.
> +	 * we can compute the frequency, either from the display reference
> +	 * clock or through RPM_CONFIG. CTC_MODE tells us which one we should
> +	 * use.
>  	 */
>  	if ((ctc_reg & CTC_SOURCE_PARAMETER_MASK) == CTC_SOURCE_DIVIDE_LOGIC) {
> -		freq = read_reference_ts_freq(uncore);
> +		struct intel_display *display = &uncore->i915->display;
> +
> +		freq = intel_display_get_refclk(display) * 1000;
>  	} else {
>  		u32 c0 = intel_uncore_read(uncore, RPM_CONFIG0);
>  
> @@ -93,7 +78,9 @@ static u32 gen9_read_clock_frequency(struct intel_uncore *uncore)
>  	u32 freq = 0;
>  
>  	if ((ctc_reg & CTC_SOURCE_PARAMETER_MASK) == CTC_SOURCE_DIVIDE_LOGIC) {
> -		freq = read_reference_ts_freq(uncore);
> +		struct intel_display *display = &uncore->i915->display;
> +
> +		freq = intel_display_get_refclk(display) * 1000;
>  	} else {
>  		freq = IS_GEN9_LP(uncore->i915) ? 19200000 : 24000000;
>  
> -- 
> 2.48.1
> 

  reply	other threads:[~2025-02-24 13:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21  0:38 [PATCH 0/4] Stop accessing display TIMESTAMP_OVERRIDE in GT code Matt Roper
2025-02-21  0:38 ` [PATCH 1/4] drm/i915/display: Make refclk fetching logic reusable Matt Roper
2025-02-24  9:13   ` Jani Nikula
2025-02-24 13:31   ` Vivekanandan, Balasubramani
2025-02-21  0:38 ` [PATCH 2/4] drm/i915/gt: Replace TIMESTAMP_OVERRIDE readout Matt Roper
2025-02-24 13:55   ` Vivekanandan, Balasubramani [this message]
2025-02-21  0:38 ` [PATCH 3/4] drm/xe: Drop usage of TIMESTAMP_OVERRIDE Matt Roper
2025-02-21  3:35   ` Lucas De Marchi
2025-02-21  4:25   ` kernel test robot
2025-02-24 14:13   ` Vivekanandan, Balasubramani
2025-02-21  0:38 ` [PATCH 4/4] drm/xe/sriov: Drop TIMESTAMP_OVERRIDE from Xe2 runtime regs Matt Roper
2025-02-21  0:44 ` ✓ CI.Patch_applied: success for Stop accessing display TIMESTAMP_OVERRIDE in GT code Patchwork
2025-02-21  0:44 ` ✓ CI.checkpatch: " Patchwork
2025-02-21  0:46 ` ✓ CI.KUnit: " Patchwork
2025-02-21  1:02 ` ✓ CI.Build: " Patchwork
2025-02-21  1:05 ` ✓ CI.Hooks: " Patchwork
2025-02-21  1:06 ` ✗ CI.checksparse: warning " Patchwork
2025-02-21  1:26 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-21 17:01 ` ✗ Xe.CI.Full: failure " Patchwork

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=Z7x6OJRYc-1Y0opW@bvivekan-mobl1 \
    --to=balasubramani.vivekanandan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox