intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 3/4] drm/i915: Fail driver probe when unable to load DRAM information
Date: Wed, 20 Jan 2021 07:16:10 -0800	[thread overview]
Message-ID: <20210120151611.132591-3-jose.souza@intel.com> (raw)
In-Reply-To: <20210120151611.132591-1-jose.souza@intel.com>

DRAM information is required to properly program display.
Before "drm/i915/gen11+: Only load DRAM information from pcode" we
were failing driver load if unable to fetch DRAM information from
pcode form GEN11+ but we should also extend it to GEN9 plaforms.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c   |  6 +++++-
 drivers/gpu/drm/i915/intel_dram.c | 13 +++++++++----
 drivers/gpu/drm/i915/intel_dram.h |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 66f763fe7a83..6bfcd3ee6c66 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -615,12 +615,16 @@ 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_dram;
 
 	intel_bw_init_hw(dev_priv);
 
 	return 0;
 
+err_dram:
+	intel_gvt_driver_remove(dev_priv);
 err_msi:
 	if (pdev->msi_enabled)
 		pci_disable_msi(pdev);
diff --git a/drivers/gpu/drm/i915/intel_dram.c b/drivers/gpu/drm/i915/intel_dram.c
index 1298823c957c..4871d48589f9 100644
--- a/drivers/gpu/drm/i915/intel_dram.c
+++ b/drivers/gpu/drm/i915/intel_dram.c
@@ -481,7 +481,7 @@ static int gen11_get_dram_info(struct drm_i915_private *i915)
 	return icl_pcode_read_mem_global_info(i915);
 }
 
-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;
@@ -494,7 +494,7 @@ void intel_dram_detect(struct drm_i915_private *i915)
 	dram_info->is_16gb_dimm = !IS_GEN9_LP(i915);
 
 	if (INTEL_GEN(i915) < 9 || !HAS_DISPLAY(i915))
-		return;
+		return 0;
 
 	if (INTEL_GEN(i915) >= 11)
 		ret = gen11_get_dram_info(i915);
@@ -502,13 +502,18 @@ void intel_dram_detect(struct drm_i915_private *i915)
 		ret = bxt_get_dram_info(i915);
 	else
 		ret = skl_get_dram_info(i915);
-	if (ret)
-		return;
+
+	if (ret) {
+		drm_warn(&i915->drm, "Unable to load dram information\n");
+		return ret;
+	}
 
 	drm_dbg_kms(&i915->drm, "DRAM channels: %u\n", dram_info->num_channels);
 
 	drm_dbg_kms(&i915->drm, "DRAM 16Gb DIMMs: %s\n",
 		    yesno(dram_info->is_16gb_dimm));
+
+	return 0;
 }
 
 static u32 gen9_edram_size_mb(struct drm_i915_private *i915, u32 cap)
diff --git a/drivers/gpu/drm/i915/intel_dram.h b/drivers/gpu/drm/i915/intel_dram.h
index 4ba13c13162c..2a0f283b1a1d 100644
--- a/drivers/gpu/drm/i915/intel_dram.h
+++ b/drivers/gpu/drm/i915/intel_dram.h
@@ -9,6 +9,6 @@
 struct drm_i915_private;
 
 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);
 
 #endif /* __INTEL_DRAM_H__ */
-- 
2.30.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2021-01-20 15:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 15:16 [Intel-gfx] [PATCH 1/4] drm/i915: Nuke not needed members of dram_info José Roberto de Souza
2021-01-20 15:16 ` [Intel-gfx] [PATCH 2/4] drm/i915/gen11+: Only load DRAM information from pcode José Roberto de Souza
2021-01-27 14:49   ` Lucas De Marchi
2021-01-27 16:37     ` Souza, Jose
2021-01-20 15:16 ` José Roberto de Souza [this message]
2021-01-20 15:16 ` [Intel-gfx] [PATCH 4/4] drm/i915: Rename is_16gb_dimm to wm_lv_0_adjust_needed José Roberto de Souza
2021-01-27 14:56   ` Lucas De Marchi
     [not found] ` <20210120183151.jpfuda4htxs5qkxq@ldmartin-desk1>
     [not found]   ` <5168c1572a7c106313f7c47194cae267835b32af.camel@intel.com>
     [not found]     ` <20210120185245.2eqa42nmbm6yzeki@ldmartin-desk1>
2021-01-20 19:29       ` [Intel-gfx] [PATCH 1/4] drm/i915: Nuke not needed members of dram_info Souza, Jose
2021-01-27 14:35         ` Lucas De Marchi
2021-01-20 21:32 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/4] " Patchwork
2021-01-21 22:35 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915: Nuke not needed members of dram_info (rev2) Patchwork
2021-01-22 18:49 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915: Nuke not needed members of dram_info (rev3) 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=20210120151611.132591-3-jose.souza@intel.com \
    --to=jose.souza@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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;
as well as URLs for NNTP newsgroup(s).