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 5/6] drm/i915/dram: add return value and handling to intel_dram_detect()
Date: Wed, 4 Jun 2025 13:53:24 +0000	[thread overview]
Message-ID: <1b9550075f9620be90ea66fee0f708b3e82bd279.camel@intel.com> (raw)
In-Reply-To: <be2c31c459fb95d8161b719d499403eea5ec17b7.1748337870.git.jani.nikula@intel.com>

On Tue, 2025-05-27 at 12:25 +0300, Jani Nikula wrote:
> We'll want to start returning errors from intel_dram_detect(). As the
> first step, add the return value and error handling, even if we still
> only return 0.
> 
> Do no functional changes, but leave a comment about whether we should
> bail out on dram detection failures.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_driver.c      | 4 +++-
>  drivers/gpu/drm/i915/soc/intel_dram.c   | 9 ++++++---
>  drivers/gpu/drm/i915/soc/intel_dram.h   | 2 +-
>  drivers/gpu/drm/xe/display/xe_display.c | 4 +++-
>  4 files changed, 13 insertions(+), 6 deletions(-)
> 

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

> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 3b0bda74697d..20691a85d513 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -568,7 +568,9 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
>  	 * Fill the dram structure to get the system dram info. This will be
>  	 * used for memory latency calculation.
>  	 */
> -	intel_dram_detect(dev_priv);
> +	ret = intel_dram_detect(dev_priv);
> +	if (ret)
> +		goto err_opregion;
>  
>  	intel_bw_init_hw(display);
>  
> diff --git a/drivers/gpu/drm/i915/soc/intel_dram.c b/drivers/gpu/drm/i915/soc/intel_dram.c
> index f42dcdb74d40..e7fa938c98cf 100644
> --- a/drivers/gpu/drm/i915/soc/intel_dram.c
> +++ b/drivers/gpu/drm/i915/soc/intel_dram.c
> @@ -704,7 +704,7 @@ static int xelpdp_get_dram_info(struct drm_i915_private *i915, struct
> dram_info
>  	return 0;
>  }
>  
> -void intel_dram_detect(struct drm_i915_private *i915)
> +int intel_dram_detect(struct drm_i915_private *i915)
>  {
>  	struct dram_info *dram_info = &i915->dram_info;
>  	int ret;
> @@ -713,7 +713,7 @@ void intel_dram_detect(struct drm_i915_private *i915)
>  	detect_mem_freq(i915);
>  
>  	if (GRAPHICS_VER(i915) < 9 || IS_DG2(i915) || !HAS_DISPLAY(i915))
> -		return;
> +		return 0;
>  
>  	/*
>  	 * Assume level 0 watermark latency adjustment is needed until proven
> @@ -735,8 +735,9 @@ void intel_dram_detect(struct drm_i915_private *i915)
>  	drm_dbg_kms(&i915->drm, "DRAM type: %s\n",
>  		    intel_dram_type_str(dram_info->type));
>  
> +	/* TODO: Do we want to abort probe on dram detection failures? */
>  	if (ret)
> -		return;
> +		return 0;
>  
>  	drm_dbg_kms(&i915->drm, "Num qgv points %u\n", dram_info->num_qgv_points);
>  
> @@ -744,6 +745,8 @@ void intel_dram_detect(struct drm_i915_private *i915)
>  
>  	drm_dbg_kms(&i915->drm, "Watermark level 0 adjustment needed: %s\n",
>  		    str_yes_no(dram_info->wm_lv_0_adjust_needed));
> +
> +	return 0;
>  }
>  
>  const struct dram_info *intel_dram_info(struct drm_device *drm)
> diff --git a/drivers/gpu/drm/i915/soc/intel_dram.h b/drivers/gpu/drm/i915/soc/intel_dram.h
> index 17a20cd2c6d5..25fe60b2b117 100644
> --- a/drivers/gpu/drm/i915/soc/intel_dram.h
> +++ b/drivers/gpu/drm/i915/soc/intel_dram.h
> @@ -11,7 +11,7 @@ struct drm_device;
>  struct dram_info;
>  
>  void intel_dram_edram_detect(struct drm_i915_private *i915);
> -void intel_dram_detect(struct drm_i915_private *i915);
> +int intel_dram_detect(struct drm_i915_private *i915);
>  unsigned int i9xx_fsb_freq(struct drm_i915_private *i915);
>  const struct dram_info *intel_dram_info(struct drm_device *drm);
>  
> diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> index 3f92bf51813e..eafe2f093a6c 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.c
> +++ b/drivers/gpu/drm/xe/display/xe_display.c
> @@ -122,7 +122,9 @@ int xe_display_init_early(struct xe_device *xe)
>  	 * Fill the dram structure to get the system dram info. This will be
>  	 * used for memory latency calculation.
>  	 */
> -	intel_dram_detect(xe);
> +	err = intel_dram_detect(xe);
> +	if (err)
> +		goto err_opregion;
>  
>  	intel_bw_init_hw(display);
>  


  reply	other threads:[~2025-06-04 13:53 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
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 [this message]
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=1b9550075f9620be90ea66fee0f708b3e82bd279.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