Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Govindapillai, Vinod" <vinod.govindapillai@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Nikula, Jani" <jani.nikula@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [RESEND 4/6] drm/i915/dram: pass struct dram_info pointer around
Date: Wed, 4 Jun 2025 13:37:49 +0000	[thread overview]
Message-ID: <c385505d30bd81b9ed6a7c80b87ffc69372685ab.camel@intel.com> (raw)
In-Reply-To: <8ac6b308b210cf4a429d5abfb9bf32737dcab51f.1748337870.git.jani.nikula@intel.com>

On Tue, 2025-05-27 at 12:25 +0300, Jani Nikula wrote:
> Figure out the struct dram_info pointer in one place, and pass that
> around to be filled in, instead of all places poking at i915->dram_info
> directly.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/soc/intel_dram.c | 40 ++++++++++++---------------
>  1 file changed, 18 insertions(+), 22 deletions(-)
> 

Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>


> diff --git a/drivers/gpu/drm/i915/soc/intel_dram.c b/drivers/gpu/drm/i915/soc/intel_dram.c
> index 76c225fd6c70..f42dcdb74d40 100644
> --- a/drivers/gpu/drm/i915/soc/intel_dram.c
> +++ b/drivers/gpu/drm/i915/soc/intel_dram.c
> @@ -383,9 +383,8 @@ intel_is_dram_symmetric(const struct dram_channel_info *ch0,
>  }
>  
>  static int
> -skl_dram_get_channels_info(struct drm_i915_private *i915)
> +skl_dram_get_channels_info(struct drm_i915_private *i915, struct dram_info *dram_info)
>  {
> -	struct dram_info *dram_info = &i915->dram_info;
>  	struct dram_channel_info ch0 = {}, ch1 = {};
>  	u32 val;
>  	int ret;
> @@ -446,14 +445,13 @@ skl_get_dram_type(struct drm_i915_private *i915)
>  }
>  
>  static int
> -skl_get_dram_info(struct drm_i915_private *i915)
> +skl_get_dram_info(struct drm_i915_private *i915, struct dram_info *dram_info)
>  {
> -	struct dram_info *dram_info = &i915->dram_info;
>  	int ret;
>  
>  	dram_info->type = skl_get_dram_type(i915);
>  
> -	ret = skl_dram_get_channels_info(i915);
> +	ret = skl_dram_get_channels_info(i915, dram_info);
>  	if (ret)
>  		return ret;
>  
> @@ -538,9 +536,8 @@ static void bxt_get_dimm_info(struct dram_dimm_info *dimm, u32 val)
>  	dimm->size = bxt_get_dimm_size(val) * intel_dimm_num_devices(dimm);
>  }
>  
> -static int bxt_get_dram_info(struct drm_i915_private *i915)
> +static int bxt_get_dram_info(struct drm_i915_private *i915, struct dram_info *dram_info)
>  {
> -	struct dram_info *dram_info = &i915->dram_info;
>  	u32 val;
>  	u8 valid_ranks = 0;
>  	int i;
> @@ -585,9 +582,9 @@ static int bxt_get_dram_info(struct drm_i915_private *i915)
>  	return 0;
>  }
>  
> -static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv)
> +static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv,
> +					  struct dram_info *dram_info)
>  {
> -	struct dram_info *dram_info = &dev_priv->dram_info;
>  	u32 val = 0;
>  	int ret;
>  
> @@ -647,27 +644,26 @@ static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv)
>  	return 0;
>  }
>  
> -static int gen11_get_dram_info(struct drm_i915_private *i915)
> +static int gen11_get_dram_info(struct drm_i915_private *i915, struct dram_info *dram_info)
>  {
> -	int ret = skl_get_dram_info(i915);
> +	int ret = skl_get_dram_info(i915, dram_info);
>  
>  	if (ret)
>  		return ret;
>  
> -	return icl_pcode_read_mem_global_info(i915);
> +	return icl_pcode_read_mem_global_info(i915, dram_info);
>  }
>  
> -static int gen12_get_dram_info(struct drm_i915_private *i915)
> +static int gen12_get_dram_info(struct drm_i915_private *i915, struct dram_info *dram_info)
>  {
> -	i915->dram_info.wm_lv_0_adjust_needed = false;
> +	dram_info->wm_lv_0_adjust_needed = false;
>  
> -	return icl_pcode_read_mem_global_info(i915);
> +	return icl_pcode_read_mem_global_info(i915, dram_info);
>  }
>  
> -static int xelpdp_get_dram_info(struct drm_i915_private *i915)
> +static int xelpdp_get_dram_info(struct drm_i915_private *i915, struct dram_info *dram_info)
>  {
>  	u32 val = intel_uncore_read(&i915->uncore, MTL_MEM_SS_INFO_GLOBAL);
> -	struct dram_info *dram_info = &i915->dram_info;
>  
>  	switch (REG_FIELD_GET(MTL_DDR_TYPE_MASK, val)) {
>  	case 0:
> @@ -726,15 +722,15 @@ void intel_dram_detect(struct drm_i915_private *i915)
>  	dram_info->wm_lv_0_adjust_needed = !IS_BROXTON(i915) && !IS_GEMINILAKE(i915);
>  
>  	if (DISPLAY_VER(i915) >= 14)
> -		ret = xelpdp_get_dram_info(i915);
> +		ret = xelpdp_get_dram_info(i915, dram_info);
>  	else if (GRAPHICS_VER(i915) >= 12)
> -		ret = gen12_get_dram_info(i915);
> +		ret = gen12_get_dram_info(i915, dram_info);
>  	else if (GRAPHICS_VER(i915) >= 11)
> -		ret = gen11_get_dram_info(i915);
> +		ret = gen11_get_dram_info(i915, dram_info);
>  	else if (IS_BROXTON(i915) || IS_GEMINILAKE(i915))
> -		ret = bxt_get_dram_info(i915);
> +		ret = bxt_get_dram_info(i915, dram_info);
>  	else
> -		ret = skl_get_dram_info(i915);
> +		ret = skl_get_dram_info(i915, dram_info);
>  
>  	drm_dbg_kms(&i915->drm, "DRAM type: %s\n",
>  		    intel_dram_type_str(dram_info->type));


  reply	other threads:[~2025-06-04 13:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27  9:25 [RESEND 0/6] drm/i915/dram: dram_info refactoring Jani Nikula
2025-05-27  9:25 ` [RESEND 1/6] drm/i915/bw: pass struct dram_info pointer around Jani Nikula
2025-06-04 12:45   ` Govindapillai, Vinod
2025-06-04 16:14     ` Jani Nikula
2025-05-27  9:25 ` [RESEND 2/6] drm/i915/dram: add accessor for struct dram_info and use it Jani Nikula
2025-06-04 12:54   ` Govindapillai, Vinod
2025-05-27  9:25 ` [RESEND 3/6] drm/i915/wm: DG2 doesn't have dram info to look up wm_lv_0_adjust_needed Jani Nikula
2025-06-04 13:33   ` Govindapillai, Vinod
2025-06-04 13:41     ` Govindapillai, Vinod
2025-06-04 13:45     ` Jani Nikula
2025-05-27  9:25 ` [RESEND 4/6] drm/i915/dram: pass struct dram_info pointer around Jani Nikula
2025-06-04 13:37   ` Govindapillai, Vinod [this message]
2025-05-27  9:25 ` [RESEND 5/6] drm/i915/dram: add return value and handling to intel_dram_detect() Jani Nikula
2025-06-04 13:53   ` Govindapillai, Vinod
2025-05-27  9:25 ` [RESEND 6/6] drm/i915/dram: allocate struct dram_info dynamically Jani Nikula
2025-06-04 14:24   ` Govindapillai, Vinod
2025-05-27 16:08 ` ✓ CI.Patch_applied: success for drm/i915/dram: dram_info refactoring (rev2) Patchwork
2025-05-27 16:08 ` ✓ CI.checkpatch: " Patchwork
2025-05-27 16:09 ` ✓ CI.KUnit: " Patchwork
2025-05-27 16:23 ` ✓ CI.Build: " Patchwork
2025-05-27 16:24 ` ✓ CI.Hooks: " Patchwork
2025-05-27 16:26 ` ✓ CI.checksparse: " Patchwork
2025-05-27 16:57 ` ✓ Xe.CI.BAT: " Patchwork
2025-05-27 19:06 ` ✓ Xe.CI.Full: " 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=c385505d30bd81b9ed6a7c80b87ffc69372685ab.camel@intel.com \
    --to=vinod.govindapillai@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@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