Skip to contentSkip to conversation

drm/i915: There is only one fault register from Gen8 onwards

PATCH Superseded Michel Thierry 3 participants 6 messages Jun 23, 2017 – Jun 24, 2017

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: There is only one fault register from Gen8 onwards

Until Haswell/Baytrail, the hardware used to have a per engine fault register (e.g. 0x4094 - render fault register, 0x4194 - media fault register, etc). But since Broadwell, all these registers were combined into a singe one, which specifies the engine id in bits 14:12.

Luckily, the additional register addresses haven't been reused, but we should not been reading (and writing to) registers that do not exist.

References: IHD-OS-BDW-Vol 2c-11.15, page 75.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c   | 29 ++++++++++++++++++++++++-----
 drivers/gpu/drm/i915/i915_gpu_error.c |  8 +++++---
 drivers/gpu/drm/i915/i915_reg.h       |  2 ++
 3 files changed, 31 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +24 -5
index de67084d5fcf..83deb004368c 100644
@@ -2000,22 +2000,41 @@ void i915_check_and_clear_faults(struct drm_i915_private *dev_priv)
 	if (INTEL_INFO(dev_priv)->gen < 6)
 		return;
 
-	for_each_engine(engine, dev_priv, id) {
+	/* From GEN8 onwards we only have one 'All Engine Fault Register' */
+	if (INTEL_INFO(dev_priv)->gen >= 8) {
 		u32 fault_reg;
-		fault_reg = I915_READ(RING_FAULT_REG(engine));
+		fault_reg = I915_READ(GEN8_RING_FAULT_REG);
 		if (fault_reg & RING_FAULT_VALID) {
 			DRM_DEBUG_DRIVER("Unexpected fault\n"
 					 "\tAddr: 0x%08lx\n"
-					 "\tAddress space: %s\n"
+					 "\tEngine ID: %d\n"
 					 "\tSource ID: %d\n"
 					 "\tType: %d\n",
 					 fault_reg & PAGE_MASK,
-					 fault_reg & RING_FAULT_GTTSEL_MASK ? "GGTT" : "PPGTT",
+					 GEN8_RING_FAULT_ENGINE_ID(fault_reg),
 					 RING_FAULT_SRCID(fault_reg),
 					 RING_FAULT_FAULT_TYPE(fault_reg));
-			I915_WRITE(RING_FAULT_REG(engine),
+			I915_WRITE(GEN8_RING_FAULT_REG,
 				   fault_reg & ~RING_FAULT_VALID);
 		}
+	} else {
+		for_each_engine(engine, dev_priv, id) {
+			u32 fault_reg;
+			fault_reg = I915_READ(RING_FAULT_REG(engine));
+			if (fault_reg & RING_FAULT_VALID) {
+				DRM_DEBUG_DRIVER("Unexpected fault\n"
+						 "\tAddr: 0x%08lx\n"
+						 "\tAddress space: %s\n"
+						 "\tSource ID: %d\n"
+						 "\tType: %d\n",
+						 fault_reg & PAGE_MASK,
+						 fault_reg & RING_FAULT_GTTSEL_MASK ? "GGTT" : "PPGTT",
+						 RING_FAULT_SRCID(fault_reg),
+						 RING_FAULT_FAULT_TYPE(fault_reg));
+				I915_WRITE(RING_FAULT_REG(engine),
+					   fault_reg & ~RING_FAULT_VALID);
+			}
+		}
 	}
 
 	/* Engine specific init may not have been done till this point. */
drivers/gpu/drm/i915/i915_gpu_error.c +5 -3
index ae70283470a6..b7f147b1b6dd 100644
@@ -1167,11 +1167,13 @@ static void error_record_engine_registers(struct i915_gpu_state *error,
 
 	if (INTEL_GEN(dev_priv) >= 6) {
 		ee->rc_psmi = I915_READ(RING_PSMI_CTL(engine->mmio_base));
-		ee->fault_reg = I915_READ(RING_FAULT_REG(engine));
-		if (INTEL_GEN(dev_priv) >= 8)
+		if (INTEL_GEN(dev_priv) >= 8) {
 			gen8_record_semaphore_state(error, engine, ee);
-		else
+			ee->fault_reg = I915_READ(GEN8_RING_FAULT_REG);
+		} else {
 			gen6_record_semaphore_state(engine, ee);
+			ee->fault_reg = I915_READ(RING_FAULT_REG(engine));
+		}
 	}
 
 	if (INTEL_GEN(dev_priv) >= 4) {
drivers/gpu/drm/i915/i915_reg.h +2 -0
index c8647cfa81ba..54a828aad777 100644
@@ -2149,6 +2149,8 @@ enum skl_disp_power_wells {
 #define   ARB_MODE_SWIZZLE_BDW	(1<<1)
 #define RENDER_HWS_PGA_GEN7	_MMIO(0x04080)
 #define RING_FAULT_REG(engine)	_MMIO(0x4094 + 0x100*(engine)->hw_id)
+#define GEN8_RING_FAULT_REG	_MMIO(0x4094)
+#define   GEN8_RING_FAULT_ENGINE_ID(x)	(((x) >> 12) & 0x7)
 #define   RING_FAULT_GTTSEL_MASK (1<<11)
 #define   RING_FAULT_SRCID(x)	(((x) >> 3) & 0xff)
 #define   RING_FAULT_FAULT_TYPE(x) (((x) >> 1) & 0x3)
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Michel Thierry (2017-06-24 00:17:29)

Quoted 21 lines

Until Haswell/Baytrail, the hardware used to have a per engine fault register (e.g. 0x4094 - render fault register, 0x4194 - media fault register, etc). But since Broadwell, all these registers were combined into a singe one, which specifies the engine id in bits 14:12.

Luckily, the additional register addresses haven't been reused, but we should not been reading (and writing to) registers that do not exist.

References: IHD-OS-BDW-Vol 2c-11.15, page 75.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c   | 29 ++++++++++++++++++++++++-----
 drivers/gpu/drm/i915/i915_gpu_error.c |  8 +++++---
 drivers/gpu/drm/i915/i915_reg.h       |  2 ++
 3 files changed, 31 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index de67084d5fcf..83deb004368c 100644

drivers/gpu/drm/i915/i915_gem_gtt.c void i915_check_and_clear_faults(struct drm_i915_private *dev_priv) · line 2004

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -1
@@ -2000,22 +2000,41 @@ void i915_check_and_clear_faults(struct drm_i915_private *dev_priv)
        if (INTEL_INFO(dev_priv)->gen < 6)
                return;
 
-       for_each_engine(engine, dev_priv, id) {
+       /* From GEN8 onwards we only have one 'All Engine Fault Register' */
+       if (INTEL_INFO(dev_priv)->gen >= 8) {

INTEL_GEN() >= 8

drivers/gpu/drm/i915/i915_gem_gtt.c void i915_check_and_clear_faults(struct drm_i915_private *dev_priv) · line 2005

Quoted 1 line
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
                u32 fault_reg;

Newline after variable blocks (might as well fix up the coding style in passing).

u32 fault;

foo_reg is more commonly used to refer to the register offset itself, i.e. i915_reg_t. Might as well move it to the start of the function as it is shared between all branches, and I don't think we are overly concerned with aiding gcc's liverange analysis here.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 25 lines · Chris Wilson

Quoting Michel Thierry (2017-06-24 00:17:29)

Quoted 24 lines

Until Haswell/Baytrail, the hardware used to have a per engine fault register (e.g. 0x4094 - render fault register, 0x4194 - media fault register, etc). But since Broadwell, all these registers were combined into a singe one, which specifies the engine id in bits 14:12.

Luckily, the additional register addresses haven't been reused, but we should not been reading (and writing to) registers that do not exist.

References: IHD-OS-BDW-Vol 2c-11.15, page 75.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c   | 29 ++++++++++++++++++++++++-----
 drivers/gpu/drm/i915/i915_gpu_error.c |  8 +++++---
 drivers/gpu/drm/i915/i915_reg.h       |  2 ++
 3 files changed, 31 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index de67084d5fcf..83deb004368c 100644
@@ -2000,22 +2000,41 @@ void i915_check_and_clear_faults(struct drm_i915_private *dev_priv)
        if (INTEL_INFO(dev_priv)->gen < 6)
                return;
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_gem_gtt.c void i915_check_and_clear_faults(struct drm_i915_private *dev_priv) · line 2004

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -1
-       for_each_engine(engine, dev_priv, id) {
+       /* From GEN8 onwards we only have one 'All Engine Fault Register' */
+       if (INTEL_INFO(dev_priv)->gen >= 8) {

INTEL_GEN() >= 8

Oops, busted copy-pasting old code, I'll also change it (INTEL_INFO(dev_priv)->gen < 6).

Quoted 11 lines

drivers/gpu/drm/i915/i915_gem_gtt.c void i915_check_and_clear_faults(struct drm_i915_private *dev_priv) · line 2005

Quoted 1 line
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
                u32 fault_reg;

Newline after variable blocks (might as well fix up the coding style in passing).

u32 fault;

foo_reg is more commonly used to refer to the register offset itself, i.e. i915_reg_t. Might as well move it to the start of the function as it is shared between all branches, and I don't think we are overly concerned with aiding gcc's liverange analysis here.

I thought about moving it to the start of the function. Let me make these changes.

Thanks,

-Michel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✓ Fi.CI.BAT: success for drm/i915: There is only one fault register from Gen8 onwards

In reply to Michel Thierry
== Series Details ==

== Series Details ==

Series: drm/i915: There is only one fault register from Gen8 onwards
URL : https://patchwork.freedesktop.org/series/26317/
State : success

== Summary ==

Series 26317v1 drm/i915: There is only one fault register from Gen8 onwards
https://patchwork.freedesktop.org/api/1.0/series/26317/revisions/1/mbox/

Test kms_cursor_legacy:

        Subgroup basic-busy-flip-before-cursor-legacy:
                fail       -> PASS       (fi-snb-2600) fdo#100215

fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:450s
fi-bdw-gvtdvm    total:279  pass:257  dwarn:8   dfail:0   fail:0   skip:14  time:433s
fi-bsw-n3050     total:279  pass:242  dwarn:1   dfail:0   fail:0   skip:36  time:532s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:506s
fi-byt-j1900     total:279  pass:253  dwarn:2   dfail:0   fail:0   skip:24  time:493s
fi-byt-n2820     total:279  pass:249  dwarn:2   dfail:0   fail:0   skip:28  time:482s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:596s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:436s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:420s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:499s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:475s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:466s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:579s
fi-kbl-r         total:279  pass:260  dwarn:1   dfail:0   fail:0   skip:18  time:583s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:452s
fi-skl-6700hq    total:279  pass:223  dwarn:1   dfail:0   fail:30  skip:24  time:340s
fi-skl-6700k     total:279  pass:257  dwarn:4   dfail:0   fail:0   skip:18  time:465s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:480s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:434s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:547s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:405s

1789a777702e41b11133dd23578edbd0b47ccf40 drm-tip: 2017y-06m-23d-12h-42m-45s UTC integration manifest 7e0705c drm/i915: There is only one fault register from Gen8 onwards

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5038/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

PATCH v2 1/1 drm/i915: There is only one fault register from Gen8 onwards

In reply to Michel Thierry

Until Haswell/Baytrail, the hardware used to have a per engine fault register (e.g. 0x4094 - render fault register, 0x4194 - media fault register, etc). But since Broadwell, all these registers were combined into a singe one, which specifies the engine id in bits 14:12.

Luckily, the additional register addresses haven't been reused, but we should not been reading (and writing to) registers that do not exist.

v2: Rename fault variable, use INTEL_GEN (Chris).

References: IHD-OS-BDW-Vol 2c-11.15, page 75.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c   | 42 +++++++++++++++++++++++++----------
 drivers/gpu/drm/i915/i915_gpu_error.c |  8 ++++---
 drivers/gpu/drm/i915/i915_reg.h       |  2 ++
 3 files changed, 37 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +30 -12
index de67084d5fcf..c840d4184a4f 100644
@@ -1996,25 +1996,43 @@ void i915_check_and_clear_faults(struct drm_i915_private *dev_priv)
 {
 	struct intel_engine_cs *engine;
 	enum intel_engine_id id;
+	u32 fault;
 
-	if (INTEL_INFO(dev_priv)->gen < 6)
+	if (INTEL_GEN(dev_priv) < 6)
 		return;
 
-	for_each_engine(engine, dev_priv, id) {
-		u32 fault_reg;
-		fault_reg = I915_READ(RING_FAULT_REG(engine));
-		if (fault_reg & RING_FAULT_VALID) {
+	/* From GEN8 onwards we only have one 'All Engine Fault Register' */
+	if (INTEL_GEN(dev_priv) >= 8) {
+		fault = I915_READ(GEN8_RING_FAULT_REG);
+		if (fault & RING_FAULT_VALID) {
 			DRM_DEBUG_DRIVER("Unexpected fault\n"
 					 "\tAddr: 0x%08lx\n"
-					 "\tAddress space: %s\n"
+					 "\tEngine ID: %d\n"
 					 "\tSource ID: %d\n"
 					 "\tType: %d\n",
-					 fault_reg & PAGE_MASK,
-					 fault_reg & RING_FAULT_GTTSEL_MASK ? "GGTT" : "PPGTT",
-					 RING_FAULT_SRCID(fault_reg),
-					 RING_FAULT_FAULT_TYPE(fault_reg));
-			I915_WRITE(RING_FAULT_REG(engine),
-				   fault_reg & ~RING_FAULT_VALID);
+					 fault & PAGE_MASK,
+					 GEN8_RING_FAULT_ENGINE_ID(fault),
+					 RING_FAULT_SRCID(fault),
+					 RING_FAULT_FAULT_TYPE(fault));
+			I915_WRITE(GEN8_RING_FAULT_REG,
+				   fault & ~RING_FAULT_VALID);
+		}
+	} else {
+		for_each_engine(engine, dev_priv, id) {
+			fault = I915_READ(RING_FAULT_REG(engine));
+			if (fault & RING_FAULT_VALID) {
+				DRM_DEBUG_DRIVER("Unexpected fault\n"
+						 "\tAddr: 0x%08lx\n"
+						 "\tAddress space: %s\n"
+						 "\tSource ID: %d\n"
+						 "\tType: %d\n",
+						 fault & PAGE_MASK,
+						 fault & RING_FAULT_GTTSEL_MASK ? "GGTT" : "PPGTT",
+						 RING_FAULT_SRCID(fault),
+						 RING_FAULT_FAULT_TYPE(fault));
+				I915_WRITE(RING_FAULT_REG(engine),
+					   fault & ~RING_FAULT_VALID);
+			}
 		}
 	}
 
drivers/gpu/drm/i915/i915_gpu_error.c +5 -3
index ae70283470a6..b7f147b1b6dd 100644
@@ -1167,11 +1167,13 @@ static void error_record_engine_registers(struct i915_gpu_state *error,
 
 	if (INTEL_GEN(dev_priv) >= 6) {
 		ee->rc_psmi = I915_READ(RING_PSMI_CTL(engine->mmio_base));
-		ee->fault_reg = I915_READ(RING_FAULT_REG(engine));
-		if (INTEL_GEN(dev_priv) >= 8)
+		if (INTEL_GEN(dev_priv) >= 8) {
 			gen8_record_semaphore_state(error, engine, ee);
-		else
+			ee->fault_reg = I915_READ(GEN8_RING_FAULT_REG);
+		} else {
 			gen6_record_semaphore_state(engine, ee);
+			ee->fault_reg = I915_READ(RING_FAULT_REG(engine));
+		}
 	}
 
 	if (INTEL_GEN(dev_priv) >= 4) {
drivers/gpu/drm/i915/i915_reg.h +2 -0
index c8647cfa81ba..54a828aad777 100644
@@ -2149,6 +2149,8 @@ enum skl_disp_power_wells {
 #define   ARB_MODE_SWIZZLE_BDW	(1<<1)
 #define RENDER_HWS_PGA_GEN7	_MMIO(0x04080)
 #define RING_FAULT_REG(engine)	_MMIO(0x4094 + 0x100*(engine)->hw_id)
+#define GEN8_RING_FAULT_REG	_MMIO(0x4094)
+#define   GEN8_RING_FAULT_ENGINE_ID(x)	(((x) >> 12) & 0x7)
 #define   RING_FAULT_GTTSEL_MASK (1<<11)
 #define   RING_FAULT_SRCID(x)	(((x) >> 3) & 0xff)
 #define   RING_FAULT_FAULT_TYPE(x) (((x) >> 1) & 0x3)
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

✓ Fi.CI.BAT: success for drm/i915: There is only one fault register from Gen8 onwards (rev2)

In reply to Michel Thierry
== Series Details ==

== Series Details ==

Series: drm/i915: There is only one fault register from Gen8 onwards (rev2)
URL : https://patchwork.freedesktop.org/series/26317/
State : success

== Summary ==

Series 26317v2 drm/i915: There is only one fault register from Gen8 onwards
https://patchwork.freedesktop.org/api/1.0/series/26317/revisions/2/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                dmesg-warn -> PASS       (fi-kbl-r) fdo#100125
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-legacy:
                fail       -> PASS       (fi-snb-2600) fdo#100215

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:441s
fi-bdw-gvtdvm    total:279  pass:257  dwarn:8   dfail:0   fail:0   skip:14  time:433s
fi-bsw-n3050     total:279  pass:242  dwarn:1   dfail:0   fail:0   skip:36  time:534s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:505s
fi-byt-j1900     total:279  pass:253  dwarn:2   dfail:0   fail:0   skip:24  time:488s
fi-byt-n2820     total:279  pass:249  dwarn:2   dfail:0   fail:0   skip:28  time:481s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:588s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:434s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:419s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:499s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:472s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:466s
fi-kbl-7560u     total:279  pass:268  dwarn:1   dfail:0   fail:0   skip:10  time:575s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:582s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:454s
fi-skl-6700hq    total:279  pass:223  dwarn:1   dfail:0   fail:30  skip:24  time:339s
fi-skl-6700k     total:279  pass:257  dwarn:4   dfail:0   fail:0   skip:18  time:466s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:481s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:435s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:543s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:401s

1789a777702e41b11133dd23578edbd0b47ccf40 drm-tip: 2017y-06m-23d-12h-42m-45s UTC integration manifest d9da9f0 drm/i915: There is only one fault register from Gen8 onwards

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5039/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx