Skip to content

Commit 836864a

Browse files
committed
drm/i915/dram: add return value and handling to intel_dram_detect()
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. Reviewed-by: Vinod Govindapillai <[email protected]> Link: https://lore.kernel.org/r/be2c31c459fb95d8161b719d499403eea5ec17b7.1748337870.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]>
1 parent bd0cffe commit 836864a

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

drivers/gpu/drm/i915/i915_driver.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,9 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
568568
* Fill the dram structure to get the system dram info. This will be
569569
* used for memory latency calculation.
570570
*/
571-
intel_dram_detect(dev_priv);
571+
ret = intel_dram_detect(dev_priv);
572+
if (ret)
573+
goto err_opregion;
572574

573575
intel_bw_init_hw(display);
574576

drivers/gpu/drm/i915/soc/intel_dram.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ static int xelpdp_get_dram_info(struct drm_i915_private *i915, struct dram_info
704704
return 0;
705705
}
706706

707-
void intel_dram_detect(struct drm_i915_private *i915)
707+
int intel_dram_detect(struct drm_i915_private *i915)
708708
{
709709
struct dram_info *dram_info = &i915->dram_info;
710710
int ret;
@@ -713,7 +713,7 @@ void intel_dram_detect(struct drm_i915_private *i915)
713713
detect_mem_freq(i915);
714714

715715
if (GRAPHICS_VER(i915) < 9 || IS_DG2(i915) || !HAS_DISPLAY(i915))
716-
return;
716+
return 0;
717717

718718
/*
719719
* Assume level 0 watermark latency adjustment is needed until proven
@@ -735,15 +735,18 @@ void intel_dram_detect(struct drm_i915_private *i915)
735735
drm_dbg_kms(&i915->drm, "DRAM type: %s\n",
736736
intel_dram_type_str(dram_info->type));
737737

738+
/* TODO: Do we want to abort probe on dram detection failures? */
738739
if (ret)
739-
return;
740+
return 0;
740741

741742
drm_dbg_kms(&i915->drm, "Num qgv points %u\n", dram_info->num_qgv_points);
742743

743744
drm_dbg_kms(&i915->drm, "DRAM channels: %u\n", dram_info->num_channels);
744745

745746
drm_dbg_kms(&i915->drm, "Watermark level 0 adjustment needed: %s\n",
746747
str_yes_no(dram_info->wm_lv_0_adjust_needed));
748+
749+
return 0;
747750
}
748751

749752
const struct dram_info *intel_dram_info(struct drm_device *drm)

drivers/gpu/drm/i915/soc/intel_dram.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct drm_device;
1111
struct dram_info;
1212

1313
void intel_dram_edram_detect(struct drm_i915_private *i915);
14-
void intel_dram_detect(struct drm_i915_private *i915);
14+
int intel_dram_detect(struct drm_i915_private *i915);
1515
unsigned int i9xx_fsb_freq(struct drm_i915_private *i915);
1616
const struct dram_info *intel_dram_info(struct drm_device *drm);
1717

drivers/gpu/drm/xe/display/xe_display.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ int xe_display_init_early(struct xe_device *xe)
122122
* Fill the dram structure to get the system dram info. This will be
123123
* used for memory latency calculation.
124124
*/
125-
intel_dram_detect(xe);
125+
err = intel_dram_detect(xe);
126+
if (err)
127+
goto err_opregion;
126128

127129
intel_bw_init_hw(display);
128130

0 commit comments

Comments
 (0)