Skip to contentSkip to conversation

drm/i915/dmc: abstract GPU error state dump

PATCH RESEND In review Jani Nikula 4 participants 8 messages Mar 30, 2022 – Mar 31, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/3 drm/i915/dmc: abstract GPU error state dump

Only intel_dmc.c should be accessing dmc details directly.

Need to add an i915_error_printf() stub for
CONFIG_DRM_I915_CAPTURE_ERROR=n.

v2: Add the stub (kernel test robot <[email protected]>)

---
 drivers/gpu/drm/i915/display/intel_dmc.c | 15 +++++++++++++++
 drivers/gpu/drm/i915/display/intel_dmc.h |  3 +++
 drivers/gpu/drm/i915/i915_gpu_error.c    | 10 +---------
 drivers/gpu/drm/i915/i915_gpu_error.h    |  6 ++++++
 4 files changed, 25 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/display/intel_dmc.c +15 -0
index 5de13f978e57..f0eb3de8de60 100644
@@ -811,6 +811,21 @@ void intel_dmc_ucode_fini(struct drm_i915_private *dev_priv)
 		kfree(dev_priv->dmc.dmc_info[id].payload);
 }
 
+void intel_dmc_print_error_state(struct drm_i915_error_state_buf *m,
+				 struct drm_i915_private *i915)
+{
+	struct intel_dmc *dmc = &i915->dmc;
+
+	if (!HAS_DMC(i915))
+		return;
+
+	i915_error_printf(m, "DMC loaded: %s\n",
+			  str_yes_no(intel_dmc_has_payload(i915)));
+	i915_error_printf(m, "DMC fw version: %d.%d\n",
+			  DMC_VERSION_MAJOR(dmc->version),
+			  DMC_VERSION_MINOR(dmc->version));
+}
+
 static int intel_dmc_debugfs_status_show(struct seq_file *m, void *unused)
 {
 	struct drm_i915_private *i915 = m->private;
drivers/gpu/drm/i915/display/intel_dmc.h +3 -0
index b9f608057700..dd8880d2cbed 100644
@@ -10,6 +10,7 @@
 #include "intel_wakeref.h"
 #include <linux/workqueue.h>
 
+struct drm_i915_error_state_buf;
 struct drm_i915_private;
 
 #define DMC_VERSION(major, minor)	((major) << 16 | (minor))
@@ -55,6 +56,8 @@ void intel_dmc_ucode_suspend(struct drm_i915_private *i915);
 void intel_dmc_ucode_resume(struct drm_i915_private *i915);
 bool intel_dmc_has_payload(struct drm_i915_private *i915);
 void intel_dmc_debugfs_register(struct drm_i915_private *i915);
+void intel_dmc_print_error_state(struct drm_i915_error_state_buf *m,
+				 struct drm_i915_private *i915);
 
 void assert_dmc_loaded(struct drm_i915_private *i915);
 
drivers/gpu/drm/i915/i915_gpu_error.c +1 -9
index 5478b1dd26bd..fa14314e7d70 100644
@@ -849,15 +849,7 @@ static void __err_print_to_sgl(struct drm_i915_error_state_buf *m,
 
 	err_printf(m, "IOMMU enabled?: %d\n", error->iommu);
 
-	if (HAS_DMC(m->i915)) {
-		struct intel_dmc *dmc = &m->i915->dmc;
-
-		err_printf(m, "DMC loaded: %s\n",
-			   str_yes_no(intel_dmc_has_payload(m->i915) != 0));
-		err_printf(m, "DMC fw version: %d.%d\n",
-			   DMC_VERSION_MAJOR(dmc->version),
-			   DMC_VERSION_MINOR(dmc->version));
-	}
+	intel_dmc_print_error_state(m, m->i915);
 
 	err_printf(m, "RPM wakelock: %s\n", str_yes_no(error->wakelock));
 	err_printf(m, "PM suspended: %s\n", str_yes_no(error->suspended));
drivers/gpu/drm/i915/i915_gpu_error.h +6 -0
index 09159ff01411..7977a01a708f 100644
@@ -298,6 +298,12 @@ void i915_disable_error_state(struct drm_i915_private *i915, int err);
 
 #else
 
+__printf(2, 3)
+static inline void
+i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...)
+{
+}
+
 static inline void
 i915_capture_error_state(struct intel_gt *gt, intel_engine_mask_t engine_mask, u32 dump_flags)
 {
Signature · 1 line
2.30.2
#1 lore raw

PATCH RESEND 2/3 drm/i915/dmc: hide DMC version macros

The macros are now only needed within intel_dmc.c, so move them there.

---
 drivers/gpu/drm/i915/display/intel_dmc.c | 4 ++++
 drivers/gpu/drm/i915/display/intel_dmc.h | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_dmc.c +4 -0
index f0eb3de8de60..a204b60a061f 100644
@@ -37,6 +37,10 @@
  * low-power state and comes back to normal.
  */
 
+#define DMC_VERSION(major, minor)	((major) << 16 | (minor))
+#define DMC_VERSION_MAJOR(version)	((version) >> 16)
+#define DMC_VERSION_MINOR(version)	((version) & 0xffff)
+
 #define DMC_PATH(platform, major, minor) \
 	"i915/"				 \
 	__stringify(platform) "_dmc_ver" \
drivers/gpu/drm/i915/display/intel_dmc.h +0 -4
index dd8880d2cbed..41091aee3b47 100644
@@ -13,10 +13,6 @@
 struct drm_i915_error_state_buf;
 struct drm_i915_private;
 
-#define DMC_VERSION(major, minor)	((major) << 16 | (minor))
-#define DMC_VERSION_MAJOR(version)	((version) >> 16)
-#define DMC_VERSION_MINOR(version)	((version) & 0xffff)
-
 enum {
 	DMC_FW_MAIN = 0,
 	DMC_FW_PIPEA,
Signature · 1 line
2.30.2
#2 lore raw

PATCH RESEND 3/3 drm/i915/dmc: split out dmc registers to a separate file

In reply to Jani Nikula

Clean up the massive i915_reg.h a bit with this isolated set of registers.

v2: Remove stale comment (Lucas)

---
 drivers/gpu/drm/i915/display/intel_dmc.c      |  1 +
 drivers/gpu/drm/i915/display/intel_dmc_regs.h | 30 +++++++++++++++++++
 drivers/gpu/drm/i915/gvt/handlers.c           |  1 +
 drivers/gpu/drm/i915/i915_reg.h               | 21 -------------
 4 files changed, 32 insertions(+), 21 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_dmc_regs.h
drivers/gpu/drm/i915/display/intel_dmc.c +1 -0
index a204b60a061f..257cf662f9f4 100644
@@ -28,6 +28,7 @@
 #include "i915_reg.h"
 #include "intel_de.h"
 #include "intel_dmc.h"
+#include "intel_dmc_regs.h"
 
 /**
  * DOC: DMC Firmware Support
drivers/gpu/drm/i915/display/intel_dmc_regs.h new file +30 -0
new file mode 100644
index 000000000000..d65e698832eb
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef __INTEL_DMC_REGS_H__
+#define __INTEL_DMC_REGS_H__
+
+#include "i915_reg_defs.h"
+
+#define DMC_PROGRAM(addr, i)	_MMIO((addr) + (i) * 4)
+#define DMC_SSP_BASE_ADDR_GEN9	0x00002FC0
+#define DMC_HTP_ADDR_SKL	0x00500034
+#define DMC_SSP_BASE		_MMIO(0x8F074)
+#define DMC_HTP_SKL		_MMIO(0x8F004)
+#define DMC_LAST_WRITE		_MMIO(0x8F034)
+#define DMC_LAST_WRITE_VALUE	0xc003b400
+#define DMC_MMIO_START_RANGE	0x80000
+#define DMC_MMIO_END_RANGE	0x8FFFF
+#define SKL_DMC_DC3_DC5_COUNT	_MMIO(0x80030)
+#define SKL_DMC_DC5_DC6_COUNT	_MMIO(0x8002C)
+#define BXT_DMC_DC3_DC5_COUNT	_MMIO(0x80038)
+#define TGL_DMC_DEBUG_DC5_COUNT	_MMIO(0x101084)
+#define TGL_DMC_DEBUG_DC6_COUNT	_MMIO(0x101088)
+#define DG1_DMC_DEBUG_DC5_COUNT	_MMIO(0x134154)
+
+#define TGL_DMC_DEBUG3		_MMIO(0x101090)
+#define DG1_DMC_DEBUG3		_MMIO(0x13415c)
+
+#endif /* __INTEL_DMC_REGS_H__ */
drivers/gpu/drm/i915/gvt/handlers.c +1 -0
index 0ee3ecc83234..57b0f4977760 100644
@@ -42,6 +42,7 @@
 #include "i915_pvinfo.h"
 #include "intel_mchbar_regs.h"
 #include "display/intel_display_types.h"
+#include "display/intel_dmc_regs.h"
 #include "display/intel_fbc.h"
 #include "display/vlv_dsi_pll_regs.h"
 #include "gt/intel_gt_regs.h"
drivers/gpu/drm/i915/i915_reg.h +0 -21
index a0d652f19ff9..7caa96e2e866 100644
@@ -5504,27 +5504,6 @@
 #define  GAMMA_MODE_MODE_SPLIT	(3 << 0) /* ivb-bdw */
 #define  GAMMA_MODE_MODE_12BIT_MULTI_SEGMENTED	(3 << 0) /* icl + */
 
-/* DMC */
-#define DMC_PROGRAM(addr, i)	_MMIO((addr) + (i) * 4)
-#define DMC_SSP_BASE_ADDR_GEN9	0x00002FC0
-#define DMC_HTP_ADDR_SKL	0x00500034
-#define DMC_SSP_BASE		_MMIO(0x8F074)
-#define DMC_HTP_SKL		_MMIO(0x8F004)
-#define DMC_LAST_WRITE		_MMIO(0x8F034)
-#define DMC_LAST_WRITE_VALUE	0xc003b400
-/* MMIO address range for DMC program (0x80000 - 0x82FFF) */
-#define DMC_MMIO_START_RANGE	0x80000
-#define DMC_MMIO_END_RANGE	0x8FFFF
-#define SKL_DMC_DC3_DC5_COUNT	_MMIO(0x80030)
-#define SKL_DMC_DC5_DC6_COUNT	_MMIO(0x8002C)
-#define BXT_DMC_DC3_DC5_COUNT	_MMIO(0x80038)
-#define TGL_DMC_DEBUG_DC5_COUNT	_MMIO(0x101084)
-#define TGL_DMC_DEBUG_DC6_COUNT	_MMIO(0x101088)
-#define DG1_DMC_DEBUG_DC5_COUNT	_MMIO(0x134154)
-
-#define TGL_DMC_DEBUG3		_MMIO(0x101090)
-#define DG1_DMC_DEBUG3		_MMIO(0x13415c)
-
 /* Display Internal Timeout Register */
 #define RM_TIMEOUT		_MMIO(0x42060)
 #define  MMIO_TIMEOUT_US(us)	((us) << 0)
Signature · 1 line
2.30.2
#3 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error state dump

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error state dump
URL : https://patchwork.freedesktop.org/series/101957/
State : failure

== Summary ==

Applying: drm/i915/dmc: abstract GPU error state dump
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_dmc.c
M drivers/gpu/drm/i915/display/intel_dmc.h
M drivers/gpu/drm/i915/i915_gpu_error.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_gpu_error.c
Auto-merging drivers/gpu/drm/i915/display/intel_dmc.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_dmc.h Auto-merging drivers/gpu/drm/i915/display/intel_dmc.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_dmc.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm/i915/dmc: abstract GPU error state dump When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

#4 lore raw

Re: [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error state dump

Quoted 5 lines · Patchwork

== Series Details ==

Series: series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error state dump
URL : https://patchwork.freedesktop.org/series/101957/
State : failure

I don't get why this doesn't apply.

It applies for me.

BR,
Jani.

Quoted 22 lines

== Summary ==

Applying: drm/i915/dmc: abstract GPU error state dump
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_dmc.c
M drivers/gpu/drm/i915/display/intel_dmc.h
M drivers/gpu/drm/i915/i915_gpu_error.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_gpu_error.c
Auto-merging drivers/gpu/drm/i915/display/intel_dmc.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_dmc.h Auto-merging drivers/gpu/drm/i915/display/intel_dmc.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_dmc.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm/i915/dmc: abstract GPU error state dump When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#5 lore raw

Re: [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error state dump

The latest CI_DRM built is 11416; after that, there is build error:
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c: In function 'amdgpu_gtt_mgr_recover':
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c:200:31: error: 'struct ttm_range_mgr_node' has no member named 'tbo'

   amdgpu_ttm_recover_gart(node->tbo);
                               ^~

CC [M] drivers/net/ethernet/intel/igb/e1000_mbx.o
scripts/Makefile.build:288: recipe for target 'drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.o' failed

The patch is applied against latest working build commit. Can you try your patch against
CI_DRM_11416 1dc2c6953e2689a0e5b7cca8450da14059d35f03
and see if you get the same error?

Tomi

Quoted 47 lines

From: Nikula, Jani <[email protected]>

Quoted 3 lines · Patchwork

== Series Details ==

Series: series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error

state dump

Quoted 2 lines

URL : https://patchwork.freedesktop.org/series/101957/
State : failure

I don't get why this doesn't apply.

It applies for me.

BR,
Jani.

Quoted 12 lines

== Summary ==

Applying: drm/i915/dmc: abstract GPU error state dump Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_dmc.c
M drivers/gpu/drm/i915/display/intel_dmc.h
M drivers/gpu/drm/i915/i915_gpu_error.c
Falling back to patching base and 3-way merge... Auto-merging drivers/gpu/drm/i915/i915_gpu_error.c Auto-merging drivers/gpu/drm/i915/display/intel_dmc.h CONFLICT (content): Merge conflict in

drivers/gpu/drm/i915/display/intel_dmc.h

Quoted 2 lines

Auto-merging drivers/gpu/drm/i915/display/intel_dmc.c CONFLICT (content): Merge conflict in

drivers/gpu/drm/i915/display/intel_dmc.c

Quoted 8 lines

error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm/i915/dmc: abstract GPU error state dump When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

--
Jani Nikula, Intel Open Source Graphics Center

#6 lore raw

Re: [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error state dump

Quoted 7 lines · Tomi Sarvela

The latest CI_DRM built is 11416; after that, there is build error:
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c: In function 'amdgpu_gtt_mgr_recover':
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c:200:31: error: 'struct ttm_range_mgr_node' has no member named 'tbo'

  amdgpu_ttm_recover_gart(node->tbo);
                              ^~

CC [M] drivers/net/ethernet/intel/igb/e1000_mbx.o
scripts/Makefile.build:288: recipe for target 'drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.o' failed

just fixed that

Quoted 4 lines

The patch is applied against latest working build commit. Can you try your patch against CI_DRM_11416 1dc2c6953e2689a0e5b7cca8450da14059d35f03
and see if you get the same error?

so maybe just a re-trigger should work?

Lucas De Marchi

Quoted 50 lines

Tomi

Quoted 47 lines

From: Nikula, Jani <[email protected]>

Quoted 3 lines · Patchwork

== Series Details ==

Series: series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error

state dump

Quoted 2 lines

URL : https://patchwork.freedesktop.org/series/101957/
State : failure

I don't get why this doesn't apply.

It applies for me.

BR,
Jani.

Quoted 12 lines

== Summary ==

Applying: drm/i915/dmc: abstract GPU error state dump Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_dmc.c
M drivers/gpu/drm/i915/display/intel_dmc.h
M drivers/gpu/drm/i915/i915_gpu_error.c
Falling back to patching base and 3-way merge... Auto-merging drivers/gpu/drm/i915/i915_gpu_error.c Auto-merging drivers/gpu/drm/i915/display/intel_dmc.h CONFLICT (content): Merge conflict in

drivers/gpu/drm/i915/display/intel_dmc.h

Quoted 2 lines

Auto-merging drivers/gpu/drm/i915/display/intel_dmc.c CONFLICT (content): Merge conflict in

drivers/gpu/drm/i915/display/intel_dmc.c

Quoted 8 lines

error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm/i915/dmc: abstract GPU error state dump When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

--
Jani Nikula, Intel Open Source Graphics Center

#7 lore raw

Re: [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU error state dump

After the latest CI_DRM has been build, re-test should be enough.

Tomi

Quoted 76 lines

From: De Marchi, Lucas <[email protected]>

Quoted 2 lines · Tomi Sarvela

The latest CI_DRM built is 11416; after that, there is build error:
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c: In function

'amdgpu_gtt_mgr_recover':

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c:200:31: error: 'struct

ttm_range_mgr_node' has no member named 'tbo'

Quoted 4 lines
  amdgpu_ttm_recover_gart(node->tbo);
                              ^~

CC [M] drivers/net/ethernet/intel/igb/e1000_mbx.o
scripts/Makefile.build:288: recipe for target

'drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.o' failed

just fixed that

Quoted 2 lines

The patch is applied against latest working build commit. Can you try your

patch against

Quoted 2 lines

CI_DRM_11416 1dc2c6953e2689a0e5b7cca8450da14059d35f03 and see if you get the same error?

so maybe just a re-trigger should work?

Lucas De Marchi

Quoted 10 lines

Tomi

Quoted 7 lines

From: Nikula, Jani <[email protected]>

Quoted 3 lines · Patchwork

== Series Details ==

Series: series starting with [RESEND,1/3] drm/i915/dmc: abstract GPU

error

Quoted 40 lines
Quoted 40 lines

state dump

Quoted 2 lines

URL : https://patchwork.freedesktop.org/series/101957/
State : failure

I don't get why this doesn't apply.

It applies for me.

BR,
Jani.

Quoted 12 lines

== Summary ==

Applying: drm/i915/dmc: abstract GPU error state dump Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_dmc.c
M drivers/gpu/drm/i915/display/intel_dmc.h
M drivers/gpu/drm/i915/i915_gpu_error.c
Falling back to patching base and 3-way merge... Auto-merging drivers/gpu/drm/i915/i915_gpu_error.c Auto-merging drivers/gpu/drm/i915/display/intel_dmc.h CONFLICT (content): Merge conflict in

drivers/gpu/drm/i915/display/intel_dmc.h

Quoted 2 lines

Auto-merging drivers/gpu/drm/i915/display/intel_dmc.c CONFLICT (content): Merge conflict in

drivers/gpu/drm/i915/display/intel_dmc.c

Quoted 8 lines

error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm/i915/dmc: abstract GPU error state dump When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

--
Jani Nikula, Intel Open Source Graphics Center