[Intel-gfx] [PATCH 2/5] drm/i915: Store first production revid into device info

Mika Kuoppala mika.kuoppala at linux.intel.com
Fri Jun 8 13:42:02 UTC 2018


Store first known production revid into the device info.

This enables us to easily see if we are running on
a preproduction hardware.

Uninitialized (zero) product revision id means that
there are no known preliminary hardware for this platform,
or that the platform is of gen that we don't care.
This is all pre gen9 platforms.

Unknown product revision maps to REVID_FOREVER on a
gen9+ platforms on default. When the platform
gets the first production revision and our testing
infra is cleaned from preproduction hardware, we can
set a first production revid. At that point we start
to complain about running driver on preliminary hardware.

v2: initialize GEN9_FEATURES too (CI)
v3: comment, eyesore fix (Chris), cfl fix, squash

Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tomi Sarvela <tomi.p.sarvela at intel.com>
Cc: Jani Nikula <jani.nikula at intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c          |  6 +++---
 drivers/gpu/drm/i915/i915_pci.c          | 10 ++++++++--
 drivers/gpu/drm/i915/intel_chipset.h     |  7 +++++++
 drivers/gpu/drm/i915/intel_device_info.h | 10 ++++++++++
 4 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index be71fdf8d92e..86725c272251 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -852,13 +852,13 @@ static void i915_workqueues_cleanup(struct drm_i915_private *dev_priv)
  */
 static void intel_detect_preproduction_hw(struct drm_i915_private *dev_priv)
 {
+	const struct intel_device_info *info = INTEL_INFO(dev_priv);
 	bool pre = false;
 
 	pre |= IS_HSW_EARLY_SDV(dev_priv);
-	pre |= IS_SKL_REVID(dev_priv, 0, SKL_REVID_F0);
-	pre |= IS_BXT_REVID(dev_priv, 0, BXT_REVID_B_LAST);
+	pre |= IS_PREPRODUCTION_HW(dev_priv);
 
-	if (pre) {
+	if (pre && FIRST_PRODUCT_REVID(info) != PRODUCT_REVID_UNKNOWN) {
 		DRM_ERROR("This is a pre-production stepping. "
 			  "It may not be fully functional.\n");
 		add_taint(TAINT_MACHINE_CHECK, LOCKDEP_STILL_OK);
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 97a91e6af7e3..60a02082055c 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -461,10 +461,12 @@ static const struct intel_device_info intel_cherryview_info = {
 	.has_csr = 1, \
 	.has_guc = 1, \
 	.has_ipc = 1, \
+	.first_product_revid = PRODUCT_REVID_UNKNOWN, \
 	.ddb_size = 896
 
 #define SKL_PLATFORM \
 	GEN9_FEATURES, \
+	.first_product_revid = SKL_REVID_PRODUCT, \
 	PLATFORM(INTEL_SKYLAKE)
 
 static const struct intel_device_info intel_skylake_gt1_info = {
@@ -518,6 +520,7 @@ static const struct intel_device_info intel_skylake_gt4_info = {
 	.has_reset_engine = 1, \
 	.has_snoop = true, \
 	.has_ipc = 1, \
+	.first_product_revid = PRODUCT_REVID_UNKNOWN, \
 	GEN9_DEFAULT_PAGE_SIZES, \
 	GEN_DEFAULT_PIPEOFFSETS, \
 	IVB_CURSOR_OFFSETS, \
@@ -526,6 +529,7 @@ static const struct intel_device_info intel_skylake_gt4_info = {
 static const struct intel_device_info intel_broxton_info = {
 	GEN9_LP_FEATURES,
 	PLATFORM(INTEL_BROXTON),
+	.first_product_revid = BXT_REVID_PRODUCT,
 	.ddb_size = 512,
 };
 
@@ -538,7 +542,8 @@ static const struct intel_device_info intel_geminilake_info = {
 
 #define KBL_PLATFORM \
 	GEN9_FEATURES, \
-	PLATFORM(INTEL_KABYLAKE)
+	PLATFORM(INTEL_KABYLAKE), \
+	.first_product_revid = KBL_REVID_PRODUCT
 
 static const struct intel_device_info intel_kabylake_gt1_info = {
 	KBL_PLATFORM,
@@ -558,7 +563,8 @@ static const struct intel_device_info intel_kabylake_gt3_info = {
 
 #define CFL_PLATFORM \
 	GEN9_FEATURES, \
-	PLATFORM(INTEL_COFFEELAKE)
+	PLATFORM(INTEL_COFFEELAKE), \
+	.first_product_revid = 0x00 /* cfl doesn't use revids */
 
 static const struct intel_device_info intel_coffeelake_gt1_info = {
 	CFL_PLATFORM,
diff --git a/drivers/gpu/drm/i915/intel_chipset.h b/drivers/gpu/drm/i915/intel_chipset.h
index 0e71571fb4c1..a917ab40f857 100644
--- a/drivers/gpu/drm/i915/intel_chipset.h
+++ b/drivers/gpu/drm/i915/intel_chipset.h
@@ -127,6 +127,10 @@
 
 #define IS_ALPHA_SUPPORT(intel_info) ((intel_info)->is_alpha_support)
 
+#define PRODUCT_REVID_UNKNOWN	REVID_FOREVER
+#define FIRST_PRODUCT_REVID(intel_info) ((intel_info)->first_product_revid)
+#define IS_PREPRODUCTION_HW(dev_priv)   (INTEL_REVID(dev_priv) < FIRST_PRODUCT_REVID(INTEL_INFO(dev_priv)))
+
 #define SKL_REVID_A0		0x0
 #define SKL_REVID_B0		0x1
 #define SKL_REVID_C0		0x2
@@ -134,6 +138,7 @@
 #define SKL_REVID_E0		0x4
 #define SKL_REVID_F0		0x5
 #define SKL_REVID_G0		0x6
+#define SKL_REVID_PRODUCT	SKL_REVID_G0
 #define SKL_REVID_H0		0x7
 
 #define IS_SKL_REVID(p, since, until) (IS_SKYLAKE(p) && IS_REVID(p, since, until))
@@ -143,12 +148,14 @@
 #define BXT_REVID_B0		0x3
 #define BXT_REVID_B_LAST	0x8
 #define BXT_REVID_C0		0x9
+#define BXT_REVID_PRODUCT	BXT_REVID_C0
 
 #define IS_BXT_REVID(dev_priv, since, until) \
 	(IS_BROXTON(dev_priv) && IS_REVID(dev_priv, since, until))
 
 #define KBL_REVID_A0		0x0
 #define KBL_REVID_B0		0x1
+#define KBL_REVID_PRODUCT	KBL_REVID_B0
 #define KBL_REVID_C0		0x2
 #define KBL_REVID_D0		0x3
 #define KBL_REVID_E0		0x4
diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
index 933e31669557..64ec283003dd 100644
--- a/drivers/gpu/drm/i915/intel_device_info.h
+++ b/drivers/gpu/drm/i915/intel_device_info.h
@@ -146,6 +146,16 @@ struct intel_device_info {
 	u16 device_id;
 	u16 gen_mask;
 
+	/*
+	 * First known production hardware pci revision id, or:
+	 * - uninitialized (0x00):         no known preliminary hw, (gen < 9)
+	 * - PRODUCT_REVID_UNKNOWN (0xff): no known production hw yet (gen >= 9)
+	 *
+	 * Do not set first product revid unless you are certain that testing
+	 * infrastructure is already on top of production revid machines.
+	 */
+	u8 first_product_revid;
+
 	u8 gen;
 	u8 gt; /* GT number, 0 if undefined */
 	u8 num_rings;
-- 
2.17.0



More information about the Intel-gfx mailing list