From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
Matthew Brost <matthew.brost@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>,
Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>,
Jan Sokolowski <jan.sokolowski@intel.com>,
Dominik Grzegorzek <dominik.grzegorzek@intel.com>,
Maciej Patelczyk <maciej.patelczyk@intel.com>
Subject: [PATCH 16/20] drm/xe/eudebug: Mark guc contexts as debuggable
Date: Tue, 18 Nov 2025 16:48:04 +0200 [thread overview]
Message-ID: <20251118144804.2540812-1-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20251006111711.201906-17-mika.kuoppala@linux.intel.com>
We need to inform to guc which contexts are debuggable
as their handling is different from ordinary contexts.
v2: void return, use xe_gt_dbg, no need for lrc (Matt)
v3: add the workaround enabling (Daniele)
v4: version needed to 70.49.4
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Jan Sokolowski <jan.sokolowski@intel.com>
Co-developed-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Co-developed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
drivers/gpu/drm/xe/abi/guc_actions_abi.h | 5 +++
drivers/gpu/drm/xe/abi/guc_klvs_abi.h | 1 +
drivers/gpu/drm/xe/xe_eudebug_hw.h | 7 ++++
drivers/gpu/drm/xe/xe_guc_ads.c | 18 ++++++++++
drivers/gpu/drm/xe/xe_guc_submit.c | 45 ++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_wa_oob.rules | 2 ++
6 files changed, 78 insertions(+)
diff --git a/drivers/gpu/drm/xe/abi/guc_actions_abi.h b/drivers/gpu/drm/xe/abi/guc_actions_abi.h
index 47756e4674a1..32a5f680a6d2 100644
--- a/drivers/gpu/drm/xe/abi/guc_actions_abi.h
+++ b/drivers/gpu/drm/xe/abi/guc_actions_abi.h
@@ -155,6 +155,7 @@ enum xe_guc_action {
XE_GUC_ACTION_NOTIFY_FLUSH_LOG_BUFFER_TO_FILE = 0x8003,
XE_GUC_ACTION_NOTIFY_CRASH_DUMP_POSTED = 0x8004,
XE_GUC_ACTION_NOTIFY_EXCEPTION = 0x8005,
+ XE_GUC_ACTION_EU_KERNEL_DEBUG = 0x8006,
XE_GUC_ACTION_TEST_G2G_SEND = 0xF001,
XE_GUC_ACTION_TEST_G2G_RECV = 0xF002,
XE_GUC_ACTION_LIMIT
@@ -278,4 +279,8 @@ enum xe_guc_g2g_type {
/* invalid type for XE_GUC_ACTION_NOTIFY_MEMORY_CAT_ERROR */
#define XE_GUC_CAT_ERR_TYPE_INVALID 0xdeadbeef
+enum xe_guc_eu_kernel_debug_request_type {
+ XE_GUC_EU_KERNEL_DEBUG_ENABLE = 0x3,
+};
+
#endif
diff --git a/drivers/gpu/drm/xe/abi/guc_klvs_abi.h b/drivers/gpu/drm/xe/abi/guc_klvs_abi.h
index 265a135e7061..fba190d4f84b 100644
--- a/drivers/gpu/drm/xe/abi/guc_klvs_abi.h
+++ b/drivers/gpu/drm/xe/abi/guc_klvs_abi.h
@@ -423,6 +423,7 @@ enum xe_guc_klv_ids {
GUC_WA_KLV_WAKE_POWER_DOMAINS_FOR_OUTBOUND_MMIO = 0x900a,
GUC_WA_KLV_RESET_BB_STACK_PTR_ON_VF_SWITCH = 0x900b,
GUC_WA_KLV_RESTORE_UNSAVED_MEDIA_CONTROL_REG = 0x900c,
+ GUC_WA_KLV_RESET_DEP_ENGINES_ON_DEBUG_CTX_SWITCH = 0x900d,
};
#endif
diff --git a/drivers/gpu/drm/xe/xe_eudebug_hw.h b/drivers/gpu/drm/xe/xe_eudebug_hw.h
index 8f59ec574e4e..7c5df12859ac 100644
--- a/drivers/gpu/drm/xe/xe_eudebug_hw.h
+++ b/drivers/gpu/drm/xe/xe_eudebug_hw.h
@@ -14,6 +14,13 @@ struct xe_eudebug;
struct xe_hw_engine;
struct xe_gt;
+#define XE_EUDEBUG_GUC_VER_MAJOR 70
+#define XE_EUDEBUG_GUC_VER_MINOR 49
+#define XE_EUDEBUG_GUC_VER_PATCH 4
+#define XE_EUDEBUG_GUC_VER_MIN MAKE_GUC_VER(XE_EUDEBUG_GUC_VER_MAJOR, \
+ XE_EUDEBUG_GUC_VER_MINOR, \
+ XE_EUDEBUG_GUC_VER_PATCH)
+
#if IS_ENABLED(CONFIG_DRM_XE_EUDEBUG)
void xe_eudebug_hw_init(struct xe_eudebug *d);
diff --git a/drivers/gpu/drm/xe/xe_guc_ads.c b/drivers/gpu/drm/xe/xe_guc_ads.c
index 58e0b0294a5b..8ff90437c976 100644
--- a/drivers/gpu/drm/xe/xe_guc_ads.c
+++ b/drivers/gpu/drm/xe/xe_guc_ads.c
@@ -16,6 +16,7 @@
#include "regs/xe_gt_regs.h"
#include "regs/xe_guc_regs.h"
#include "xe_bo.h"
+#include "xe_eudebug_hw.h"
#include "xe_gt.h"
#include "xe_gt_ccs_mode.h"
#include "xe_gt_printk.h"
@@ -363,6 +364,23 @@ static void guc_waklv_init(struct xe_guc_ads *ads)
guc_waklv_enable(ads, NULL, 0, &offset, &remain,
GUC_WORKAROUND_KLV_DISABLE_PSMI_INTERRUPTS_AT_C6_ENTRY_RESTORE_AT_EXIT);
+#if IS_ENABLED(CONFIG_DRM_XE_EUDEBUG)
+ if (XE_GT_WA(gt, 14022766366)) {
+ const struct xe_uc_fw_version needed = {
+ .major = XE_EUDEBUG_GUC_VER_MAJOR,
+ .minor = XE_EUDEBUG_GUC_VER_MINOR,
+ .patch = XE_EUDEBUG_GUC_VER_PATCH,
+ };
+
+ if (GUC_FIRMWARE_VER(>->uc.guc) >= MAKE_GUC_VER_STRUCT(needed))
+ guc_waklv_enable(ads, NULL, 0, &offset, &remain,
+ GUC_WA_KLV_RESET_DEP_ENGINES_ON_DEBUG_CTX_SWITCH);
+ else
+ xe_gt_warn(gt, "eudebug needs GuC version %u.%u.%u or greater\n",
+ needed.major, needed.minor, needed.patch);
+ }
+#endif
+
size = guc_ads_waklv_size(ads) - remain;
if (!size)
return;
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 16f78376f196..26dc4a4a67f0 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -21,6 +21,7 @@
#include "xe_assert.h"
#include "xe_devcoredump.h"
#include "xe_device.h"
+#include "xe_eudebug_hw.h"
#include "xe_exec_queue.h"
#include "xe_force_wake.h"
#include "xe_gpu_scheduler.h"
@@ -608,6 +609,47 @@ static void __register_exec_queue(struct xe_guc *guc,
xe_guc_ct_send(&guc->ct, action, ARRAY_SIZE(action), 0, 0);
}
+static bool xe_guc_has_debug_contexts(struct xe_guc *guc)
+{
+ return GUC_FIRMWARE_VER(guc) >= XE_EUDEBUG_GUC_VER_MIN;
+}
+
+static int xe_guc_action_eu_kernel_debug_enable(struct xe_guc *guc,
+ struct xe_exec_queue *q)
+{
+ struct xe_gt *gt = q->hwe->gt;
+ const u32 action[] = {
+ XE_GUC_ACTION_EU_KERNEL_DEBUG,
+ q->guc->id,
+ XE_GUC_EU_KERNEL_DEBUG_ENABLE,
+ 0, /* reserved */
+ };
+ int ret;
+
+ ret = xe_guc_ct_send(&guc->ct, action,
+ ARRAY_SIZE(action), 0, 0);
+
+ if (ret)
+ xe_gt_dbg(gt, "GuC ctx=%d debug enabling failed with %d",
+ action[1], ret);
+ else
+ xe_gt_dbg(gt, "GuC ctx=%d enabled for debug", action[1]);
+
+ return ret;
+}
+
+static void set_debug(struct xe_guc *guc, struct xe_exec_queue *q)
+{
+ int ret;
+
+ if (!xe_guc_has_debug_contexts(guc))
+ return;
+
+ ret = xe_guc_action_eu_kernel_debug_enable(guc, q);
+ if (ret)
+ xe_gt_warn(q->gt, "Failed to set eu kernel debug enable");
+}
+
static void register_exec_queue(struct xe_exec_queue *q, int ctx_type)
{
struct xe_guc *guc = exec_queue_to_guc(q);
@@ -662,6 +704,9 @@ static void register_exec_queue(struct xe_exec_queue *q, int ctx_type)
else
__register_exec_queue(guc, &info);
init_policies(guc, q);
+
+ if (xe_exec_queue_is_debuggable(q))
+ set_debug(guc, q);
}
static u32 wq_space_until_wrap(struct xe_exec_queue *q)
diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
index e8f09ae7a67b..31272c83c6e0 100644
--- a/drivers/gpu/drm/xe/xe_wa_oob.rules
+++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
@@ -85,3 +85,5 @@
#eudebug
18022722726 GRAPHICS_VERSION_RANGE(1250, 1274)
14015474168 PLATFORM(PVC)
+14022766366 GRAPHICS_VERSION_RANGE(2000, 2004)
+ GRAPHICS_VERSION_RANGE(3000, 3005)
--
2.43.0
next prev parent reply other threads:[~2025-11-18 14:48 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 11:16 [PATCH 00/20] Intel Xe GPU Debug Support (eudebug) v5 Mika Kuoppala
2025-10-06 11:16 ` [PATCH 01/20] drm/xe/eudebug: Introduce eudebug interface Mika Kuoppala
2025-10-06 11:16 ` [PATCH 02/20] drm/xe/eudebug: Introduce discovery for resources Mika Kuoppala
2025-10-06 11:16 ` [PATCH 03/20] drm/xe/eudebug: Introduce exec_queue events Mika Kuoppala
2025-10-06 11:16 ` [PATCH 04/20] drm/xe: Add EUDEBUG_ENABLE exec queue property Mika Kuoppala
2025-10-06 11:16 ` [PATCH 05/20] drm/xe: Introduce ADD_DEBUG_DATA and REMOVE_DEBUG_DATA vm bind ops Mika Kuoppala
2025-10-06 11:16 ` [PATCH 06/20] drm/xe/eudebug: Introduce vm bind and vm bind debug data events Mika Kuoppala
2025-10-06 11:16 ` [PATCH 07/20] drm/xe/eudebug: Add UFENCE events with acks Mika Kuoppala
2025-10-06 11:16 ` [PATCH 08/20] drm/xe/eudebug: vm open/pread/pwrite Mika Kuoppala
2025-10-06 11:16 ` [PATCH 09/20] drm/xe/eudebug: userptr vm pread/pwrite Mika Kuoppala
2025-10-06 11:17 ` [PATCH 10/20] drm/xe/eudebug: hw enablement for eudebug Mika Kuoppala
2025-10-06 11:17 ` [PATCH 11/20] drm/xe/eudebug: Introduce EU control interface Mika Kuoppala
2025-10-06 11:17 ` [PATCH 12/20] drm/xe/eudebug: Introduce per device attention scan worker Mika Kuoppala
2025-10-06 11:17 ` [PATCH 13/20] drm/xe/eudebug_test: Introduce xe_eudebug wa kunit test Mika Kuoppala
2025-10-06 11:17 ` [PATCH 14/20] drm/xe: Implement SR-IOV and eudebug exclusivity Mika Kuoppala
2025-10-06 11:17 ` [PATCH 15/20] drm/xe: Add xe_client_debugfs and introduce debug_data file Mika Kuoppala
2025-10-06 11:17 ` [PATCH 16/20] drm/xe/eudebug: Mark guc contexts as debuggable Mika Kuoppala
2025-10-06 18:35 ` Matthew Brost
2025-10-20 12:56 ` Mika Kuoppala
2025-10-20 12:53 ` Mika Kuoppala
2025-11-18 14:48 ` Mika Kuoppala [this message]
2025-11-19 21:33 ` Daniele Ceraolo Spurio
2025-10-06 11:17 ` [PATCH 17/20] drm/xe/eudebug: Add read/count/compare helper for eu attention Mika Kuoppala
2025-10-06 11:17 ` [PATCH 18/20] drm/xe/eudebug: Introduce EU pagefault handling interface Mika Kuoppala
2025-10-06 11:17 ` [PATCH 19/20] drm/xe/vm: Support for adding null page VMA to VM on request Mika Kuoppala
2025-10-06 11:17 ` [PATCH 20/20] drm/xe/eudebug: Enable EU pagefault handling Mika Kuoppala
2025-10-06 18:43 ` Matthew Brost
2025-10-06 12:30 ` ✗ CI.checkpatch: warning for Intel Xe GPU Debug Support (eudebug) v5 Patchwork
2025-10-06 12:31 ` ✓ CI.KUnit: success " Patchwork
2025-10-06 13:14 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-06 15:53 ` ✗ Xe.CI.Full: 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=20251118144804.2540812-1-mika.kuoppala@linux.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jan.sokolowski@intel.com \
--cc=lucas.demarchi@intel.com \
--cc=maciej.patelczyk@intel.com \
--cc=matthew.brost@intel.com \
/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