Re: [PATCH v3 09/23] drm/xe/log: Add SIGID log helpers for errno-only

"Mallesh, Koujalagi" <[email protected]> Tue, 4 Aug 2026 10:26:51 +0530
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>
On 30-07-2026 08:51 pm, Michal Wajdeczko wrote:
> For the software based SIGID errors, we will usually want to pass
> only the errno value as the data to be logged in the dmesg line or
> the CPER record. Add simple wrappers for that.
>
> Signed-off-by: Michal Wajdeczko <[email protected]>
> Cc: Rodrigo Vivi <[email protected]>
> ---
> Cc: Aravind Iddamsetty <[email protected]>
> Cc: Mallesh Koujalagi <[email protected]>
> ---
> v2: include linux/err.h (Sashiko)
>      add xe_log_err_corrected (Michal)
> ---
>   drivers/gpu/drm/xe/xe_log.h | 52 +++++++++++++++++++++++++++++++++++++
>   1 file changed, 52 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_log.h b/drivers/gpu/drm/xe/xe_log.h
> index c30db02950b0..5716fb7eeb31 100644
> --- a/drivers/gpu/drm/xe/xe_log.h
> +++ b/drivers/gpu/drm/xe/xe_log.h
> @@ -7,6 +7,7 @@
>   #define _XE_LOG_H_
>   
>   #include <linux/cper.h>
> +#include <linux/err.h>
>   
>   #include "abi/xe_log_abi.h"
>   #include "abi/xe_sigid_abi.h"
> @@ -103,4 +104,55 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
>   	xe_log_from((any), (cper_sev), (int)XE_LOG_COMPONENT_##TAG##_SIGID, \
>   		    XE_LOG_COMPONENT_##TAG, (data), (len), fmt, ##args)
>   
> +/**
> + * xe_log_err() - Emit a structured SIGID error log entry on the component behalf.
> + * @any: the &xe_device or &xe_tile or &xe_gt pointer this report relates to
> + * @TAG: the component tag to use
> + * @err: negative errno for the failing operation, or 0 if not applicable
> + * @fmt: printf-style free text format string (not a stable interface)
> + * @args: arguments for the @fmt format string
> + *
> + * The log entry will be emitted with @CPER_SEV_RECOVERABLE severity.
> + */
> +#define xe_log_err(any, TAG, err, fmt, args...) \
> +	xe_log_comp((any), CPER_SEV_RECOVERABLE, TAG, ERR_PTR(err), 0, fmt, ##args)
> +
> +/**
> + * xe_log_err_fatal() - Emit a structured SIGID error log entry on the component behalf.
> + * @any: the &xe_device or &xe_tile or &xe_gt pointer this report relates to
> + * @TAG: the component tag to use
> + * @err: negative errno for the failing operation, or 0 if not applicable
> + * @fmt: printf-style free text format string (not a stable interface)
> + * @args: arguments for the @fmt format string
> + *
> + * The log entry will be emitted with @CPER_SEV_FATAL severity.
> + */
> +#define xe_log_err_fatal(any, TAG, err, fmt, args...) \
> +	xe_log_comp((any), CPER_SEV_FATAL, TAG, ERR_PTR(err), 0, fmt, ##args)
> +
> +/**
> + * xe_log_err_corrected() - Emit a structured SIGID error log entry on the component behalf.
> + * @any: the &xe_device or &xe_tile or &xe_gt pointer this report relates to
> + * @TAG: the component tag to use
> + * @err: negative errno for the failing operation, or 0 if not applicable
> + * @fmt: printf-style free text format string (not a stable interface)
> + * @args: arguments for the @fmt format string
> + *
> + * The log entry will be emitted with @CPER_SEV_CORRECTED severity.
> + */
> +#define xe_log_err_corrected(any, TAG, err, fmt, args...) \
> +	xe_log_comp((any), CPER_SEV_CORRECTED, TAG, ERR_PTR(err), 0, fmt, ##args)
> +
> +/**
> + * xe_log_info() - Emit a structured SIGID information log entry on the component behalf.
> + * @any: the &xe_device or &xe_tile or &xe_gt pointer this report relates to
> + * @TAG: the component tag to use
> + * @fmt: printf-style free text format string (not a stable interface)
> + * @args: arguments for the @fmt format string
> + *
> + * The log entry will be emitted with @CPER_SEV_INFORMATIONAL severity.
> + */
> +#define xe_log_info(any, TAG, fmt, args...) \
> +	xe_log_comp((any), CPER_SEV_INFORMATIONAL, TAG, NULL, 0, fmt, ##args)
> +
Please add severity based helper function such as xe_log_comp_fatal(any, 
TAG, ...) etc.

Since we've severity based helper function for (xe_log_emit_*, 
xe_log_from_*) for consistency (1:1 mapping).

With that

Reviewed-by: Mallesh Koujalagi <[email protected]>

>   #endif