All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kandpal, Suraj" <suraj.kandpal@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
Subject: RE: [PATCH 2/2] drm/i915/lnl: Program PKGC_LATENCY register
Date: Mon, 5 Feb 2024 17:22:30 +0000	[thread overview]
Message-ID: <SN7PR11MB675090C2560FBDD0C8D50714E3472@SN7PR11MB6750.namprd11.prod.outlook.com> (raw)
In-Reply-To: <87le7zdxid.fsf@intel.com>

> Subject: Re: [PATCH 2/2] drm/i915/lnl: Program PKGC_LATENCY register
> 
> On Mon, 05 Feb 2024, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> > Program the PKGC_LATENCY register with the highest latency from level
> > 1 and above LP registers else program with all 1's.
> > This is used to improve package C residency by sending the highest
> > latency tolerance requirement (LTR) when the planes are done with the
> > frame until the next frame programming window (set context latency,
> > window 2) starts.
> > Bspec: 68986
> >
> > --v2
> > -Fix indentation [Chaitanya]
> >
> > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> > Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/skl_watermark.c | 31
> > ++++++++++++++++++++
> >  1 file changed, 31 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c
> > b/drivers/gpu/drm/i915/display/skl_watermark.c
> > index 051a02ac01a4..1ce4b33a407a 100644
> > --- a/drivers/gpu/drm/i915/display/skl_watermark.c
> > +++ b/drivers/gpu/drm/i915/display/skl_watermark.c
> > @@ -3394,6 +3394,34 @@ static void skl_read_wm_latency(struct
> drm_i915_private *i915, u16 wm[])
> >  	adjust_wm_latency(i915, wm, num_levels, read_latency);  }
> >
> > +/*
> > + * Program PKG_C_LATENCY Pkg C with highest valid latency from
> > + * watermark level1 and up and above. If watermark level 1 is
> > + * invalid program it with all 1's.
> > + * Program PKG_C_LATENCY Added Wake Time = 0.
> > + */
> > +static void intel_program_pkgc_latency(struct drm_i915_private *i915,
> > +				       u16 wm_latency[])
> > +{
> > +	u16 max_value = 0;
> > +	u32 clear = 0, val = 0;
> > +	int max_level = i915->display.wm.num_levels, i;
> 
> max_level seems useless, only used once.

Sure will fix this.

> 
> > +
> > +	for (i = 1; i <= max_level; i++) {
> 
> Array access goes out of bounds. Boom.
> 

Will fix this

> > +		if (wm_latency[i] == 0)
> > +			break;
> > +		else if (wm_latency[i] > max_value)
> > +			max_value = wm_latency[i];
> > +	}
> > +
> > +	if (max_value == 0)
> > +		max_value = ~0 & LNL_PKG_C_LATENCY_MASK;
> 
> What does "~0 &" gain you here?
> 

So max value is 0 for all bits except 0-12 as we need to set them as all 1's to disable deep pkgc State

> > +
> > +	clear |= LNL_ADDED_WAKE_TIME_MASK |
> LNL_PKG_C_LATENCY_MASK;
> > +	val |= max_value;
> 
> If you have fields defined for the register, why not use it for setting max value
> too?

Sorry I didn't get you here .

> 
> > +	intel_uncore_rmw(&i915->uncore, LNL_PKG_C_LATENCY, clear, val); }
> > +
> >  static void skl_setup_wm_latency(struct drm_i915_private *i915)  {
> >  	if (HAS_HW_SAGV_WM(i915))
> > @@ -3407,6 +3435,9 @@ static void skl_setup_wm_latency(struct
> drm_i915_private *i915)
> >  		skl_read_wm_latency(i915, i915->display.wm.skl_latency);
> >
> >  	intel_print_wm_latency(i915, "Gen9 Plane",
> > i915->display.wm.skl_latency);
> > +
> > +	if (DISPLAY_VER(i915) >= 20)
> > +		intel_program_pkgc_latency(i915, i915-
> >display.wm.skl_latency);
> 
> Before this, nothing in the skl_wm_init() path actually writes any registers, it's
> all readout. Is this the right place to be doing this?
> 

Yes since all latency values are all ready and available for use which we can program in the deep pkgc register.

Regards,
Suraj Kandpal
> >  }
> >
> >  static const struct intel_wm_funcs skl_wm_funcs = {
> 
> --
> Jani Nikula, Intel

  reply	other threads:[~2024-02-05 17:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01  8:51 [PATCH 0/2] Program Deep PKG_C_LATENCY register Suraj Kandpal
2024-02-01  8:51 ` [PATCH 1/2] drm/i915/lnl: Add pkgc related register Suraj Kandpal
2024-02-02  7:37   ` Borah, Chaitanya Kumar
2024-02-07 10:46   ` Govindapillai, Vinod
2024-02-01  8:51 ` [PATCH 2/2] drm/i915/lnl: Program PKGC_LATENCY register Suraj Kandpal
2024-02-05  7:55   ` Borah, Chaitanya Kumar
2024-02-05  8:01   ` Suraj Kandpal
2024-02-05 10:19     ` Jani Nikula
2024-02-05 17:22       ` Kandpal, Suraj [this message]
2024-02-08  8:59         ` Jani Nikula
2024-02-07 11:21     ` Govindapillai, Vinod
2024-02-13  6:28     ` Suraj Kandpal
2024-02-14 10:43       ` Govindapillai, Vinod
2024-02-19  6:36       ` Suraj Kandpal
2024-02-19  9:23         ` Govindapillai, Vinod
2024-02-01 16:36 ` ✗ Fi.CI.SPARSE: warning for Program Deep PKG_C_LATENCY register Patchwork
2024-02-01 19:55 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-01 21:56 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-05  9:47 ` ✗ Fi.CI.SPARSE: warning for Program Deep PKG_C_LATENCY register (rev2) Patchwork
2024-02-05 10:01 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-05 12:37 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-13  7:34 ` ✗ Fi.CI.SPARSE: warning for Program Deep PKG_C_LATENCY register (rev3) Patchwork
2024-02-13  7:48 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-13  9:25 ` ✓ Fi.CI.IGT: " Patchwork
2024-02-19  7:21 ` ✗ Fi.CI.SPARSE: warning for Program Deep PKG_C_LATENCY register (rev4) Patchwork
2024-02-19  7:34 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-19  9:19 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-20 11:22 ` ✓ Fi.CI.IGT: success " 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=SN7PR11MB675090C2560FBDD0C8D50714E3472@SN7PR11MB6750.namprd11.prod.outlook.com \
    --to=suraj.kandpal@intel.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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.