[PATCH v3 4/4] drm/xe/guc: Only add GuC crash dump if available

Cavitt, Jonathan jonathan.cavitt at intel.com
Thu Apr 10 17:52:17 UTC 2025


-----Original Message-----
From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Zhanjun Dong
Sent: Thursday, April 10, 2025 8:59 AM
To: intel-xe at lists.freedesktop.org
Cc: Dong, Zhanjun <zhanjun.dong at intel.com>
Subject: [PATCH v3 4/4] drm/xe/guc: Only add GuC crash dump if available
> 
> 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 at intel.com>

LGTM, though I'm not sure why it was requested this be broken
into a separate patch.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt

> ---
>  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
> 
> 


More information about the Intel-xe mailing list