From: Zhanjun Dong <zhanjun.dong@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Zhanjun Dong <zhanjun.dong@intel.com>
Subject: [PATCH v5 1/8] drm/xe/guc: Add kconfig for GuC based register capture
Date: Thu, 8 Feb 2024 13:19:11 -0800 [thread overview]
Message-ID: <20240208211918.81789-2-zhanjun.dong@intel.com> (raw)
In-Reply-To: <20240208211918.81789-1-zhanjun.dong@intel.com>
Add kconfig for GuC based register capture. This feature support of
GuC to report error-state-capture, using a list of MMIO registers the
driver registers and GuC will dump, log and notify right before a GuC
triggered engine-reset event.
This feature could be disabled to save memory.
Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com>
---
drivers/gpu/drm/xe/Kconfig | 11 +++++++
drivers/gpu/drm/xe/Makefile | 1 +
drivers/gpu/drm/xe/xe_guc.c | 5 ++++
drivers/gpu/drm/xe/xe_guc_capture.c | 46 +++++++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_guc_capture.h | 15 ++++++++++
5 files changed, 78 insertions(+)
create mode 100644 drivers/gpu/drm/xe/xe_guc_capture.c
create mode 100644 drivers/gpu/drm/xe/xe_guc_capture.h
diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
index e36ae1f0d885..410d058e2573 100644
--- a/drivers/gpu/drm/xe/Kconfig
+++ b/drivers/gpu/drm/xe/Kconfig
@@ -83,6 +83,17 @@ config DRM_XE_FORCE_PROBE
Use "!*" to block the probe of the driver for all known devices.
+config DRM_XE_CAPTURE_ERROR
+ bool "Enable capturing GPU state following a hang"
+ depends on DRM_XE
+ default y
+ help
+ This option enables capturing the GPU state when a hang is detected.
+ This information is vital for triaging hangs and assists in debugging.
+ Please report any hang to your Intel representative to help with triaging.
+
+ If in doubt, say "Y".
+
menu "drm/Xe Debugging"
depends on DRM_XE
depends on EXPERT
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index c531210695db..8d71c6baf0a2 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -92,6 +92,7 @@ xe-y += xe_bb.o \
xe_gt_topology.o \
xe_guc.o \
xe_guc_ads.o \
+ xe_guc_capture.o \
xe_guc_ct.o \
xe_guc_db_mgr.o \
xe_guc_debugfs.o \
diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
index 868208a39829..c9b629d2052f 100644
--- a/drivers/gpu/drm/xe/xe_guc.c
+++ b/drivers/gpu/drm/xe/xe_guc.c
@@ -17,6 +17,7 @@
#include "xe_force_wake.h"
#include "xe_gt.h"
#include "xe_guc_ads.h"
+#include "xe_guc_capture.h"
#include "xe_guc_ct.h"
#include "xe_guc_hwconfig.h"
#include "xe_guc_log.h"
@@ -290,6 +291,10 @@ int xe_guc_init(struct xe_guc *guc)
if (ret)
goto out;
+ ret = xe_guc_capture_init(guc);
+ if (ret)
+ goto out;
+
ret = xe_guc_ads_init(&guc->ads);
if (ret)
goto out;
diff --git a/drivers/gpu/drm/xe/xe_guc_capture.c b/drivers/gpu/drm/xe/xe_guc_capture.c
new file mode 100644
index 000000000000..c5fe8de8a13f
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_guc_capture.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2021-2022 Intel Corporation
+ */
+
+#include <linux/types.h>
+
+#include <drm/drm_print.h>
+
+#include "abi/guc_actions_abi.h"
+#include "regs/xe_regs.h"
+#include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
+#include "regs/xe_guc_regs.h"
+
+#include "xe_bo.h"
+#include "xe_device.h"
+#include "xe_exec_queue_types.h"
+#include "xe_hw_engine_types.h"
+#include "xe_gt.h"
+#include "xe_gt_printk.h"
+#include "xe_guc.h"
+#include "xe_guc_capture.h"
+#include "xe_guc_ct.h"
+
+#include "xe_guc_log.h"
+#include "xe_gt_mcr.h"
+#include "xe_guc_submit.h"
+#include "xe_macros.h"
+#include "xe_map.h"
+
+#if IS_ENABLED(CONFIG_DRM_XE_CAPTURE_ERROR)
+
+int xe_guc_capture_init(struct xe_guc *guc)
+{
+ return 0;
+}
+
+#else /* IS_ENABLED(CONFIG_DRM_XE_CAPTURE_ERROR) */
+
+int xe_guc_capture_init(struct xe_guc *guc)
+{
+ return 0;
+}
+
+#endif /* IS_ENABLED(CONFIG_DRM_XE_CAPTURE_ERROR) */
diff --git a/drivers/gpu/drm/xe/xe_guc_capture.h b/drivers/gpu/drm/xe/xe_guc_capture.h
new file mode 100644
index 000000000000..3caea2c6fffe
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_guc_capture.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2021-2021 Intel Corporation
+ */
+
+#ifndef _XE_GUC_CAPTURE_H
+#define _XE_GUC_CAPTURE_H
+
+#include <linux/types.h>
+
+struct xe_guc;
+
+int xe_guc_capture_init(struct xe_guc *guc);
+
+#endif /* _XE_GUC_CAPTURE_H */
--
2.34.1
next prev parent reply other threads:[~2024-02-08 21:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 21:19 [PATCH v5 0/8] drm/xe/guc: Add GuC based register capture for error capture Zhanjun Dong
2024-02-08 21:19 ` Zhanjun Dong [this message]
2024-02-08 21:19 ` [PATCH v5 2/8] drm/xe/guc: Update GuC ADS size " Zhanjun Dong
2024-02-08 21:19 ` [PATCH v5 3/8] drm/xe/guc: Add XE_LP steered register lists Zhanjun Dong
2024-02-08 21:19 ` [PATCH v5 4/8] drm/xe/guc: Add capture size check in GuC log buffer Zhanjun Dong
2024-02-08 21:19 ` [PATCH v5 5/8] drm/xe/guc: Check sizing of guc_capture output Zhanjun Dong
2024-02-08 21:19 ` [PATCH v5 6/8] drm/xe/guc: Extract GuC error capture lists on G2H notification Zhanjun Dong
2024-02-08 21:19 ` [PATCH v5 7/8] drm/xe/guc: Pre-allocate output nodes for extraction Zhanjun Dong
2024-02-08 21:19 ` [PATCH v5 8/8] drm/xe/guc: Plumb GuC-capture into dev coredump Zhanjun Dong
2024-02-09 0:07 ` ✓ CI.Patch_applied: success for drm/xe/guc: Add GuC based register capture for error capture (rev4) Patchwork
2024-02-09 0:07 ` ✗ CI.checkpatch: warning " Patchwork
2024-02-09 0:08 ` ✗ CI.KUnit: failure " 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=20240208211918.81789-2-zhanjun.dong@intel.com \
--to=zhanjun.dong@intel.com \
--cc=intel-xe@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