From: Zhanjun Dong <zhanjun.dong@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Zhanjun Dong <zhanjun.dong@intel.com>
Subject: [PATCH v3 4/4] drm/xe/guc: Only add GuC crash dump if available
Date: Thu, 10 Apr 2025 08:58:53 -0700 [thread overview]
Message-ID: <20250410155853.574830-5-zhanjun.dong@intel.com> (raw)
In-Reply-To: <20250410155853.574830-1-zhanjun.dong@intel.com>
Add GuC crash dump data empty check. LFD will only include crash dump
section when data is not empty.
Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com>
---
drivers/gpu/drm/xe/xe_guc_log.c | 35 +++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/xe_guc_log.c
index 7cdf6bf238f3..1e5976a382be 100644
--- a/drivers/gpu/drm/xe/xe_guc_log.c
+++ b/drivers/gpu/drm/xe/xe_guc_log.c
@@ -407,6 +407,36 @@ xe_guc_log_add_log_event(char *buf, int buf_size, char *log_bin,
return len + lfd->desc_dw_size * sizeof(u32);
}
+static int
+xe_guc_log_add_crash_dump(char *buf, int buf_size, char *log_bin,
+ struct guc_log_init_config_save_t *config)
+{
+ int i, dw_size;
+ u32 *buf32;
+ struct guc_log_buffer_entry_list *entry;
+
+ entry = &entry_list[GUC_LOG_BUFFER_STATE_HEADER_ENTRY_CRASH];
+
+ /* Skip empty log */
+ if (!entry->buf_size)
+ return 0;
+
+ buf32 = (u32 *)&log_bin[entry->offset];
+ dw_size = entry->buf_size / sizeof(u32);
+
+ /* Check if crash dump section are all zero */
+ for (i = 0; i < dw_size; i++)
+ if (buf32[i])
+ break;
+
+ /* Buffer has non-zero data? */
+ if (i < dw_size)
+ return xe_guc_log_add_typed_payload(buf, buf_size,
+ GUC_LFD_TYPE_FW_CRASH_DUMP,
+ entry->buf_size, buf32);
+ return 0;
+}
+
static inline int lic_type_to_KLV_index(u32 lic_type)
{
XE_WARN_ON(lic_type < GUC_LOG_LIC_TYPE_FIRST || lic_type >= GUC_LOG_LIC_TYPE_LAST);
@@ -532,6 +562,11 @@ static int xe_guc_log_save_to_lfd_buf(char *buf, int size, u32 *guc_log_bin,
return len;
index += len;
+ len = xe_guc_log_add_crash_dump(&buf[index], size - index, char_bin, config);
+ if (len < 0)
+ return len;
+ index += len;
+
return index;
}
--
2.34.1
next prev parent reply other threads:[~2025-04-10 15:59 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 15:58 [PATCH v3 0/4] drm/xe/guc: Add LFD format output for guc log Zhanjun Dong
2025-04-10 15:58 ` [PATCH v3 1/4] drm/xe/guc: Add LFD related abi definitions Zhanjun Dong
2025-04-10 17:50 ` Cavitt, Jonathan
2025-04-10 22:20 ` Dong, Zhanjun
2025-04-10 22:29 ` Cavitt, Jonathan
2025-04-11 15:28 ` Michal Wajdeczko
2025-04-11 21:58 ` Dong, Zhanjun
2025-04-10 15:58 ` [PATCH v3 2/4] drm/xe/guc: Add new debugfs entry for lfd format output Zhanjun Dong
2025-04-10 17:50 ` Cavitt, Jonathan
2025-04-10 22:45 ` Dong, Zhanjun
2025-04-11 15:34 ` Michal Wajdeczko
2025-04-11 22:40 ` Dong, Zhanjun
2025-04-10 15:58 ` [PATCH v3 3/4] drm/xe/guc: Add GuC log LFD format support Zhanjun Dong
2025-04-10 17:52 ` Cavitt, Jonathan
2025-04-11 16:14 ` Michal Wajdeczko
2025-04-11 22:58 ` Dong, Zhanjun
2025-04-10 15:58 ` Zhanjun Dong [this message]
2025-04-10 17:52 ` [PATCH v3 4/4] drm/xe/guc: Only add GuC crash dump if available Cavitt, Jonathan
2025-04-10 16:03 ` ✓ CI.Patch_applied: success for drm/xe/guc: Add LFD format output for guc log (rev3) Patchwork
2025-04-10 16:04 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-10 16:05 ` ✓ CI.KUnit: success " Patchwork
2025-04-10 16:13 ` ✓ CI.Build: " Patchwork
2025-04-10 16:15 ` ✓ CI.Hooks: " Patchwork
2025-04-10 16:17 ` ✓ CI.checksparse: " Patchwork
2025-04-10 16:53 ` ✓ Xe.CI.BAT: " Patchwork
2025-04-10 21:00 ` ✗ 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=20250410155853.574830-5-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