Skip to contentSkip to conversation

drm/xe: Add structured SIGID error logging infrastructure

PATCH Superseded Michal Wajdeczko 8 participants 76 messages Jul 30 – Aug 13 5 messages not in the archive Page 1 of 2

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover drm/xe: Add structured SIGID error logging infrastructure

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

Design decisions:

- Software-emitted signatures only. This header enumerates just the situations the driver detects and reports itself. Signatures that originate in firmware or hardware are identified by those layers (via their own records/counters) and are logged as received -- minting a driver-side id for them would duplicate an id the reporting layer already owns.

- Flat catalogue, chosen per report site. Each site emits the single most specific situation for that site, so a multi-layer failure produces a chain of reports rather than one ambiguous classification (e.g. a failed GT reset reports GT_TDR and then WEDGED). A site that matches no defined situation keeps using ordinary xe_err() / xe_gt_err() rather than forcing a wrong id.

- Stable numbering. A single flat list numbered sequentially from 1, in introduction order. Values are only ever appended, never renumbered or reused.

- First-order action. Each SIGID carries a coarse, in-tree resolution bucket (COLLECT / RETRY / UPDATE / RECOVER) so it is actionable without an external reference, and so every new id must declare what to do about it.

- Severity is decoupled from the SIGID and chosen at the call site via xe_ras_log_fatal() / _recoverable() / _info(); the same situation can be reported at different severities depending on the instance.

- dmesg stays close to a normal xe error line by reusing xe_err() / xe_gt_err() (and their Tile/GT decoration); the only stable, machine-matchable token added is SIGID=<n>. dmesg is not an ABI -- the durable machine record is the CPER carrying the same SIGID (a planned follow-up, left as a TODO).

Wire up a representative site for each software signature so the set is exercised rather than merely declared:

- PROBE: xe workqueue allocation failure during early init
- WEDGED: xe_device_declare_wedged() (drop redundant "CRITICAL" + BDF)
- SURVIVABILITY: entering boot survivability mode
- RUNTIME_FW: GuC mmio request failure
- DEVICE_FW: PCODE mailbox failure
- GT_TDR: GT reset failure (which then chains into a WEDGED report)
- MEM_FAULT: page-fault queue overflow
- IO_BUS: PCI re-enable failure after a bus reset

Cc Thomas Hellström <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Raag Jadav <[email protected]>
Cc Badal Nilawar <[email protected]>

v1: https://patchwork.freedesktop.org/series/171022/#rev1
v2: https://patchwork.freedesktop.org/series/171022/#rev2
component/location dmesg decorations moved away from macros HW component identifiers related to RAS/FW enum values CORRECTED severity rendered as an error
more support for const pointers
log 'probe blocked' as INFO
fix kunit device setup
more tests
v3: fix typos, args list and to_dev() corner case (Sashiko)
use assoc macros in xe_any (Jani)
add xe_any kunit test suite (Michal)
add more xe_log test cases (Michal)

Mallesh Koujalagi (1):
drm/xe/log: Add structured SIGID error logging infrastructure

Michal Wajdeczko (22):
drm/xe: Introduce xe_any helpers
drm/xe/log: Introduce structured component/location identifiers drm/xe/log: Add component/location decorations to dmesg drm/xe/log: Add SIGID log helpers for severity drm/xe/log: Add SIGID log helpers for location drm/xe/log: Add SIGID log helpers for location & severity drm/xe/log: Add SIGID log helpers for components drm/xe/log: Add SIGID log helpers for errno-only drm/xe/log: Add hardware error signatures
drm/xe/log: Extend components list with hardware items drm/xe/ras: Check RAS and LOG component definitions drm/xe/kunit: Setup driver data in the test device drm/xe/tests: Add Kunit tests for xe_log drm/xe/tests: Add kunit tests for xe_any
drm/xe: Report 'probe blocked' error using SIGID drm/xe: Report 'device wedged' errors using SIGID drm/xe: Report 'Survivability Mode' errors using SIGID drm/xe/guc: Report 'GuC mmio' errors using SIGID drm/xe/pcode: Report 'Mailbox failed' error using SIGID drm/xe/gt: Report 'reset failed' errors using SIGID drm/xe/gt: Report 'pagefault' errors using SIGID drm/xe/pci: Report 'cannot re-enable' error using SIGID

 Documentation/gpu/xe/index.rst              |   1 +
 Documentation/gpu/xe/xe_sigid.rst           |  14 +
 drivers/gpu/drm/xe/Makefile                 |   1 +
 drivers/gpu/drm/xe/abi/xe_log_abi.h         | 198 +++++++
 drivers/gpu/drm/xe/abi/xe_sigid_abi.h       | 195 +++++++
 drivers/gpu/drm/xe/tests/Makefile           |   1 +
 drivers/gpu/drm/xe/tests/xe_any_kunit.c     | 188 +++++++
 drivers/gpu/drm/xe/tests/xe_kunit_helpers.c |   4 +
 drivers/gpu/drm/xe/tests/xe_log_kunit.c     | 545 ++++++++++++++++++++
 drivers/gpu/drm/xe/xe_any.h                 | 137 +++++
 drivers/gpu/drm/xe/xe_device.c              |  16 +-
 drivers/gpu/drm/xe/xe_gt.c                  |   7 +-
 drivers/gpu/drm/xe/xe_guc.c                 |  18 +-
 drivers/gpu/drm/xe/xe_log.c                 | 232 +++++++++
 drivers/gpu/drm/xe/xe_log.h                 | 158 ++++++
 drivers/gpu/drm/xe/xe_pagefault.c           |  10 +-
 drivers/gpu/drm/xe/xe_pci.c                 |   5 +-
 drivers/gpu/drm/xe/xe_pci_error.c           |   7 +-
 drivers/gpu/drm/xe/xe_pcode.c               |   5 +-
 drivers/gpu/drm/xe/xe_ras.c                 |  11 +
 drivers/gpu/drm/xe/xe_survivability_mode.c  |  24 +-
 21 files changed, 1738 insertions(+), 39 deletions(-)
 create mode 100644 Documentation/gpu/xe/xe_sigid.rst
 create mode 100644 drivers/gpu/drm/xe/abi/xe_log_abi.h
 create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h
 create mode 100644 drivers/gpu/drm/xe/tests/xe_any_kunit.c
 create mode 100644 drivers/gpu/drm/xe/tests/xe_log_kunit.c
 create mode 100644 drivers/gpu/drm/xe/xe_any.h
 create mode 100644 drivers/gpu/drm/xe/xe_log.c
 create mode 100644 drivers/gpu/drm/xe/xe_log.h
Signature · 1 line
2.47.1
#1 lore raw

PATCH v3 2/23 drm/xe/log: Add structured SIGID error logging infrastructure

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
 Documentation/gpu/xe/index.rst        |   1 +
 Documentation/gpu/xe/xe_sigid.rst     |  14 ++
 drivers/gpu/drm/xe/Makefile           |   1 +
 drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.h           |  20 +++
 6 files changed, 354 insertions(+)
 create mode 100644 Documentation/gpu/xe/xe_sigid.rst
 create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h
 create mode 100644 drivers/gpu/drm/xe/xe_log.c
 create mode 100644 drivers/gpu/drm/xe/xe_log.h
Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
 	xe_hw_fence.o \
 	xe_irq.o \
 	xe_late_bind_fw.o \
+	xe_log.o \
 	xe_lrc.o \
 	xe_mem_pool.o \
 	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +183 -0

183 lines not on this page · raw message

drivers/gpu/drm/xe/xe_log.c new file +135 -0

135 lines not on this page · raw message

drivers/gpu/drm/xe/xe_log.h new file +20 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...);
+
+#endif
Signature · 1 line
2.47.1
#2 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Hi Mallesh/Michal

Quoted 95 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
  Documentation/gpu/xe/index.rst        |   1 +
  Documentation/gpu/xe/xe_sigid.rst     |  14 ++
  drivers/gpu/drm/xe/Makefile           |   1 +
  drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.h           |  20 +++
  6 files changed, 354 insertions(+)

create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
     xe-drm-usage-stats.rst
     xe_configfs
     xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
  	xe_hw_fence.o \
  	xe_irq.o \
  	xe_late_bind_fw.o \
+	xe_log.o \
  	xe_lrc.o \
  	xe_mem_pool.o \
  	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +7 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 17

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a

The SIG ID maps to a report site as mentioned in "How to pick a sigid" not a human description.

Quoted 11 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 38

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not

This should also be consistent with "report site" instead of situation.

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 50

Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +12 -0
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *

It'd be more intuitive for readers if section "When to use SIGID logging" is moved before how to pick one.

Quoted 28 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +28 -0
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 88

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------

This section also needs to be on the top. It can be missed if it is at the bottom of the document.

Quoted 11 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 109

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)

Do we actually need resolution buckets defined here? RECOVER or UPDATE seem a bit vague since states like WEDGED/SURVIVABILITY have different ways to recover depending on context. Wouldn't detailed resolution steps in another document be better than in logs?

Quoted 21 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +21 -0
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 140

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100

why does the sigid start from 100?

Quoted 8 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +8 -0
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100
+#define INTEL_SIGID_GPU_XE_END			299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 158

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]

Pcode or sysctrl errors cannot be retried. Pcode init failures cause survivability mode. RAS sysctrl errors require a secondary bus reset. We could have other firmwares in future with different recovery.
That is why it would be better to drop resolution buckets in logs.

@aravind thoughts?

Thanks
Riana

Quoted 192 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +25 -0
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,
+	XE_SIGID_PROBE			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+	XE_SIGID_WEDGED			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+	XE_SIGID_SURVIVABILITY		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+	XE_SIGID_RUNTIME_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+	XE_SIGID_DEVICE_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +135 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			  u32 component, u32 location, const void *data, size_t len,
+			  struct va_format *vaf)
+{
+	/* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+	return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+	return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+	return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR : "";
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+	switch (cper_sev) {
+	case CPER_SEV_FATAL:
+		return "FATAL ";
+	case CPER_SEV_RECOVERABLE:
+		return "";
+	case CPER_SEV_CORRECTED:
+		return "CORRECTED ";
+	default:
+		return "";
+	}
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)	"[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...)	__LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	if (cper_sev == CPER_SEV_INFORMATIONAL)
+		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+	else
+		pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+	va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			   u32 component, u32 location, const void *data, size_t len,
+			   struct va_format *vaf)
+{
+	const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+	const char *sev_prefix = log_sev_prefix(cper_sev);
+
+	/* TODO: add component/location details */
+
+	if (IS_ERR(data))
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%pV",
+				 sigid, sev_prefix, data, hwe_prefix, vaf);
+	else if (data && len)
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+				 sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+	else
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+				 sigid, sev_prefix, hwe_prefix, vaf);
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine-matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_emit_dmesg(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+	log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+
+	va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +20 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...);
+
+#endif
maintainer
#3 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 102 lines · Riana

Hi Mallesh/Michal

Quoted 99 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
  Documentation/gpu/xe/index.rst        |   1 +
  Documentation/gpu/xe/xe_sigid.rst     |  14 ++
  drivers/gpu/drm/xe/Makefile           |   1 +
  drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.h           |  20 +++
  6 files changed, 354 insertions(+)

create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
     xe-drm-usage-stats.rst
     xe_configfs
     xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
  	xe_hw_fence.o \
  	xe_irq.o \
  	xe_late_bind_fw.o \
+	xe_log.o \
  	xe_lrc.o \
  	xe_mem_pool.o \
  	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 17

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +6 -0
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a

The SIG ID maps to a report site as mentioned in "How to pick a sigid" not a human description.

Indeed, perhaps with simple:
s/maps to a human description/maps to a report site/

we get some consistency?!

Quoted 22 lines
Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 38

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
Quoted 1 line

This should also be consistent with "report site" instead of situation.

Agree.
s/situation/report site/

Quoted 13 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 50

Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +12 -0
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
Quoted 2 lines

It'd be more intuitive for readers if section "When to use SIGID logging" is moved before how to pick one.

It makes sense to me.

Quoted 39 lines
Quoted 28 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +28 -0
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 88

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
Quoted 2 lines

This section also needs to be on the top. It can be missed if it is at the bottom of the document.

Also agree.

Quoted 24 lines
Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 109

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
Quoted 5 lines

Do we actually need resolution buckets defined here? RECOVER or UPDATE seem a bit vague since states like
 WEDGED/SURVIVABILITY have different ways to recover depending on context. Wouldn't detailed resolution steps in another
document be better than in logs?

Fair enough. I would prefer we have some recommendation for a consistent end to end story without depending on external docs and all. However I do agree that the vagueness in some cases here can defeat the purpose and mostly the conflict with the wedge.

Aravind was already complaining about these buckets. So, perhaps let's just remove. But also for consistency we need to change the rest of the text above and below:

- drop "maps to … a recommended first action …
- Delete the whole First-order action (resolution buckets) sectio
- Strip the [TAG] from all nine enum entries.
- Drop the dmesg note "the bucket … is not printed on the dmesg line.

Michal, what are your thoughts?

Thanks,
Rodrigo.

Quoted 258 lines
Quoted 22 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +21 -0
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 140

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100

why does the sigid start from 100?

Quoted 8 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +8 -0
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100
+#define INTEL_SIGID_GPU_XE_END			299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 158

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]

Pcode or sysctrl errors cannot be retried. Pcode init failures cause survivability mode.
RAS sysctrl errors require a secondary bus reset. We could have other firmwares in future with different
recovery.
That is why it would be better to drop resolution buckets in logs.

@aravind thoughts?

Thanks
Riana

Quoted 192 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +25 -0
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,
+	XE_SIGID_PROBE			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+	XE_SIGID_WEDGED			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+	XE_SIGID_SURVIVABILITY		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+	XE_SIGID_RUNTIME_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+	XE_SIGID_DEVICE_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +135 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			  u32 component, u32 location, const void *data, size_t len,
+			  struct va_format *vaf)
+{
+	/* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+	return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+	return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+	return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR : "";
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+	switch (cper_sev) {
+	case CPER_SEV_FATAL:
+		return "FATAL ";
+	case CPER_SEV_RECOVERABLE:
+		return "";
+	case CPER_SEV_CORRECTED:
+		return "CORRECTED ";
+	default:
+		return "";
+	}
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)	"[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...)	__LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	if (cper_sev == CPER_SEV_INFORMATIONAL)
+		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+	else
+		pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+	va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			   u32 component, u32 location, const void *data, size_t len,
+			   struct va_format *vaf)
+{
+	const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+	const char *sev_prefix = log_sev_prefix(cper_sev);
+
+	/* TODO: add component/location details */
+
+	if (IS_ERR(data))
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%pV",
+				 sigid, sev_prefix, data, hwe_prefix, vaf);
+	else if (data && len)
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+				 sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+	else
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+				 sigid, sev_prefix, hwe_prefix, vaf);
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine-matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_emit_dmesg(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+	log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+
+	va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +20 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...);
+
+#endif
#4 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 244 lines · Rodrigo Vivi
Quoted 102 lines · Riana

Hi Mallesh/Michal

Quoted 99 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
  Documentation/gpu/xe/index.rst        |   1 +
  Documentation/gpu/xe/xe_sigid.rst     |  14 ++
  drivers/gpu/drm/xe/Makefile           |   1 +
  drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.h           |  20 +++
  6 files changed, 354 insertions(+)

create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
     xe-drm-usage-stats.rst
     xe_configfs
     xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
  	xe_hw_fence.o \
  	xe_irq.o \
  	xe_late_bind_fw.o \
+	xe_log.o \
  	xe_lrc.o \
  	xe_mem_pool.o \
  	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 17

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +6 -0
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a

The SIG ID maps to a report site as mentioned in "How to pick a sigid" not a human description.

Indeed, perhaps with simple:
s/maps to a human description/maps to a report site/

we get some consistency?!

Quoted 22 lines
Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 38

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
Quoted 1 line

This should also be consistent with "report site" instead of situation.

Agree.
s/situation/report site/

Quoted 13 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 50

Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +12 -0
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
Quoted 2 lines

It'd be more intuitive for readers if section "When to use SIGID logging" is moved before how to pick one.

It makes sense to me.

Quoted 39 lines
Quoted 28 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +28 -0
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 88

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
Quoted 2 lines

This section also needs to be on the top. It can be missed if it is at the bottom of the document.

Also agree.

Quoted 24 lines
Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 109

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
Quoted 5 lines

Do we actually need resolution buckets defined here? RECOVER or UPDATE seem a bit vague since states like
 WEDGED/SURVIVABILITY have different ways to recover depending on context. Wouldn't detailed resolution steps in another
document be better than in logs?

Fair enough. I would prefer we have some recommendation for a consistent end to end story without depending on external docs and all. However I do agree that the vagueness in some cases here can defeat the purpose and mostly the conflict with the wedge.

Aravind was already complaining about these buckets. So, perhaps let's just remove. But also for consistency we need to change the rest of the text above and below:

Quoted 6 lines

- drop "maps to … a recommended first action …
- Delete the whole First-order action (resolution buckets) sectio
- Strip the [TAG] from all nine enum entries.
- Drop the dmesg note "the bucket … is not printed on the dmesg line.

Michal, what are your thoughts?

here is updated DOC section, please check if I get it right

/**
* DOC: Xe Error Signatures (SIGID)
*
* What SIGID stands for
* ---------------------
*
* SIGID is short for *Signature Identifier*. It is a small, stable integer
* that names one of *recognised fault site* -- nothing more. It is the
* primary handle used for triage and maps directly to specific report site. *
* Numbering
* ---------
*
* SIGIDs are a single flat list numbered sequentially within the assigned range,
* in the order the fault sites were introduced. Values are stable: once assigned
* they are only ever appended, never renumbered or reused. A retired fault site
* SIGID value is deprecated in place, never re-purposed.
*
* Why this exists
* ---------------
*
* Today the driver reports faults with ad-hoc ``xe_err()`` / ``xe_gt_err()``
* strings that have no stable shape. That is fine for a human reading dmesg,
* but it gives fleet tooling nothing durable to match on: the wording changes
* between releases, lines can be rate-limited or dropped under an error storm,
* and there is no consistent way to ask "which recognised fault just happened?" *
* A SIGID answers exactly that one question, identically across driver and
* firmware versions, and (eventually) across other Intel devices in a node. *
* What a SIGID is not
* -------------------
*
* SIGID deliberately does not encode the detailed reason or the outcome. Those
* are carried alongside it::
*

 *   SIGID    -> which recognised fault site is being reported
 *   severity -> how serious this instance is
 *   errno    -> the failing operation's error, if available, shown with %pe
 *   message  -> free-form human-readable context

*
* Severity is independent of the SIGID. The same SIGID can be reported at
* different severities depending on the instance and the recovery taken. *
* When to use SIGID logging
* -------------------------
*
* The xe_log_*() helpers are for these recognised fault sites only --
* important, operator-relevant faults and events. The driver's only job is to
* emit the right SIGID next to the usual human-readable text.

* They are not a replacement for ``xe_info()`` / ``xe_dbg()`` / tracing, nor
* for one-off diagnostics; using them for ordinary logging would dilute the
* fault stream. Not every ``xe_err()`` needs to become a SIGID report -- only
* those that correspond to a published fault sites.
*
* SIGID log output (dmesg vs. the machine record)
* -----------------------------------------------
*
* The dmesg line stays close to a normal xe error message so it remains
* readable for admins; the only stable, machine-matchable token on it is
* ``SIGID=<n>`` (``dmesg | grep SIGID=``).
*
* The full dmesg line is not an ABI: the surrounding text may change freely,
* and lines may be dropped. The durable record for tooling is the CPER record
* carrying the same SIGID (generation is a planned follow-up).
*
* How to pick a SIGID (the uniqueness rule)
* -----------------------------------------
*
* Pick per *report site*, not per incident. Each site emits the single most
* specific recognised SIGID *for that site* -- so the question is never
* "classify this whole failure", it is "what does this site detect?", which has
* one answer. A single underlying failure therefore legitimately produces a
* *chain* of reports from different layers, each with its own SIGID -- e.g. a
* GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
* path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
* aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
* follow a fault from origin to final effect; it is not a duplicate. *
* If a site does not match any defined SIGID, keep using the ordinary
* ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
* or over-broad classification is harder to retire than a missing one. When a
* new report site is genuinely worth triaging, add it to the list below. *
* Scope: software vs hardware emitted signatures
* ----------------------------------------------
*
* Some SIGID represents fault sites that the *driver itself* detects and
* reports from the software POV: probe abort, wedged, survivability, driver-
* detected firmware failures, engine TDR, memory faults and IO/bus faults.
* These are the only values the driver assigns on its own.
*
* Signatures that *originate* in firmware or hardware are a different thing:
* they are produced and identified by the firmware or the hardware itself
* (e.g. via their own records or error counters), and the driver merely logs
* them as they are given to us. They are deliberately enumerated separately. *
* The two driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
* %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
* observed a firmware problem, not a signature reported by the firmware. */

Quoted 38 lines

Thanks,
Rodrigo.

Quoted 34 lines
Quoted 22 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +21 -0
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 140

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100

why does the sigid start from 100?

there was an offline agreement with Yoni to start GPU SIGIDs from 100 with the limit up to 999 for any future GPU SIGIDs we may want to have

Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 144

Quoted 5 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +4 -0
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100
+#define INTEL_SIGID_GPU_XE_END			299

and for the XE we should use range 100..299

Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 147

Quoted 3 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +3 -0
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199

with the explicit split for SW/HW originated 'fault sites'

Quoted 24 lines
Quoted 24 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 158

Quoted 11 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]

Pcode or sysctrl errors cannot be retried. Pcode init failures cause survivability mode.
RAS sysctrl errors require a secondary bus reset. We could have other firmwares in future with different
recovery.
That is why it would be better to drop resolution buckets in logs.

@aravind thoughts?

Thanks
Riana

maintainer
#5 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 350 lines · Michal Wajdeczko
Quoted 244 lines · Rodrigo Vivi
Quoted 102 lines · Riana

Hi Mallesh/Michal

Quoted 99 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
  Documentation/gpu/xe/index.rst        |   1 +
  Documentation/gpu/xe/xe_sigid.rst     |  14 ++
  drivers/gpu/drm/xe/Makefile           |   1 +
  drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.h           |  20 +++
  6 files changed, 354 insertions(+)

create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
     xe-drm-usage-stats.rst
     xe_configfs
     xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
  	xe_hw_fence.o \
  	xe_irq.o \
  	xe_late_bind_fw.o \
+	xe_log.o \
  	xe_lrc.o \
  	xe_mem_pool.o \
  	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 17

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +6 -0
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a

The SIG ID maps to a report site as mentioned in "How to pick a sigid" not a human description.

Indeed, perhaps with simple:
s/maps to a human description/maps to a report site/

we get some consistency?!

Quoted 22 lines
Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 38

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
Quoted 1 line

This should also be consistent with "report site" instead of situation.

Agree.
s/situation/report site/

Quoted 13 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 50

Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +12 -0
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
Quoted 2 lines

It'd be more intuitive for readers if section "When to use SIGID logging" is moved before how to pick one.

It makes sense to me.

Quoted 39 lines
Quoted 28 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +28 -0
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 88

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
Quoted 2 lines

This section also needs to be on the top. It can be missed if it is at the bottom of the document.

Also agree.

Quoted 24 lines
Quoted 12 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 109

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
Quoted 5 lines

Do we actually need resolution buckets defined here? RECOVER or UPDATE seem a bit vague since states like
 WEDGED/SURVIVABILITY have different ways to recover depending on context. Wouldn't detailed resolution steps in another
document be better than in logs?

Fair enough. I would prefer we have some recommendation for a consistent end to end story without depending on external docs and all. However I do agree that the vagueness in some cases here can defeat the purpose and mostly the conflict with the wedge.

Aravind was already complaining about these buckets. So, perhaps let's just remove. But also for consistency we need to change the rest of the text above and below:

Quoted 6 lines

- drop "maps to … a recommended first action …
- Delete the whole First-order action (resolution buckets) sectio
- Strip the [TAG] from all nine enum entries.
- Drop the dmesg note "the bucket … is not printed on the dmesg line.

Michal, what are your thoughts?

here is updated DOC section, please check if I get it right

/**
* DOC: Xe Error Signatures (SIGID)
*
* What SIGID stands for
* ---------------------
*
* SIGID is short for *Signature Identifier*. It is a small, stable integer
* that names one of *recognised fault site* -- nothing more. It is the
* primary handle used for triage and maps directly to specific report site. *
* Numbering
* ---------
*
* SIGIDs are a single flat list numbered sequentially within the assigned range,
* in the order the fault sites were introduced. Values are stable: once assigned
* they are only ever appended, never renumbered or reused. A retired fault site
* SIGID value is deprecated in place, never re-purposed.
*
* Why this exists
* ---------------
*
* Today the driver reports faults with ad-hoc ``xe_err()`` / ``xe_gt_err()``
* strings that have no stable shape. That is fine for a human reading dmesg,
* but it gives fleet tooling nothing durable to match on: the wording changes
* between releases, lines can be rate-limited or dropped under an error storm,
* and there is no consistent way to ask "which recognised fault just happened?" *
* A SIGID answers exactly that one question, identically across driver and
* firmware versions, and (eventually) across other Intel devices in a node. *
* What a SIGID is not
* -------------------
*
* SIGID deliberately does not encode the detailed reason or the outcome. Those
* are carried alongside it::
*

 *   SIGID    -> which recognised fault site is being reported
 *   severity -> how serious this instance is
 *   errno    -> the failing operation's error, if available, shown with %pe
 *   message  -> free-form human-readable context

*
* Severity is independent of the SIGID. The same SIGID can be reported at
* different severities depending on the instance and the recovery taken. *
* When to use SIGID logging
* -------------------------
*
* The xe_log_*() helpers are for these recognised fault sites only --
* important, operator-relevant faults and events. The driver's only job is to
* emit the right SIGID next to the usual human-readable text.

* They are not a replacement for ``xe_info()`` / ``xe_dbg()`` / tracing, nor
* for one-off diagnostics; using them for ordinary logging would dilute the
* fault stream. Not every ``xe_err()`` needs to become a SIGID report -- only
* those that correspond to a published fault sites.
*
* SIGID log output (dmesg vs. the machine record)
* -----------------------------------------------
*
* The dmesg line stays close to a normal xe error message so it remains
* readable for admins; the only stable, machine-matchable token on it is
* ``SIGID=<n>`` (``dmesg | grep SIGID=``).
*
* The full dmesg line is not an ABI: the surrounding text may change freely,
* and lines may be dropped. The durable record for tooling is the CPER record
* carrying the same SIGID (generation is a planned follow-up).
*
* How to pick a SIGID (the uniqueness rule)
* -----------------------------------------
*
* Pick per *report site*, not per incident. Each site emits the single most
* specific recognised SIGID *for that site* -- so the question is never
* "classify this whole failure", it is "what does this site detect?", which has
* one answer. A single underlying failure therefore legitimately produces a
* *chain* of reports from different layers, each with its own SIGID -- e.g. a
* GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
* path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
* aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
* follow a fault from origin to final effect; it is not a duplicate. *
* If a site does not match any defined SIGID, keep using the ordinary
* ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
* or over-broad classification is harder to retire than a missing one. When a
* new report site is genuinely worth triaging, add it to the list below. *
* Scope: software vs hardware emitted signatures
* ----------------------------------------------
*
* Some SIGID represents fault sites that the *driver itself* detects and
* reports from the software POV: probe abort, wedged, survivability, driver-
* detected firmware failures, engine TDR, memory faults and IO/bus faults.
* These are the only values the driver assigns on its own.
*
* Signatures that *originate* in firmware or hardware are a different thing:

Quoted 8 lines

* they are produced and identified by the firmware or the hardware itself
* (e.g. via their own records or error counters), and the driver merely logs
* them as they are given to us. They are deliberately enumerated separately. *
* The two driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
* %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
* observed a firmware problem, not a signature reported by the firmware. */

looks good to me. Indeed cleaner...

Quoted 81 lines
Quoted 40 lines

Thanks,
Rodrigo.

Quoted 34 lines
Quoted 22 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +21 -0
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 140

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100

why does the sigid start from 100?

there was an offline agreement with Yoni to start GPU SIGIDs from 100 with the limit up to 999 for any future GPU SIGIDs we may want to have

Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 144

Quoted 5 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +4 -0
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100
+#define INTEL_SIGID_GPU_XE_END			299

and for the XE we should use range 100..299

Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 147

Quoted 3 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +3 -0
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199

with the explicit split for SW/HW originated 'fault sites'

Quoted 24 lines
Quoted 24 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 158

Quoted 11 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +11 -0
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]

Pcode or sysctrl errors cannot be retried. Pcode init failures cause survivability mode.
RAS sysctrl errors require a secondary bus reset. We could have other firmwares in future with different
recovery.
That is why it would be better to drop resolution buckets in logs.

@aravind thoughts?

Thanks
Riana

#6 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

In reply to Michal Wajdeczko
Quoted 10 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it
gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Quoted 8 lines

Introduce a signature identifier (SIGID): a small, stable integer that
names one recognised Xe fault situation and serves as the primary handle
for triage. A SIGID maps, through published end-user documentation, to a
description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

I'm a little worried we're introducing some ABI with this that isn't really maintainable in the long term: we might decide to change the flow or change the way an error is reported or the situation that triggers this error from firmware or hardware might change for some reason. Does this lock us into a solution for all of this? I still need to go through the full patch series...

The dmesg entries are generally for human debuggability. I get the desire to make these easier to parse for an AI tool or generated script, but we also don't want to prevent debug related changes for error handling and reporting.

Thanks,
Stuart

Quoted 544 lines

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
    prepare to decorate dmesg with comp/loc (Michal)
---
 Documentation/gpu/xe/index.rst        |   1 + Documentation/gpu/xe/xe_sigid.rst     |  14 ++ drivers/gpu/drm/xe/Makefile           |   1 + drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183
++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++ drivers/gpu/drm/xe/xe_log.h           |  20 +++

 6 files changed, 354 insertions(+)

 create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +0 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe

is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid

Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
         xe_hw_fence.o \
         xe_irq.o \
         xe_late_bind_fw.o \
+       xe_log.o \
         xe_lrc.o \
         xe_mem_pool.o \
         xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +15 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small,

stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a
SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable:
once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +21 -0
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID                    0
+#define INTEL_SIGID_GPU_START                  100
+#define INTEL_SIGID_GPU_END                    999
+
+#define INTEL_SIGID_GPU_XE_START               100
+#define INTEL_SIGID_GPU_XE_END                 299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START      100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END                199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START      200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END                299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer

usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+       XE_SIGID_SW                     = INTEL_SIGID_GPU_XE_SOFTWARE_START,
+       XE_SIGID_PROBE                  = INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+       XE_SIGID_WEDGED                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+       XE_SIGID_SURVIVABILITY          = INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+       XE_SIGID_RUNTIME_FW             = INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+       XE_SIGID_DEVICE_FW              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+       XE_SIGID_GT_TDR                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+       XE_SIGID_MEM_FAULT              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+       XE_SIGID_IO_BUS                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +3 -0
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +9 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum

xe_sigid sigid,
+                         u32 component, u32 location, const void *data, size_t len,
+                         struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +17 -0
+{
+       /* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+       return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+       return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+       return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR

: "";

drivers/gpu/drm/xe/xe_log.c new file +18 -0
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+       switch (cper_sev) {
+       case CPER_SEV_FATAL:
+               return "FATAL ";
+       case CPER_SEV_RECOVERABLE:
+               return "";
+       case CPER_SEV_CORRECTED:
+               return "CORRECTED ";
+       default:
+               return "";
+       }
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)     "[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt,

args...) __LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)

drivers/gpu/drm/xe/xe_log.c new file +2 -0
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev,

struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +8 -0
+{
+       if (cper_sev == CPER_SEV_INFORMATIONAL)
+               pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+       else
+               pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev,

const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +14 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+       va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum

xe_sigid sigid,
+                          u32 component, u32 location, const void *data, size_t len,
+                          struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +8 -0
+{
+       const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+       const char *sev_prefix = log_sev_prefix(cper_sev);
+
+       /* TODO: add component/location details */
+
+       if (IS_ERR(data))
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe)

%s%pV",
+                                sigid, sev_prefix, data, hwe_prefix, vaf);
+       else if (data && len)
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+                                sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+       else
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV", +                                sigid, sev_prefix, hwe_prefix, vaf);

drivers/gpu/drm/xe/xe_log.c new file +6 -0
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE,

...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine- matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +9 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_emit_dmesg(pdev, cper_sev, sigid, component, location,

data, len, &vaf);
+       log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);

drivers/gpu/drm/xe/xe_log.c new file +3 -0
+
+       va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +16 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid

sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...);

drivers/gpu/drm/xe/xe_log.h new file +2 -0
+
+#endif
#7 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 33 lines · Stuart
Quoted 14 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but
it
gives fleet tooling nothing durable to match on: the wording changes
between releases, lines can be rate-limited or dropped under an error
storm, and there is no consistent way to ask "which recognised fault
just happened?".

Quoted 9 lines

Introduce a signature identifier (SIGID): a small, stable integer that
names one recognised Xe fault situation and serves as the primary handle
for triage. A SIGID maps, through published end-user documentation, to a
description and a recommended action; the driver only has to emit the
right SIGID next to the usual human-readable text.

I'm a little worried we're introducing some ABI with this that isn't really maintainable in the long term: we might decide to change the flow or change the way an error is reported or the situation that triggers this error from firmware or hardware might change for some reason. Does this lock us into a solution for all of this? I still need
to go through the full patch series...

Quoted 4 lines

The dmesg entries are generally for human debuggability. I get the desire to make these easier to parse for an AI tool or generated script, but we also don't want to prevent debug related changes for error handling and reporting.

Also, should we be implementing something like this more generically across DRM or even outside of DRM and then having device-specific error conditions within a particular range?

Thanks,
Stuart

Quoted 582 lines

Thanks,
Stuart

Quoted 577 lines

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
    prepare to decorate dmesg with comp/loc (Michal)
---
 Documentation/gpu/xe/index.rst        |   1 + Documentation/gpu/xe/xe_sigid.rst     |  14 ++ drivers/gpu/drm/xe/Makefile           |   1 + drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183
++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++ drivers/gpu/drm/xe/xe_log.h           |  20 +++

 6 files changed, 354 insertions(+)

 create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +0 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for

drm/xe
is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid

Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
         xe_hw_fence.o \
         xe_irq.o \
         xe_late_bind_fw.o \
+       xe_log.o \
         xe_lrc.o \
         xe_mem_pool.o \
         xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +15 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small,

stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to
the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in
a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question
is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID
-- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by
the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path,
and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a
SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus
faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware
itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the
driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable:
once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with
a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may
refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations
only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on
it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI:
the
surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is
a planned
+ * follow-up).
+ */

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +21 -0
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID                    0
+#define INTEL_SIGID_GPU_START                  100
+#define INTEL_SIGID_GPU_END                    999
+
+#define INTEL_SIGID_GPU_XE_START               100
+#define INTEL_SIGID_GPU_XE_END                 299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START      100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END                199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START      200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END                299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer

usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values
are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see
the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here;
they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+       XE_SIGID_SW                     = INTEL_SIGID_GPU_XE_SOFTWARE_START,
+       XE_SIGID_PROBE                  = INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+       XE_SIGID_WEDGED                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+       XE_SIGID_SURVIVABILITY          = INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+       XE_SIGID_RUNTIME_FW             = INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+       XE_SIGID_DEVICE_FW              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+       XE_SIGID_GT_TDR                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+       XE_SIGID_MEM_FAULT              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+       XE_SIGID_IO_BUS                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +3 -0
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +9 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum

xe_sigid sigid,
+                         u32 component, u32 location, const void *data, size_t len,
+                         struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +15 -0
+{
+       /* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+       return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+       return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid

sigid)
+{
+       return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR
: "";

drivers/gpu/drm/xe/xe_log.c new file +17 -0
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+       switch (cper_sev) {
+       case CPER_SEV_FATAL:
+               return "FATAL ";
+       case CPER_SEV_RECOVERABLE:
+               return "";
+       case CPER_SEV_CORRECTED:
+               return "CORRECTED ";
+       default:
+               return "";
+       }
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)     "[drm] " fmt,

##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...) __LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)

drivers/gpu/drm/xe/xe_log.c new file +2 -0
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev,

struct va_format *vaf)
+{
+       if (cper_sev == CPER_SEV_INFORMATIONAL)
+               pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf)); +       else
+               pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));

drivers/gpu/drm/xe/xe_log.c new file +3 -0
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev,

const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +14 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+       va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev,

enum
xe_sigid sigid,
+                          u32 component, u32 location, const void *data, size_t len,
+                          struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +8 -0
+{
+       const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+       const char *sev_prefix = log_sev_prefix(cper_sev);
+
+       /* TODO: add component/location details */
+
+       if (IS_ERR(data))
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe)

%s%pV",
+                                sigid, sev_prefix, data, hwe_prefix,
vaf);
+       else if (data && len)
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN)
%s%pV",
+                                sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+       else
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+                                sigid, sev_prefix, hwe_prefix, vaf);

drivers/gpu/drm/xe/xe_log.c new file +6 -0
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE,

...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if
not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine- matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a
packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +9 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_emit_dmesg(pdev, cper_sev, sigid, component, location,

data, len, &vaf);
+       log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);

drivers/gpu/drm/xe/xe_log.c new file +3 -0
+
+       va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +16 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid

sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...);

drivers/gpu/drm/xe/xe_log.h new file +2 -0
+
+#endif
maintainer
#8 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 34 lines · Stuart
Quoted 33 lines · Stuart
Quoted 14 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but
it
gives fleet tooling nothing durable to match on: the wording changes
between releases, lines can be rate-limited or dropped under an error
storm, and there is no consistent way to ask "which recognised fault
just happened?".

Quoted 9 lines

Introduce a signature identifier (SIGID): a small, stable integer that
names one recognised Xe fault situation and serves as the primary handle
for triage. A SIGID maps, through published end-user documentation, to a
description and a recommended action; the driver only has to emit the
right SIGID next to the usual human-readable text.

I'm a little worried we're introducing some ABI with this that isn't really maintainable in the long term: we might decide to change the flow or change the way an error is reported or the situation that triggers this error from firmware or hardware might change for some reason. Does this lock us into a solution for all of this? I still need
to go through the full patch series...

Quoted 8 lines
Quoted 4 lines

The dmesg entries are generally for human debuggability. I get the desire to make these easier to parse for an AI tool or generated script, but we also don't want to prevent debug related changes for error handling and reporting.

Also, should we be implementing something like this more generically across DRM or even outside of DRM and then having device-specific error conditions within a particular range?

I doubt that this will be useful outside of our Intel GPU. Also, other subsystem and drivers have different needs for this problem and no good broad idea.

Take a look to the cases Jani pointed out:
https://lore.kernel.org/intel-xe/[email protected]/

Quoted 587 lines

Thanks,
Stuart

Quoted 582 lines

Thanks,
Stuart

Quoted 577 lines

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
    prepare to decorate dmesg with comp/loc (Michal)
---
 Documentation/gpu/xe/index.rst        |   1 + Documentation/gpu/xe/xe_sigid.rst     |  14 ++ drivers/gpu/drm/xe/Makefile           |   1 + drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183
++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++ drivers/gpu/drm/xe/xe_log.h           |  20 +++

 6 files changed, 354 insertions(+)

 create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +0 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for

drm/xe
is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid

Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
         xe_hw_fence.o \
         xe_irq.o \
         xe_late_bind_fw.o \
+       xe_log.o \
         xe_lrc.o \
         xe_mem_pool.o \
         xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +15 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small,

stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to
the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in
a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question
is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID
-- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by
the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path,
and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a
SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus
faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware
itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the
driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable:
once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with
a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may
refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations
only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on
it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI:
the
surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is
a planned
+ * follow-up).
+ */

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +21 -0
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID                    0
+#define INTEL_SIGID_GPU_START                  100
+#define INTEL_SIGID_GPU_END                    999
+
+#define INTEL_SIGID_GPU_XE_START               100
+#define INTEL_SIGID_GPU_XE_END                 299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START      100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END                199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START      200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END                299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer

usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values
are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see
the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here;
they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+       XE_SIGID_SW                     = INTEL_SIGID_GPU_XE_SOFTWARE_START,
+       XE_SIGID_PROBE                  = INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+       XE_SIGID_WEDGED                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+       XE_SIGID_SURVIVABILITY          = INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+       XE_SIGID_RUNTIME_FW             = INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+       XE_SIGID_DEVICE_FW              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+       XE_SIGID_GT_TDR                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+       XE_SIGID_MEM_FAULT              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+       XE_SIGID_IO_BUS                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +3 -0
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +9 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum

xe_sigid sigid,
+                         u32 component, u32 location, const void *data, size_t len,
+                         struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +15 -0
+{
+       /* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+       return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+       return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid

sigid)
+{
+       return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR
: "";

drivers/gpu/drm/xe/xe_log.c new file +17 -0
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+       switch (cper_sev) {
+       case CPER_SEV_FATAL:
+               return "FATAL ";
+       case CPER_SEV_RECOVERABLE:
+               return "";
+       case CPER_SEV_CORRECTED:
+               return "CORRECTED ";
+       default:
+               return "";
+       }
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)     "[drm] " fmt,

##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...) __LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)

drivers/gpu/drm/xe/xe_log.c new file +2 -0
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev,

struct va_format *vaf)
+{
+       if (cper_sev == CPER_SEV_INFORMATIONAL)
+               pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf)); +       else
+               pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));

drivers/gpu/drm/xe/xe_log.c new file +3 -0
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev,

const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +14 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+       va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev,

enum
xe_sigid sigid,
+                          u32 component, u32 location, const void *data, size_t len,
+                          struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +8 -0
+{
+       const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+       const char *sev_prefix = log_sev_prefix(cper_sev);
+
+       /* TODO: add component/location details */
+
+       if (IS_ERR(data))
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe)

%s%pV",
+                                sigid, sev_prefix, data, hwe_prefix,
vaf);
+       else if (data && len)
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN)
%s%pV",
+                                sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+       else
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+                                sigid, sev_prefix, hwe_prefix, vaf);

drivers/gpu/drm/xe/xe_log.c new file +6 -0
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE,

...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if
not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine- matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a
packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +9 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_emit_dmesg(pdev, cper_sev, sigid, component, location,

data, len, &vaf);
+       log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);

drivers/gpu/drm/xe/xe_log.c new file +3 -0
+
+       va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +16 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid

sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...);

drivers/gpu/drm/xe/xe_log.h new file +2 -0
+
+#endif
maintainer
#9 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

In reply to Summers, Stuart
Quoted 20 lines · Stuart
Quoted 10 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it
gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Quoted 8 lines

Introduce a signature identifier (SIGID): a small, stable integer that
names one recognised Xe fault situation and serves as the primary handle
for triage. A SIGID maps, through published end-user documentation, to a
description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

Quoted 1 line

I'm a little worried

I understand your feeling. We've been all through that:

https://lore.kernel.org/intel-xe/[email protected]/

Quoted 2 lines

we're introducing some ABI with this that isn't
really maintainable in the long term:

I understand the fear and indeed the first proposals I got was unmaintainable. My first record of pushing back on having something like this was November last year.

But I respectfully disagree here. This latest version is imho organized and concise.

Quoted 4 lines

we might decide to change the
flow or change the way an error is reported or the situation that triggers this error from firmware or hardware might change for some reason.

You are right, dmesg is not ABI and it will never be. these logs are aimed for developers and developers are free to change them as needed. This was a big counter-requirement I gave to the original idea.

We are not moving all the logs to this format we are not promising dmesg stability.

The numbering stability however needs to be somewhat stable for the CPER log in tracefs, that's the ABI. But then that meaning shouldn't change if the code has to change. A new number should be needed if the component/location/severity or recommended recovery needs to be different.

But like I told Raag as well, no developer needs to invent any number, if they don't know just use regular log messages. We are not going to move all the logs towards this thing. Also, the location of the issue is what triggers the ID... it is very simple by nature. And we need to keep it simple.

Quoted 2 lines

Does this lock us into a solution for all of this? I still need to go through the full patch series...

Yes, please take a look to the series. All reviews are welcomed.

Quoted 5 lines

The dmesg entries are generally for human debuggability. I get the desire to make these easier to parse for an AI tool or generated script, but we also don't want to prevent debug related changes for error handling and reporting.

We are not promising this. The stable ABI is only the CPER on tracefs.

We need to always keep this in mind as stated in
Documentation/core-api/printk-index.rst:

"""
The kernel messages are evolving together with the code. As a result, particular kernel messages are not KABI and never will be! """

Thanks,
Rodrigo.

Quoted 549 lines

Thanks,
Stuart

Quoted 544 lines

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
    prepare to decorate dmesg with comp/loc (Michal)
---
 Documentation/gpu/xe/index.rst        |   1 + Documentation/gpu/xe/xe_sigid.rst     |  14 ++ drivers/gpu/drm/xe/Makefile           |   1 + drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183
++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++ drivers/gpu/drm/xe/xe_log.h           |  20 +++

 6 files changed, 354 insertions(+)

 create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +0 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe

is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid

Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
         xe_hw_fence.o \
         xe_irq.o \
         xe_late_bind_fw.o \
+       xe_log.o \
         xe_lrc.o \
         xe_mem_pool.o \
         xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +15 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small,

stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a
SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable:
once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +21 -0
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID                    0
+#define INTEL_SIGID_GPU_START                  100
+#define INTEL_SIGID_GPU_END                    999
+
+#define INTEL_SIGID_GPU_XE_START               100
+#define INTEL_SIGID_GPU_XE_END                 299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START      100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END                199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START      200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END                299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer

usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+       XE_SIGID_SW                     = INTEL_SIGID_GPU_XE_SOFTWARE_START,
+       XE_SIGID_PROBE                  = INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+       XE_SIGID_WEDGED                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+       XE_SIGID_SURVIVABILITY          = INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+       XE_SIGID_RUNTIME_FW             = INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+       XE_SIGID_DEVICE_FW              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+       XE_SIGID_GT_TDR                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+       XE_SIGID_MEM_FAULT              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+       XE_SIGID_IO_BUS                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +3 -0
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +9 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum

xe_sigid sigid,
+                         u32 component, u32 location, const void *data, size_t len,
+                         struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +17 -0
+{
+       /* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+       return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+       return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+       return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR

: "";

drivers/gpu/drm/xe/xe_log.c new file +18 -0
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+       switch (cper_sev) {
+       case CPER_SEV_FATAL:
+               return "FATAL ";
+       case CPER_SEV_RECOVERABLE:
+               return "";
+       case CPER_SEV_CORRECTED:
+               return "CORRECTED ";
+       default:
+               return "";
+       }
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)     "[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt,

args...) __LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)

drivers/gpu/drm/xe/xe_log.c new file +2 -0
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev,

struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +8 -0
+{
+       if (cper_sev == CPER_SEV_INFORMATIONAL)
+               pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+       else
+               pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev,

const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +14 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+       va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum

xe_sigid sigid,
+                          u32 component, u32 location, const void *data, size_t len,
+                          struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +8 -0
+{
+       const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+       const char *sev_prefix = log_sev_prefix(cper_sev);
+
+       /* TODO: add component/location details */
+
+       if (IS_ERR(data))
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe)

%s%pV",
+                                sigid, sev_prefix, data, hwe_prefix, vaf);
+       else if (data && len)
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+                                sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+       else
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV", +                                sigid, sev_prefix, hwe_prefix, vaf);

drivers/gpu/drm/xe/xe_log.c new file +6 -0
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE,

...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine- matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +9 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_emit_dmesg(pdev, cper_sev, sigid, component, location,

data, len, &vaf);
+       log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);

drivers/gpu/drm/xe/xe_log.c new file +3 -0
+
+       va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +16 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid

sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...);

drivers/gpu/drm/xe/xe_log.h new file +2 -0
+
+#endif
#10 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 407 lines · Rodrigo Vivi
Quoted 26 lines · Stuart
Quoted 14 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but
it
gives fleet tooling nothing durable to match on: the wording changes
between releases, lines can be rate-limited or dropped under an error
storm, and there is no consistent way to ask "which recognised fault
just happened?".

Quoted 10 lines

Introduce a signature identifier (SIGID): a small, stable integer that
names one recognised Xe fault situation and serves as the primary handle
for triage. A SIGID maps, through published end-user documentation,
to a
description and a recommended action; the driver only has to emit the
right SIGID next to the usual human-readable text.

Quoted 1 line

I'm a little worried

I understand your feeling. We've been all through that:

https://lore.kernel.org/intel-xe/[email protected]/

Quoted 2 lines

we're introducing some ABI with this that isn't
really maintainable in the long term:

I understand the fear and indeed the first proposals I got was unmaintainable. My first record of pushing back on having something like this was November last year.

But I respectfully disagree here. This latest version is imho organized and concise.

Quoted 4 lines

we might decide to change the
flow or change the way an error is reported or the situation that triggers this error from firmware or hardware might change for some reason.

You are right, dmesg is not ABI and it will never be. these logs are aimed for developers and developers are free to change them as needed. This was a big counter-requirement I gave to the original idea.

We are not moving all the logs to this format we are not promising dmesg stability.

The numbering stability however needs to be somewhat stable for the CPER log in tracefs, that's the ABI. But then that meaning shouldn't change if the code has to change. A new number should be needed if the component/location/severity or recommended recovery needs to be different.

But like I told Raag as well, no developer needs to invent any number, if they don't know just use regular log messages. We are not going to move all the logs towards this thing. Also, the location of the issue is what triggers the ID... it is very simple by nature. And we need to keep it simple.

Quoted 2 lines

Does this lock us into a solution for all of this? I still need to go through the full patch series...

Yes, please take a look to the series. All reviews are welcomed.

Quoted 5 lines

The dmesg entries are generally for human debuggability. I get the desire to make these easier to parse for an AI tool or generated script, but we also don't want to prevent debug related changes for error handling and reporting.

We are not promising this. The stable ABI is only the CPER on tracefs.

We need to always keep this in mind as stated in
Documentation/core-api/printk-index.rst:

"""
The kernel messages are evolving together with the code. As a result, particular kernel messages are not KABI and never will be! """

Thanks,
Rodrigo.

Quoted 314 lines

Thanks,
Stuart

Quoted 310 lines

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
    prepare to decorate dmesg with comp/loc (Michal)
---
 Documentation/gpu/xe/index.rst        |   1 + Documentation/gpu/xe/xe_sigid.rst     |  14 ++ drivers/gpu/drm/xe/Makefile           |   1 + drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183
++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++ drivers/gpu/drm/xe/xe_log.h           |  20 +++

 6 files changed, 354 insertions(+)

 create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +0 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for

drm/xe
is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid

Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
         xe_hw_fence.o \
         xe_irq.o \
         xe_late_bind_fw.o \
+       xe_log.o \
         xe_lrc.o \
         xe_mem_pool.o \
         xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +15 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a

small,
stable integer
+ * that names one *recognised Xe fault situation* -- nothing more.
It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to
the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an
error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in
a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be
reported at
+ * different severities depending on the instance and the recovery
taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses
it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question
is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately
produces a
+ * *chain* of reports from different layers, each with its own SIGID
-- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by
the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path,
and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the
ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a
SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing
one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability,
driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus
faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware
itself
+ * (e.g. via their own records or error counters), and the driver
merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error
would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the
driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the
assigned range,
+ * in the order the situations were introduced. Values are stable:
once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re- purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with
a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may
refine it,
+ * but the in-tree value always stands on its own. Every new SIGID
must pick a
+ * bucket, which forces the question "what should someone do about
this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus
reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in
the enum
+ * kernel-doc below and is not printed on the (deliberately lean)
dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations
only --
+ * important, operator-relevant faults and events. They are not a
replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream.
Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that
correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on
it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

the
surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is
a planned
+ * follow-up).

Ok I realize I'm coming late to the party here - I just haven't had the time to review this in detail. I really don't like having this ABI- adjacent implementation. It feels like we will be on the hook for maintaining things in the future that will limit our ability to implement changes and debug. I get the notes that Rodrigo has above, but this just feels like the wrong approach to me.

That said, I don't want to block the work here. I know we have some users looking for this for their own debug.

You have "dmesg is not ABI" here which is a start. What happens if we decide to drop one of these messages? Is it only the ID itself that we want to be stable and monotonically incrementing? Or is the message itself supposed to be stable? If we drop all references to a particular ID is that ok? What if we have 10s of IDs or more that have no use in the future and we move on to the next section? We don't care about cleanup of this kind of thing? Or the line above about "dmesg is not ABI" means we can really do whatever we want with it?

Thanks,
Stuart

Quoted 299 lines
Quoted 299 lines
Quoted 298 lines

+ */

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +18 -0
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID                    0
+#define INTEL_SIGID_GPU_START                  100
+#define INTEL_SIGID_GPU_END                    999
+
+#define INTEL_SIGID_GPU_XE_START               100
+#define INTEL_SIGID_GPU_XE_END                 299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START      100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END                199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START      200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END                299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers

(SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure,
GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery
(reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values
are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see
the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here;
they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+       XE_SIGID_SW                     = INTEL_SIGID_GPU_XE_SOFTWARE_START,
+       XE_SIGID_PROBE                  = INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+       XE_SIGID_WEDGED                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+       XE_SIGID_SURVIVABILITY          = INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+       XE_SIGID_RUNTIME_FW             = INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+       XE_SIGID_DEVICE_FW              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+       XE_SIGID_GT_TDR                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+       XE_SIGID_MEM_FAULT              = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+       XE_SIGID_IO_BUS                 = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +3 -0
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +9 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev,

enum
xe_sigid sigid,
+                         u32 component, u32 location, const void *data, size_t len,
+                         struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +15 -0
+{
+       /* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+       return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+       return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid

sigid)
+{
+       return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR
: "";

drivers/gpu/drm/xe/xe_log.c new file +17 -0
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+       switch (cper_sev) {
+       case CPER_SEV_FATAL:
+               return "FATAL ";
+       case CPER_SEV_RECOVERABLE:
+               return "";
+       case CPER_SEV_CORRECTED:
+               return "CORRECTED ";
+       default:
+               return "";
+       }
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)     "[drm] " fmt,

##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...) __LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)

drivers/gpu/drm/xe/xe_log.c new file +2 -0
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int

cper_sev,
struct va_format *vaf)
+{
+       if (cper_sev == CPER_SEV_INFORMATIONAL)
+               pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf)); +       else
+               pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));

drivers/gpu/drm/xe/xe_log.c new file +3 -0
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev,

const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +14 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+       va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev,

enum
xe_sigid sigid,
+                          u32 component, u32 location, const void
*data, size_t len,
+                          struct va_format *vaf)

drivers/gpu/drm/xe/xe_log.c new file +8 -0
+{
+       const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+       const char *sev_prefix = log_sev_prefix(cper_sev);
+
+       /* TODO: add component/location details */
+
+       if (IS_ERR(data))
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u

%s(%pe)
%s%pV",
+                                sigid, sev_prefix, data, hwe_prefix,
vaf);
+       else if (data && len)
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN)
%s%pV",
+                                sigid, sev_prefix, (int)len, data,
hwe_prefix, vaf);
+       else
+               log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+                                sigid, sev_prefix, hwe_prefix, vaf);

drivers/gpu/drm/xe/xe_log.c new file +6 -0
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL,

CPER_SEV_RECOVERABLE,
...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if
not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine- matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a
packed hex
+ * dump of the @data binary blob. The dmesg line will also include
printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (- EPROTO)
Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability
mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid
sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...)

drivers/gpu/drm/xe/xe_log.c new file +9 -0
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       log_emit_dmesg(pdev, cper_sev, sigid, component,

location,
data, len, &vaf);
+       log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);

drivers/gpu/drm/xe/xe_log.c new file +3 -0
+
+       va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +16 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum

xe_sigid
sigid,
+                u32 component, u32 location, const void *data, size_t len,
+                const char *fmt, ...);

drivers/gpu/drm/xe/xe_log.h new file +2 -0
+
+#endif
#11 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 410 lines · Stuart
Quoted 409 lines · Rodrigo Vivi
Quoted 26 lines · Stuart
Quoted 14 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but
it
gives fleet tooling nothing durable to match on: the wording changes
between releases, lines can be rate-limited or dropped under an error
storm, and there is no consistent way to ask "which recognised fault
just happened?".

Quoted 10 lines

Introduce a signature identifier (SIGID): a small, stable integer that
names one recognised Xe fault situation and serves as the primary handle
for triage. A SIGID maps, through published end-user documentation,
to a
description and a recommended action; the driver only has to emit the
right SIGID next to the usual human-readable text.

Quoted 1 line

I'm a little worried

I understand your feeling. We've been all through that:

https://lore.kernel.org/intel-xe/[email protected]/

Quoted 2 lines

we're introducing some ABI with this that isn't
really maintainable in the long term:

I understand the fear and indeed the first proposals I got was unmaintainable. My first record of pushing back on having something like this was November last year.

But I respectfully disagree here. This latest version is imho organized and concise.

Quoted 4 lines

we might decide to change the
flow or change the way an error is reported or the situation that triggers this error from firmware or hardware might change for some reason.

You are right, dmesg is not ABI and it will never be. these logs are aimed for developers and developers are free to change them as needed. This was a big counter-requirement I gave to the original idea.

We are not moving all the logs to this format we are not promising dmesg stability.

The numbering stability however needs to be somewhat stable for the CPER log in tracefs, that's the ABI. But then that meaning shouldn't change if the code has to change. A new number should be needed if the component/location/severity or recommended recovery needs to be different.

But like I told Raag as well, no developer needs to invent any number, if they don't know just use regular log messages. We are not going to move all the logs towards this thing. Also, the location of the issue is what triggers the ID... it is very simple by nature. And we need to keep it simple.

Quoted 2 lines

Does this lock us into a solution for all of this? I still need to go through the full patch series...

Yes, please take a look to the series. All reviews are welcomed.

Quoted 5 lines

The dmesg entries are generally for human debuggability. I get the desire to make these easier to parse for an AI tool or generated script, but we also don't want to prevent debug related changes for error handling and reporting.

We are not promising this. The stable ABI is only the CPER on tracefs.

We need to always keep this in mind as stated in
Documentation/core-api/printk-index.rst:

"""
The kernel messages are evolving together with the code. As a result, particular kernel messages are not KABI and never will be! """

Thanks,
Rodrigo.

Quoted 316 lines

Thanks,
Stuart

Quoted 312 lines

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
    prepare to decorate dmesg with comp/loc (Michal)
---
 Documentation/gpu/xe/index.rst        |   1 + Documentation/gpu/xe/xe_sigid.rst     |  14 ++ drivers/gpu/drm/xe/Makefile           |   1 + drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183
++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++ drivers/gpu/drm/xe/xe_log.h           |  20 +++

 6 files changed, 354 insertions(+)

 create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +0 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for

drm/xe
is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid

Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
         xe_hw_fence.o \
         xe_irq.o \
         xe_late_bind_fw.o \
+       xe_log.o \
         xe_lrc.o \
         xe_mem_pool.o \
         xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +15 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a

small,
stable integer
+ * that names one *recognised Xe fault situation* -- nothing more.
It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to
the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an
error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in
a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be
reported at
+ * different severities depending on the instance and the recovery
taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses
it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question
is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately
produces a
+ * *chain* of reports from different layers, each with its own SIGID
-- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by
the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path,
and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the
ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a
SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing
one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability,
driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus
faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware
itself
+ * (e.g. via their own records or error counters), and the driver
merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error
would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the
driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the
assigned range,
+ * in the order the situations were introduced. Values are stable:
once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re- purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with
a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may
refine it,
+ * but the in-tree value always stands on its own. Every new SIGID
must pick a
+ * bucket, which forces the question "what should someone do about
this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus
reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in
the enum
+ * kernel-doc below and is not printed on the (deliberately lean)
dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations
only --
+ * important, operator-relevant faults and events. They are not a
replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream.
Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that
correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on
it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI:
the
surrounding

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is
a planned
+ * follow-up).

Ok I realize I'm coming late to the party here - I just haven't had the

(no worries, I was late too)

Quoted 11 lines

time to review this in detail. I really don't like having this ABI- adjacent implementation. It feels like we will be on the hook for maintaining things in the future that will limit our ability to implement changes and debug. I get the notes that Rodrigo has above, but this just feels like the wrong approach to me.

That said, I don't want to block the work here. I know we have some users looking for this for their own debug.

You have "dmesg is not ABI" here which is a start. What happens if we decide to drop one of these messages?

we don't require any use of xe_log() to be permanent (see below) it can changed or dropped or replaced back with xe_err() any time.

Quoted 2 lines

Is it only the ID itself that we
want to be stable and monotonically incrementing?

correct, just use of the same SIGID in the log will always mean the same

Quoted 2 lines

Or is the message
itself supposed to be stable?

message can be changed any time, like in regular xe_err()

it is just an additional hint for debug (together with SEVERITY and reported errno)

Quoted 2 lines

If we drop all references to a particular
ID is that ok?

yes, if the ID is no longer applicable
and this was already stated in DOC

Quoted 3 lines

What if we have 10s of IDs or more that have no use in the future and we move on to the next section? We don't care about cleanup of this kind of thing?

legacy SIGIDs stays forever, there will be no ID value reuse (also see DOC) but due to the way they are defined, it is unlikely that we will drop them

Quoted 2 lines

Or the line above about "dmesg is not
ABI" means we can really do whatever we want with it?

I assume the only new requirement for us would be that we should not drop all xe_logs for any SIGID which is still applicable (and was not replaced with other SIGID)

Quoted 4 lines

Thanks,
Stuart

#12 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 527 lines · Michal Wajdeczko
Quoted 468 lines · Stuart
Quoted 467 lines · Rodrigo Vivi
Quoted 33 lines · Stuart
Quoted 18 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err()
strings that have no stable shape. That is readable for a human,
but
it
gives fleet tooling nothing durable to match on: the wording changes
between releases, lines can be rate-limited or dropped under an
error
storm, and there is no consistent way to ask "which recognised
fault
just happened?".

Quoted 13 lines

Introduce a signature identifier (SIGID): a small, stable integer
that
names one recognised Xe fault situation and serves as the primary
handle
for triage. A SIGID maps, through published end-user documentation,
to a
description and a recommended action; the driver only has to emit
the
right SIGID next to the usual human-readable text.

Quoted 1 line

I'm a little worried

I understand your feeling. We've been all through that:

https://lore.kernel.org/intel-xe/[email protected]/

Quoted 2 lines

we're introducing some ABI with this that isn't
really maintainable in the long term:

I understand the fear and indeed the first proposals I got was unmaintainable. My first record of pushing back on having something
like this was November last year.

But I respectfully disagree here. This latest version is imho organized and concise.

Quoted 6 lines

we might decide to change the
flow or change the way an error is reported or the situation that
triggers this error from firmware or hardware might change for some
reason.

You are right, dmesg is not ABI and it will never be. these logs are aimed for developers and developers are free to change them as
needed. This was a big counter-requirement I gave to the original idea.

We are not moving all the logs to this format we are not promising
dmesg stability.

The numbering stability however needs to be somewhat stable for the CPER log in tracefs, that's the ABI. But then that meaning shouldn't change if the code has to change. A new number should be needed if the component/location/severity or recommended recovery needs to be different.

But like I told Raag as well, no developer needs to invent any number, if they don't know just use regular log messages. We are not going to move all the logs towards this thing. Also, the location of the issue is what triggers the ID... it is very simple by nature. And we need to keep it simple.

Quoted 2 lines

Does this lock us into a solution for all of this? I still need to go through the full patch series...

Yes, please take a look to the series. All reviews are welcomed.

Quoted 8 lines

The dmesg entries are generally for human debuggability. I get the
desire to make these easier to parse for an AI tool or generated
script, but we also don't want to prevent debug related changes for
error handling and reporting.

We are not promising this. The stable ABI is only the CPER on tracefs.

We need to always keep this in mind as stated in
Documentation/core-api/printk-index.rst:

"""
The kernel messages are evolving together with the code. As a result,
particular kernel messages are not KABI and never will be! """

Thanks,
Rodrigo.

Quoted 358 lines

Thanks,
Stuart

Quoted 354 lines

Signed-off-by: Mallesh Koujalagi
<[email protected]>

Assisted-by Copilot:Opus-4.8
Co-developed-by Michal Wajdeczko

<[email protected]>

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal) prepare to decorate dmesg with comp/loc (Michal)
---
 Documentation/gpu/xe/index.rst        |   1 + Documentation/gpu/xe/xe_sigid.rst     |  14 ++ drivers/gpu/drm/xe/Makefile           |   1 + drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183
++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135
+++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.h           |  20 +++

 6 files changed, 354 insertions(+)

 create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +0 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for

drm/xe
is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid

Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
         xe_hw_fence.o \
         xe_irq.o \
         xe_late_bind_fw.o \
+       xe_log.o \
         xe_lrc.o \
         xe_mem_pool.o \
         xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +15 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a

small,
stable integer
+ * that names one *recognised Xe fault situation* -- nothing more.
It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer,
cross-product
+ * detail. The driver's only job is to emit the right SIGID next
to
the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` /
``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human
reading dmesg,
+ * but it gives fleet tooling nothing durable to match on:
the
wording changes
+ * between releases, lines can be rate-limited or dropped under
an
error storm,
+ * and there is no consistent way to ask "which recognised fault
just happened?"
+ * A SIGID answers exactly that one question, identically across
driver and
+ * firmware versions, and (eventually) across other Intel devices in
a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried
alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not
fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can
be
reported at
+ * different severities depending on the instance and the recovery
taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses
it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the
single most
+ * specific recognised situation *for that site* -- so the question
is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately
produces a
+ * *chain* of reports from different layers, each with its own
SIGID
-- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW
by
the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset
path,
and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain
lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using
the
ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a
SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing
one. When a
+ * new situation is genuinely worth triaging, add it to the list
below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver
itself* detects
+ * and reports from software: probe abort, wedged, survivability,
driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus
faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware
itself
+ * (e.g. via their own records or error counters), and the driver
merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error
would only
+ * duplicate an identifier the reporting layer already owns. The
two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that
*the
driver*
+ * observed a firmware problem, not a signature reported by the
firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within
the
assigned range,
+ * in the order the situations were introduced. Values are stable:
once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re- purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged
with
a coarse
+ * *resolution bucket*: the first thing an operator should do on
seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation
may
refine it,
+ * but the in-tree value always stands on its own. Every new SIGID
must pick a
+ * bucket, which forces the question "what should someone do about
this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind,
bus
reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID
in
the enum
+ * kernel-doc below and is not printed on the (deliberately lean)
dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations
only --
+ * important, operator-relevant faults and events. They are not
a
replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one- off
diagnostics;
+ * using them for ordinary logging would dilute the fault stream.
Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that
correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it
remains
+ * readable for admins; the only stable, machine-matchable token
on
it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI:
the
surrounding
+ * text may change freely, and lines may be dropped. The durable

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

record for
+ * tooling is the CPER record carrying the same SIGID (generation is
a planned
+ * follow-up).

Ok I realize I'm coming late to the party here - I just haven't had the

(no worries, I was late too)

Quoted 7 lines

time to review this in detail. I really don't like having this ABI- adjacent implementation. It feels like we will be on the hook for maintaining things in the future that will limit our ability to implement changes and debug. I get the notes that Rodrigo has above,
but this just feels like the wrong approach to me.

Quoted 6 lines

That said, I don't want to block the work here. I know we have some users looking for this for their own debug.

You have "dmesg is not ABI" here which is a start. What happens if we
decide to drop one of these messages?

we don't require any use of xe_log() to be permanent (see below) it can changed or dropped or replaced back with xe_err() any time.

Quoted 2 lines

Is it only the ID itself that we
want to be stable and monotonically incrementing?

correct, just use of the same SIGID in the log will always mean the same

Quoted 2 lines

Or is the message
itself supposed to be stable?

message can be changed any time, like in regular xe_err()

it is just an additional hint for debug (together with SEVERITY and reported errno)

Quoted 2 lines

If we drop all references to a particular
ID is that ok?

yes, if the ID is no longer applicable
and this was already stated in DOC

Quoted 3 lines

What if we have 10s of IDs or more that have no use in the future and we move on to the next section? We don't care about cleanup of this kind of thing?

legacy SIGIDs stays forever, there will be no ID value reuse (also see DOC) but due to the way they are defined, it is unlikely that we will drop them

Quoted 6 lines
Quoted 2 lines

Or the line above about "dmesg is not
ABI" means we can really do whatever we want with it?

I assume the only new requirement for us would be that we should not drop all xe_logs for any SIGID which is still applicable (and was not replaced with other SIGID)

It would be nice to make that explicit in the documentation.

I'm still pretty worried about the contractual aspect of this with users who start relying on this. But if we take that out, from a purely kernel debug usage aspect, I do like having this to help categorize issues and flows. It seems like we should be able to do something with this in printk directly (or the drm_* variants) rather than having something specific to the GPU here. But as long as we don't make it too strict, hopefully we can expand if there's interest there.

Let me go through in detail later today and get back.

Thanks,
Stuart

Quoted 5 lines
Quoted 5 lines

Thanks,
Stuart

maintainer
#13 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 528 lines · Stuart
Quoted 527 lines · Michal Wajdeczko
Quoted 468 lines · Stuart
Quoted 467 lines · Rodrigo Vivi
Quoted 33 lines · Stuart
Quoted 18 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err()
strings that have no stable shape. That is readable for a human,
but
it
gives fleet tooling nothing durable to match on: the wording changes
between releases, lines can be rate-limited or dropped under an
error
storm, and there is no consistent way to ask "which recognised
fault
just happened?".

Quoted 13 lines

Introduce a signature identifier (SIGID): a small, stable integer
that
names one recognised Xe fault situation and serves as the primary
handle
for triage. A SIGID maps, through published end-user documentation,
to a
description and a recommended action; the driver only has to emit
the
right SIGID next to the usual human-readable text.

Quoted 1 line

I'm a little worried

I understand your feeling. We've been all through that:

https://lore.kernel.org/intel-xe/[email protected]/

Quoted 2 lines

we're introducing some ABI with this that isn't
really maintainable in the long term:

I understand the fear and indeed the first proposals I got was unmaintainable. My first record of pushing back on having something
like this was November last year.

But I respectfully disagree here. This latest version is imho organized and concise.

Quoted 6 lines

we might decide to change the
flow or change the way an error is reported or the situation that
triggers this error from firmware or hardware might change for some
reason.

You are right, dmesg is not ABI and it will never be. these logs are aimed for developers and developers are free to change them as
needed. This was a big counter-requirement I gave to the original idea.

We are not moving all the logs to this format we are not promising
dmesg stability.

The numbering stability however needs to be somewhat stable for the CPER log in tracefs, that's the ABI. But then that meaning shouldn't change if the code has to change. A new number should be needed if the component/location/severity or recommended recovery needs to be different.

But like I told Raag as well, no developer needs to invent any number, if they don't know just use regular log messages. We are not going to move all the logs towards this thing. Also, the location of the issue is what triggers the ID... it is very simple by nature. And we need to keep it simple.

Quoted 2 lines

Does this lock us into a solution for all of this? I still need to go through the full patch series...

Yes, please take a look to the series. All reviews are welcomed.

Quoted 8 lines

The dmesg entries are generally for human debuggability. I get the
desire to make these easier to parse for an AI tool or generated
script, but we also don't want to prevent debug related changes for
error handling and reporting.

We are not promising this. The stable ABI is only the CPER on tracefs.

We need to always keep this in mind as stated in
Documentation/core-api/printk-index.rst:

"""
The kernel messages are evolving together with the code. As a result,
particular kernel messages are not KABI and never will be! """

Thanks,
Rodrigo.

Quoted 358 lines

Thanks,
Stuart

Quoted 354 lines

Signed-off-by: Mallesh Koujalagi
<[email protected]>

Assisted-by Copilot:Opus-4.8
Co-developed-by Michal Wajdeczko

<[email protected]>

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal) prepare to decorate dmesg with comp/loc (Michal)
---
 Documentation/gpu/xe/index.rst        |   1 + Documentation/gpu/xe/xe_sigid.rst     |  14 ++ drivers/gpu/drm/xe/Makefile           |   1 + drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183
++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135
+++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.h           |  20 +++

 6 files changed, 354 insertions(+)

 create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +0 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for

drm/xe
is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid

Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
         xe_hw_fence.o \
         xe_irq.o \
         xe_late_bind_fw.o \
+       xe_log.o \
         xe_lrc.o \
         xe_mem_pool.o \
         xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +15 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a

small,
stable integer
+ * that names one *recognised Xe fault situation* -- nothing more.
It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer,
cross-product
+ * detail. The driver's only job is to emit the right SIGID next
to
the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` /
``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human
reading dmesg,
+ * but it gives fleet tooling nothing durable to match on:
the
wording changes
+ * between releases, lines can be rate-limited or dropped under
an
error storm,
+ * and there is no consistent way to ask "which recognised fault
just happened?"
+ * A SIGID answers exactly that one question, identically across
driver and
+ * firmware versions, and (eventually) across other Intel devices in
a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried
alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not
fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can
be
reported at
+ * different severities depending on the instance and the recovery
taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses
it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the
single most
+ * specific recognised situation *for that site* -- so the question
is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately
produces a
+ * *chain* of reports from different layers, each with its own
SIGID
-- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW
by
the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset
path,
and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain
lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using
the
ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a
SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing
one. When a
+ * new situation is genuinely worth triaging, add it to the list
below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver
itself* detects
+ * and reports from software: probe abort, wedged, survivability,
driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus
faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware
itself
+ * (e.g. via their own records or error counters), and the driver
merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error
would only
+ * duplicate an identifier the reporting layer already owns. The
two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that
*the
driver*
+ * observed a firmware problem, not a signature reported by the
firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within
the
assigned range,
+ * in the order the situations were introduced. Values are stable:
once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re- purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged
with
a coarse
+ * *resolution bucket*: the first thing an operator should do on
seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation
may
refine it,
+ * but the in-tree value always stands on its own. Every new SIGID
must pick a
+ * bucket, which forces the question "what should someone do about
this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind,
bus
reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID
in
the enum
+ * kernel-doc below and is not printed on the (deliberately lean)
dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations
only --
+ * important, operator-relevant faults and events. They are not
a
replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one- off
diagnostics;
+ * using them for ordinary logging would dilute the fault stream.
Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that
correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it
remains
+ * readable for admins; the only stable, machine-matchable token
on
it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI:
the
surrounding
+ * text may change freely, and lines may be dropped. The durable

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

record for
+ * tooling is the CPER record carrying the same SIGID (generation is
a planned
+ * follow-up).

Ok I realize I'm coming late to the party here - I just haven't had the

(no worries, I was late too)

Quoted 7 lines

time to review this in detail. I really don't like having this ABI- adjacent implementation. It feels like we will be on the hook for maintaining things in the future that will limit our ability to implement changes and debug. I get the notes that Rodrigo has above,
but this just feels like the wrong approach to me.

Quoted 6 lines

That said, I don't want to block the work here. I know we have some users looking for this for their own debug.

You have "dmesg is not ABI" here which is a start. What happens if we
decide to drop one of these messages?

we don't require any use of xe_log() to be permanent (see below) it can changed or dropped or replaced back with xe_err() any time.

Quoted 2 lines

Is it only the ID itself that we
want to be stable and monotonically incrementing?

correct, just use of the same SIGID in the log will always mean the same

Quoted 2 lines

Or is the message
itself supposed to be stable?

message can be changed any time, like in regular xe_err()

it is just an additional hint for debug (together with SEVERITY and reported errno)

Quoted 2 lines

If we drop all references to a particular
ID is that ok?

yes, if the ID is no longer applicable
and this was already stated in DOC

Quoted 3 lines

What if we have 10s of IDs or more that have no use in the future and we move on to the next section? We don't care about cleanup of this kind of thing?

legacy SIGIDs stays forever, there will be no ID value reuse (also see DOC) but due to the way they are defined, it is unlikely that we will drop them

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Or the line above about "dmesg is not
ABI" means we can really do whatever we want with it?

I assume the only new requirement for us would be that we should not drop all xe_logs for any SIGID which is still applicable (and was not replaced with other SIGID)

Well, if the code changes in a way that the function doesn't exist anymore, what should we do?
We cannot guarantee that.

Quoted 2 lines

It would be nice to make that explicit in the documentation.

Right, we probably need some explicit mention about this case. But we shouldn't commit to not remove a log line.

Quoted 10 lines

I'm still pretty worried about the contractual aspect of this with users who start relying on this. But if we take that out, from a purely kernel debug usage aspect, I do like having this to help categorize issues and flows. It seems like we should be able to do something with this in printk directly (or the drm_* variants) rather than having something specific to the GPU here. But as long as we don't make it too strict, hopefully we can expand if there's interest there.

Let me go through in detail later today and get back.

Yes please! :)

Quoted 10 lines

Thanks,
Stuart

Quoted 5 lines
Quoted 5 lines

Thanks,
Stuart

#14 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

In reply to Michal Wajdeczko
Quoted 221 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
  Documentation/gpu/xe/index.rst        |   1 +
  Documentation/gpu/xe/xe_sigid.rst     |  14 ++
  drivers/gpu/drm/xe/Makefile           |   1 +
  drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.h           |  20 +++
  6 files changed, 354 insertions(+)

create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
     xe-drm-usage-stats.rst
     xe_configfs
     xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
  	xe_hw_fence.o \
  	xe_irq.o \
  	xe_late_bind_fw.o \
+	xe_log.o \
  	xe_lrc.o \
  	xe_mem_pool.o \
  	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +133 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 143

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100

INTEL_SIGID_GPU_START and INTEL_SIGID_GPU_XE_START having same value, which is misleading

Quoted 77 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +40 -0
+#define INTEL_SIGID_GPU_XE_END			299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,
+	XE_SIGID_PROBE			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+	XE_SIGID_WEDGED			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+	XE_SIGID_SURVIVABILITY		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+	XE_SIGID_RUNTIME_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+	XE_SIGID_DEVICE_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +31 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			  u32 component, u32 location, const void *data, size_t len,
+			  struct va_format *vaf)
+{
+	/* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+	return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+	return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+	return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR : "";
+}
+
+static const char *log_sev_prefix(int cper_sev)

drivers/gpu/drm/xe/xe_log.c line 41

Quoted 10 lines
drivers/gpu/drm/xe/xe_log.c new file +10 -0
+{
+	switch (cper_sev) {
+	case CPER_SEV_FATAL:
+		return "FATAL ";
+	case CPER_SEV_RECOVERABLE:
+		return "";
+	case CPER_SEV_CORRECTED:
+		return "CORRECTED ";
+	default:
+		return "";

Please add case CPER_SEV_INFORMATIONAL:

                            return "";

                default:

                        WARN_ONCE(...)

                        return"";

Quoted 44 lines
drivers/gpu/drm/xe/xe_log.c new file +44 -0
+	}
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)	"[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...)	__LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	if (cper_sev == CPER_SEV_INFORMATIONAL)
+		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+	else
+		pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+	va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			   u32 component, u32 location, const void *data, size_t len,
+			   struct va_format *vaf)
+{
+	const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+	const char *sev_prefix = log_sev_prefix(cper_sev);
+
+	/* TODO: add component/location details */
+
+	if (IS_ERR(data))
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%pV",
+				 sigid, sev_prefix, data, hwe_prefix, vaf);
+	else if (data && len)
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+				 sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+	else

drivers/gpu/drm/xe/xe_log.c line 95

Quoted 10 lines
drivers/gpu/drm/xe/xe_log.c new file +10 -0
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+				 sigid, sev_prefix, hwe_prefix, vaf);
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer

Typo "identifier"

Quoted 13 lines
drivers/gpu/drm/xe/xe_log.c new file +13 -0
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine-matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging

drivers/gpu/drm/xe/xe_log.c line 118

Quoted 10 lines
drivers/gpu/drm/xe/xe_log.c new file +10 -0
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode

Info <6> case should not be "*ERROR*" OR

<6> xe 0000:03:00.0: [drm] SIGID=103 In survivability mode right?

Thanks,

-/Mallesh

Quoted 43 lines
drivers/gpu/drm/xe/xe_log.c new file +17 -0
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_emit_dmesg(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+	log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+
+	va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +20 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...);
+
+#endif
#15 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

In reply to Michal Wajdeczko
Quoted 108 lines · Michal Wajdeczko

From: Mallesh Koujalagi<[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt<[email protected]>
Cc: Aravind Iddamsetty<[email protected]>
Cc: Raag Jadav<[email protected]>
Cc: Riana Tauro<[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
  Documentation/gpu/xe/index.rst        |   1 +
  Documentation/gpu/xe/xe_sigid.rst     |  14 ++
  drivers/gpu/drm/xe/Makefile           |   1 +
  drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.h           |  20 +++
  6 files changed, 354 insertions(+)

create mode 100644 Documentation/gpu/xe/xe_sigid.rst create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h create mode 100644 drivers/gpu/drm/xe/xe_log.c create mode 100644 drivers/gpu/drm/xe/xe_log.h

Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
     xe-drm-usage-stats.rst
     xe_configfs
     xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
  	xe_hw_fence.o \
  	xe_irq.o \
  	xe_late_bind_fw.o \
+	xe_log.o \
  	xe_lrc.o \
  	xe_mem_pool.o \
  	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +20 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 30

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,

How SIGID is going to handle above scenario?

Quoted 22 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +22 -0
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 62

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.

I don't think XE_SIGID_WEDGED fits this rule. Unlike the examples above, a wedged GT is not specific to a single report site and can be reported from different paths. So wedging is situation reported from different sites.

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 67

Quoted 5 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +5 -0
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.

The information regarding logging SIGID should be embedded here.

Quoted 79 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +79 -0
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100
+#define INTEL_SIGID_GPU_XE_END			299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 156

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]

Going forward there could be multiple actions associated with survivability mode.

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 157

Quoted 1 line
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +1 -0
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]

Are we certain all runtime firmware failures lie in retry category?

Quoted 9 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +9 -0
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 176

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,
+	XE_SIGID_PROBE			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+	XE_SIGID_WEDGED			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+	XE_SIGID_SURVIVABILITY		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+	XE_SIGID_RUNTIME_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,

Is it allowed to maintain each firmware as separate site? e.g. XE_SIGID_RUNTIME_GUC_FW, XE_SIGID_RUNTIME_HUC_FW, XE_SIGID_RUNTIME_GSC_FW

Thanks,
Badal

Quoted 174 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +7 -0
+	XE_SIGID_DEVICE_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +135 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			  u32 component, u32 location, const void *data, size_t len,
+			  struct va_format *vaf)
+{
+	/* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+	return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+	return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+	return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR : "";
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+	switch (cper_sev) {
+	case CPER_SEV_FATAL:
+		return "FATAL ";
+	case CPER_SEV_RECOVERABLE:
+		return "";
+	case CPER_SEV_CORRECTED:
+		return "CORRECTED ";
+	default:
+		return "";
+	}
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)	"[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...)	__LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	if (cper_sev == CPER_SEV_INFORMATIONAL)
+		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+	else
+		pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+	va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			   u32 component, u32 location, const void *data, size_t len,
+			   struct va_format *vaf)
+{
+	const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+	const char *sev_prefix = log_sev_prefix(cper_sev);
+
+	/* TODO: add component/location details */
+
+	if (IS_ERR(data))
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%pV",
+				 sigid, sev_prefix, data, hwe_prefix, vaf);
+	else if (data && len)
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+				 sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+	else
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+				 sigid, sev_prefix, hwe_prefix, vaf);
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine-matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_emit_dmesg(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+	log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+
+	va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +20 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...);
+
+#endif
#16 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Hi Badal,

sorry for late response here

Quoted 113 lines · Badal
Quoted 111 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
 Documentation/gpu/xe/index.rst        |   1 +
 Documentation/gpu/xe/xe_sigid.rst     |  14 ++
 drivers/gpu/drm/xe/Makefile           |   1 +
 drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.h           |  20 +++
 6 files changed, 354 insertions(+)
 create mode 100644 Documentation/gpu/xe/xe_sigid.rst
 create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h
 create mode 100644 drivers/gpu/drm/xe/xe_log.c
 create mode 100644 drivers/gpu/drm/xe/xe_log.h
Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
 	xe_hw_fence.o \
 	xe_irq.o \
 	xe_late_bind_fw.o \
+	xe_log.o \
 	xe_lrc.o \
 	xe_mem_pool.o \
 	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +23 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 30

Quoted 7 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +7 -0
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,

How SIGID is going to handle above scenario?

error logs with SIGID will be printed to dmesg, and thus could be lost as any other regular xe_err messages, but also there will be a CPER record generated (a planned follow up) which should be more robust against any drops.

Quoted 32 lines
Quoted 22 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +22 -0
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 62

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +10 -0
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
Quoted 2 lines

I don't think XE_SIGID_WEDGED fits this rule. Unlike the examples above, a wedged GT is not specific to a single report site and can be reported from different paths. So wedging is situation reported from different sites.

each site will report its own SIGID based on fault site (FW, BUS) and we will use WEDGE SIGID once we eventually reach that state

Quoted 6 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 67

Quoted 5 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +5 -0
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.

The information regarding logging SIGID should be embedded here.

in latest rev4 this kernel-DOC section was refactored

https://patchwork.freedesktop.org/series/171022/#rev4

Quoted 82 lines
Quoted 82 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +82 -0
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100
+#define INTEL_SIGID_GPU_XE_END			299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 156

Quoted 7 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +7 -0
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]

Going forward there could be multiple actions associated with survivability mode.

in rev4 we dropped the resolution bucket idea

Quoted 3 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 157

Quoted 1 line
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +1 -0
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]

Are we certain all runtime firmware failures lie in retry category?

ditto

Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +16 -0
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,
+	XE_SIGID_PROBE			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 176

Quoted 3 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +3 -0
+	XE_SIGID_WEDGED			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+	XE_SIGID_SURVIVABILITY		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+	XE_SIGID_RUNTIME_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,

Is it allowed to maintain each firmware as separate site? e.g. XE_SIGID_RUNTIME_GUC_FW, XE_SIGID_RUNTIME_HUC_FW, XE_SIGID_RUNTIME_GSC_FW

no, there is just single SIGID for all those above firmwares but we do have LOG_COMPONENTS for each of those, and macros accepts them instead of raw SIGID, and xe_log_emit can use those components IDs to decorate dmesg and update CPER record

Quoted 178 lines

Thanks,
Badal

Quoted 174 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +7 -0
+	XE_SIGID_DEVICE_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +135 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			  u32 component, u32 location, const void *data, size_t len,
+			  struct va_format *vaf)
+{
+	/* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+	return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+	return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+	return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR : "";
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+	switch (cper_sev) {
+	case CPER_SEV_FATAL:
+		return "FATAL ";
+	case CPER_SEV_RECOVERABLE:
+		return "";
+	case CPER_SEV_CORRECTED:
+		return "CORRECTED ";
+	default:
+		return "";
+	}
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)	"[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...)	__LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	if (cper_sev == CPER_SEV_INFORMATIONAL)
+		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+	else
+		pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+	va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			   u32 component, u32 location, const void *data, size_t len,
+			   struct va_format *vaf)
+{
+	const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+	const char *sev_prefix = log_sev_prefix(cper_sev);
+
+	/* TODO: add component/location details */
+
+	if (IS_ERR(data))
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%pV",
+				 sigid, sev_prefix, data, hwe_prefix, vaf);
+	else if (data && len)
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+				 sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+	else
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+				 sigid, sev_prefix, hwe_prefix, vaf);
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine-matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_emit_dmesg(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+	log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+
+	va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +20 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...);
+
+#endif
#17 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

In reply to Michal Wajdeczko
Quoted 354 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
 Documentation/gpu/xe/index.rst        |   1 +
 Documentation/gpu/xe/xe_sigid.rst     |  14 ++
 drivers/gpu/drm/xe/Makefile           |   1 +
 drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.h           |  20 +++
 6 files changed, 354 insertions(+)
 create mode 100644 Documentation/gpu/xe/xe_sigid.rst
 create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h
 create mode 100644 drivers/gpu/drm/xe/xe_log.c
 create mode 100644 drivers/gpu/drm/xe/xe_log.h
Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
 	xe_hw_fence.o \
 	xe_irq.o \
 	xe_late_bind_fw.o \
+	xe_log.o \
 	xe_lrc.o \
 	xe_mem_pool.o \
 	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +183 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100
+#define INTEL_SIGID_GPU_XE_END			299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,
+	XE_SIGID_PROBE			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+	XE_SIGID_WEDGED			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+	XE_SIGID_SURVIVABILITY		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+	XE_SIGID_RUNTIME_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+	XE_SIGID_DEVICE_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +77 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			  u32 component, u32 location, const void *data, size_t len,
+			  struct va_format *vaf)
+{
+	/* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+	return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+	return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+	return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR : "";
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+	switch (cper_sev) {
+	case CPER_SEV_FATAL:
+		return "FATAL ";
+	case CPER_SEV_RECOVERABLE:
+		return "";
+	case CPER_SEV_CORRECTED:
+		return "CORRECTED ";
+	default:
+		return "";
+	}
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)	"[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...)	__LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	if (cper_sev == CPER_SEV_INFORMATIONAL)
+		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+	else
+		pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+	va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			   u32 component, u32 location, const void *data, size_t len,
+			   struct va_format *vaf)
+{
+	const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+	const char *sev_prefix = log_sev_prefix(cper_sev);
+
+	/* TODO: add component/location details */

drivers/gpu/drm/xe/xe_log.c line 87

Quoted 10 lines
drivers/gpu/drm/xe/xe_log.c new file +10 -0
+
+	if (IS_ERR(data))
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%pV",
+				 sigid, sev_prefix, data, hwe_prefix, vaf);
+	else if (data && len)
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+				 sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+	else
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+				 sigid, sev_prefix, hwe_prefix, vaf);

Can we print the device UUID as well every time we print the SIG_ID, as the BDFs keep changing it can be helpful to identify the part correctly.

Thanks,
Aravind.

Quoted 74 lines
drivers/gpu/drm/xe/xe_log.c new file +48 -0
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine-matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_emit_dmesg(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+	log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+
+	va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +20 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...);
+
+#endif
#18 lore raw

Re: [PATCH v3 02/23] drm/xe/log: Add structured SIGID error logging infrastructure

Quoted 361 lines · Aravind Iddamsetty
Quoted 359 lines · Michal Wajdeczko

From: Mallesh Koujalagi <[email protected]>

Today the driver reports faults with ad-hoc drm_err()/xe_gt_err() strings that have no stable shape. That is readable for a human, but it gives fleet tooling nothing durable to match on: the wording changes between releases, lines can be rate-limited or dropped under an error storm, and there is no consistent way to ask "which recognised fault just happened?".

Introduce a signature identifier (SIGID): a small, stable integer that names one recognised Xe fault situation and serves as the primary handle for triage. A SIGID maps, through published end-user documentation, to a description and a recommended action; the driver only has to emit the right SIGID next to the usual human-readable text.

---
Cc: Yoni Levitt <[email protected]>
Cc: Aravind Iddamsetty <[email protected]>
Cc: Raag Jadav <[email protected]>
Cc: Riana Tauro <[email protected]>
---
v2: CORRECTED is still an error (Michal)
prepare to decorate dmesg with comp/loc (Michal)

---
 Documentation/gpu/xe/index.rst        |   1 +
 Documentation/gpu/xe/xe_sigid.rst     |  14 ++
 drivers/gpu/drm/xe/Makefile           |   1 +
 drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 183 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c           | 135 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.h           |  20 +++
 6 files changed, 354 insertions(+)
 create mode 100644 Documentation/gpu/xe/xe_sigid.rst
 create mode 100644 drivers/gpu/drm/xe/abi/xe_sigid_abi.h
 create mode 100644 drivers/gpu/drm/xe/xe_log.c
 create mode 100644 drivers/gpu/drm/xe/xe_log.h
Documentation/gpu/xe/index.rst +1 -0
index 665c0e93601c..0247a255f7e6 100644
@@ -35,3 +35,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is provided by
    xe-drm-usage-stats.rst
    xe_configfs
    xe_gt_stats
+   xe_sigid
Documentation/gpu/xe/xe_sigid.rst new file +14 -0
new file mode 100644
index 000000000000..45d84a62f185
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+========
+Xe SIGID
+========
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :doc: Xe Error Signatures (SIGID)
+
+Signature Identifiers
+=====================
+
+.. kernel-doc:: drivers/gpu/drm/xe/abi/xe_sigid_abi.h
+   :internal:
drivers/gpu/drm/xe/Makefile +1 -0
index 67ada1d6c2fb..7ac3954737f9 100644
@@ -87,6 +87,7 @@ xe-y += xe_bb.o \
 	xe_hw_fence.o \
 	xe_irq.o \
 	xe_late_bind_fw.o \
+	xe_log.o \
 	xe_lrc.o \
 	xe_mem_pool.o \
 	xe_migrate.o \
drivers/gpu/drm/xe/abi/xe_sigid_abi.h new file +183 -0
new file mode 100644
index 000000000000..99717fdf74a6
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _ABI_XE_SIGID_ABI_H_
+#define _ABI_XE_SIGID_ABI_H_
+
+/**
+ * DOC: Xe Error Signatures (SIGID)
+ *
+ * What SIGID stands for
+ * ---------------------
+ *
+ * SIGID is short for *Signature Identifier*. A SIGID is a small, stable integer
+ * that names one *recognised Xe fault situation* -- nothing more. It is the
+ * primary handle used for triage: a SIGID maps to a human description and a
+ * recommended first action. A coarse first-order action is documented in-tree
+ * per SIGID (see "First-order action" below) so the id is actionable on its
+ * own; published end-user documentation refines it with finer, cross-product
+ * detail. The driver's only job is to emit the right SIGID next to the usual
+ * human-readable text.
+ *
+ * Why this exists
+ * ---------------
+ *
+ * Today the driver reports faults with ad-hoc ``drm_err()`` / ``xe_gt_err()``
+ * strings that have no stable shape. That is fine for a human reading dmesg,
+ * but it gives fleet tooling nothing durable to match on: the wording changes
+ * between releases, lines can be rate-limited or dropped under an error storm,
+ * and there is no consistent way to ask "which recognised fault just happened?"
+ * A SIGID answers exactly that one question, identically across driver and
+ * firmware versions, and (eventually) across other Intel devices in a node.
+ *
+ * What a SIGID is (and is not)
+ * ----------------------------
+ *
+ * A SIGID names *which situation* is being reported. It deliberately does not
+ * encode the detailed reason or the outcome. Those are carried alongside it::
+ *
+ *   SIGID    -> which recognised situation is being reported
+ *   severity -> how serious this instance is (see below -- not fixed per SIGID)
+ *   errno    -> the failing operation's error, shown with %pe
+ *   message  -> free-form human-readable context
+ *
+ * Severity is independent of the SIGID. The same situation can be reported at
+ * different severities depending on the instance and the recovery taken, so a
+ * SIGID is never tied to one severity; the reporting site chooses it by calling
+ * the matching xe_log_*() helper (see xe_log.h).
+ *
+ * How to pick a SIGID (the uniqueness rule)
+ * -----------------------------------------
+ *
+ * Pick per *report site*, not per incident. Each site emits the single most
+ * specific recognised situation *for that site* -- so the question is never
+ * "classify this whole failure", it is "what does this site detect?", which has
+ * one answer. A single underlying failure therefore legitimately produces a
+ * *chain* of reports from different layers, each with its own SIGID -- e.g. a
+ * GuC communication failure is reported as %XE_SIGID_RUNTIME_FW by the firmware
+ * path, the failed recovery as %XE_SIGID_GT_TDR by the reset path, and an
+ * aborted bind as %XE_SIGID_PROBE by the probe path. That chain lets triage
+ * follow a fault from origin to final effect; it is not a duplicate.
+ *
+ * If a site does not match any defined situation, keep using the ordinary
+ * ``xe_err()`` / ``xe_gt_err()`` logging rather than forcing a SIGID: a wrong
+ * or over-broad classification is harder to retire than a missing one. When a
+ * new situation is genuinely worth triaging, add it to the list below.
+ *
+ * Scope: software-emitted signatures only
+ * ---------------------------------------
+ *
+ * This header enumerates only the situations that the *driver itself* detects
+ * and reports from software: probe abort, wedged, survivability, driver-
+ * detected firmware failures, engine TDR, memory faults and IO/bus faults.
+ * These are the only values the driver assigns.
+ *
+ * Signatures that *originate* in firmware or hardware are a different thing:
+ * they are produced and identified by the firmware or the hardware itself
+ * (e.g. via their own records or error counters), and the driver merely logs
+ * them as they are given to us. They are deliberately *not* enumerated here --
+ * minting a driver-side id for a firmware/hardware-reported error would only
+ * duplicate an identifier the reporting layer already owns. The two
+ * driver-detected firmware situations below (%XE_SIGID_RUNTIME_FW,
+ * %XE_SIGID_DEVICE_FW) are software signatures: they mark that *the driver*
+ * observed a firmware problem, not a signature reported by the firmware.
+ *
+ * Numbering
+ * ---------
+ *
+ * SIGIDs are a single flat list numbered sequentially within the assigned range,
+ * in the order the situations were introduced. Values are stable: once assigned
+ * they are only ever appended, never renumbered or reused.
+ *
+ * A retired situation is deprecated in place, never re-purposed.
+ *
+ * First-order action (resolution buckets)
+ * ---------------------------------------
+ *
+ * So that a SIGID is actionable on its own, each one is tagged with a coarse
+ * *resolution bucket*: the first thing an operator should do on seeing it. The
+ * bucket is a stable, driver-owned hint; external documentation may refine it,
+ * but the in-tree value always stands on its own. Every new SIGID must pick a
+ * bucket, which forces the question "what should someone do about this?" to be
+ * answered up front. The buckets are::
+ *
+ *   COLLECT  -- capture logs and open a bug report
+ *   RETRY    -- transient or already recovered; watch for recurrence
+ *   UPDATE   -- a firmware update / flash is required
+ *   RECOVER  -- an explicit recovery step is needed (rebind, bus reset)
+ *   IGNORE   -- ignore if the SIGID severity is INFORMATIONAL
+ *
+ * The bucket is documentation only -- it is recorded per SIGID in the enum
+ * kernel-doc below and is not printed on the (deliberately lean) dmesg line.
+ *
+ * When to use SIGID logging
+ * -------------------------
+ *
+ * The xe_log_*() helpers are for these recognised fault situations only --
+ * important, operator-relevant faults and events. They are not a replacement
+ * for ``xe_info()`` / ``xe_dbg()`` / tracing, nor for one-off diagnostics;
+ * using them for ordinary logging would dilute the fault stream. Not every
+ * ``xe_err()`` needs to become a SIGID report -- only those that correspond to
+ * a published situation.
+ *
+ * dmesg vs. the machine record
+ * ----------------------------
+ *
+ * The dmesg line stays close to a normal xe error message so it remains
+ * readable for admins; the only stable, machine-matchable token on it is
+ * ``SIGID=<n>`` (``dmesg | grep SIGID=``). dmesg is not an ABI: the surrounding
+ * text may change freely, and lines may be dropped. The durable record for
+ * tooling is the CPER record carrying the same SIGID (generation is a planned
+ * follow-up).
+ */
+
+/*
+ * Top level Intel Error Signature Identifiers.
+ */
+#define INTEL_SIGID_INVALID			0
+#define INTEL_SIGID_GPU_START			100
+#define INTEL_SIGID_GPU_END			999
+
+#define INTEL_SIGID_GPU_XE_START		100
+#define INTEL_SIGID_GPU_XE_END			299
+
+#define INTEL_SIGID_GPU_XE_SOFTWARE_START	100
+#define INTEL_SIGID_GPU_XE_SOFTWARE_END		199
+#define INTEL_SIGID_GPU_XE_HARDWARE_START	200
+#define INTEL_SIGID_GPU_XE_HARDWARE_END		299
+
+/**
+ * enum xe_sigid - Stable Xe Error Signature Identifiers (SIGID).
+ * @XE_SIGID_SW: Software component failure. [COLLECT]
+ * @XE_SIGID_PROBE: Device probe/bind was aborted. [COLLECT]
+ * @XE_SIGID_WEDGED: Device was declared wedged and is no longer usable. [RECOVER]
+ * @XE_SIGID_SURVIVABILITY: Device entered survivability mode. [UPDATE]
+ * @XE_SIGID_RUNTIME_FW: Driver-detected runtime firmware failure, GuC/HuC/GSC. [RETRY]
+ * @XE_SIGID_DEVICE_FW: Driver-detected device firmware failure, PCODE/sysctrl. [RETRY]
+ * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
+ * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
+ * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ *
+ * The situations the driver detects and reports in software. Values are
+ * numbered sequentially, are only ever appended, and are never renumbered or
+ * reused. The tag in brackets is the default resolution bucket (see the `Xe
+ * Error Signatures (SIGID)`_ section).
+ *
+ * Firmware- and hardware-originated signatures are not listed here; they are
+ * logged as reported by those layers.
+ */
+enum xe_sigid {
+	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,
+	XE_SIGID_PROBE			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 1,
+	XE_SIGID_WEDGED			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 2,
+	XE_SIGID_SURVIVABILITY		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 3,
+	XE_SIGID_RUNTIME_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 4,
+	XE_SIGID_DEVICE_FW		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 5,
+	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
+	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
+	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+};
+
+#endif
drivers/gpu/drm/xe/xe_log.c new file +82 -0
new file mode 100644
index 000000000000..70a41bdf1a01
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "xe_log.h"
+#include "xe_printk.h"
+
+static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			  u32 component, u32 location, const void *data, size_t len,
+			  struct va_format *vaf)
+{
+	/* TODO */
+}
+
+static bool is_hw_sigid(enum xe_sigid sigid)
+{
+	return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
+}
+
+static bool is_sev_error(int cper_sev)
+{
+	return cper_sev != CPER_SEV_INFORMATIONAL;
+}
+
+static const char *log_hwe_prefix(int cper_sev, enum xe_sigid sigid)
+{
+	return is_sev_error(cper_sev) && is_hw_sigid(sigid) ? HW_ERR : "";
+}
+
+static const char *log_sev_prefix(int cper_sev)
+{
+	switch (cper_sev) {
+	case CPER_SEV_FATAL:
+		return "FATAL ";
+	case CPER_SEV_RECOVERABLE:
+		return "";
+	case CPER_SEV_CORRECTED:
+		return "CORRECTED ";
+	default:
+		return "";
+	}
+}
+
+#define __LOG_DRM_PRINTK_FMT(fmt, args...)	"[drm] " fmt, ##args
+#define __LOG_DRM_PRINTK_ERR_FMT(fmt, args...)	__LOG_DRM_PRINTK_FMT("*ERROR* " fmt, args)
+
+static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	if (cper_sev == CPER_SEV_INFORMATIONAL)
+		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
+	else
+		pci_err(pdev, __LOG_DRM_PRINTK_ERR_FMT("%pV", vaf));
+}
+
+static void log_dmesg_printf(struct pci_dev *pdev, int cper_sev, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_dmesg_vprintk(pdev, cper_sev, &vaf);
+
+	va_end(args);
+}
+
+static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+			   u32 component, u32 location, const void *data, size_t len,
+			   struct va_format *vaf)
+{
+	const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
+	const char *sev_prefix = log_sev_prefix(cper_sev);
+
+	/* TODO: add component/location details */
+
+	if (IS_ERR(data))
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%pV",
+				 sigid, sev_prefix, data, hwe_prefix, vaf);
+	else if (data && len)
Quoted 8 lines

drivers/gpu/drm/xe/xe_log.c line 87

Quoted 5 lines
drivers/gpu/drm/xe/xe_log.c new file +5 -0
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
+				 sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
+	else
+		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
+				 sigid, sev_prefix, hwe_prefix, vaf);

Can we print the device UUID as well every time we print the SIG_ID, as the BDFs keep changing it can be helpful to identify the part correctly.

that would be overkill

and I don't think that BDF would change without bus re-enumeration and driver re-probe

we can log SIGID PROBE info level message with UUID once on every probe attempt right after we would be able to retrieve that

but logging that on every dmesg line - no

note that you may still consider adding that to CPER record

Quoted 77 lines

Thanks,
Aravind.

Quoted 74 lines
drivers/gpu/drm/xe/xe_log.c new file +48 -0
+}
+
+/**
+ * xe_log_emit() - Emit a structured SIGID log entry
+ * @pdev: the &pci_dev device
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @location: location details of the @component
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @...: format arguments
+ *
+ * Emits a dmesg line that includes a single stable, machine-matchable token
+ * ``SIGID=<n>`` followed by the optional severity token (like ``FATAL``) and,
+ * when @data pointer is set, either the error printed with %pe or a packed hex
+ * dump of the @data binary blob. The dmesg line will also include printf-style
+ * text message.
+ *
+ * Note that the full dmesg line, with the free text message, is only a debugging
+ * aid, not an interface! Only the ``SIGID=<n>`` token is stable there.
+ * The durable machine record is the CPER carrying the same SIGID.
+ *
+ * Note: generation of the CPER record is a planned follow-up.
+ *
+ * Examples::
+ *
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=104 FATAL (-EPROTO) Invalid GuC reply
+ *   <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung
+ *   <6> xe 0000:03:00.0: [drm] *ERROR* SIGID=103 In survivability mode
+ */
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	log_emit_dmesg(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+	log_emit_cper(pdev, cper_sev, sigid, component, location, data, len, &vaf);
+
+	va_end(args);
+}
drivers/gpu/drm/xe/xe_log.h new file +20 -0
new file mode 100644
index 000000000000..d475e816ee0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_LOG_H_
+#define _XE_LOG_H_
+
+#include <linux/cper.h>
+
+#include "abi/xe_sigid_abi.h"
+
+struct pci_dev;
+
+__printf(8, 9)
+void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
+		 u32 component, u32 location, const void *data, size_t len,
+		 const char *fmt, ...);
+
+#endif
#19 lore raw

PATCH v3 5/23 drm/xe/log: Add SIGID log helpers for severity

In reply to Michal Wajdeczko

There are only few CPER severity levels defined, add simple helper for each of them, to avoid forcing developers to write full severity name in every function call.

---
v2: drop support for any_to_pdev (Michal)

---
 drivers/gpu/drm/xe/xe_log.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/xe/xe_log.h +16 -0
index d475e816ee0b..73daf37d6463 100644
@@ -17,4 +17,20 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
 		 u32 component, u32 location, const void *data, size_t len,
 		 const char *fmt, ...);
 
+#define xe_log_emit_fatal(pdev, sig, comp, loc, data, len, fmt, args...) \
+	xe_log_emit((pdev), CPER_SEV_FATAL, (sig), (comp), (loc), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_emit_recoverable(pdev, sig, comp, loc, data, len, fmt, args...) \
+	xe_log_emit((pdev), CPER_SEV_RECOVERABLE, (sig), (comp), (loc), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_emit_corrected(pdev, sig, comp, loc, data, len, fmt, args...) \
+	xe_log_emit((pdev), CPER_SEV_CORRECTED, (sig), (comp), (loc), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_emit_info(pdev, sig, comp, loc, data, len, fmt, args...) \
+	xe_log_emit((pdev), CPER_SEV_INFORMATIONAL, (sig), (comp), (loc), \
+		    (data), (len), fmt, ##args)
+
 #endif
Signature · 1 line
2.47.1
Reviewed-by on v3 5/23
#20 lore raw

Re: [PATCH v3 05/23] drm/xe/log: Add SIGID log helpers for severity

Quoted 5 lines · Michal Wajdeczko

There are only few CPER severity levels defined, add simple helper for each of them, to avoid forcing developers to write full severity name in every function call.

LGTM,

Quoted 32 lines
Cc Rodrigo Vivi <[email protected]>

---
v2: drop support for any_to_pdev (Michal)

---
  drivers/gpu/drm/xe/xe_log.h | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
drivers/gpu/drm/xe/xe_log.h +16 -0
index d475e816ee0b..73daf37d6463 100644
@@ -17,4 +17,20 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
  		 u32 component, u32 location, const void *data, size_t len,
  		 const char *fmt, ...);
 
+#define xe_log_emit_fatal(pdev, sig, comp, loc, data, len, fmt, args...) \
+	xe_log_emit((pdev), CPER_SEV_FATAL, (sig), (comp), (loc), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_emit_recoverable(pdev, sig, comp, loc, data, len, fmt, args...) \
+	xe_log_emit((pdev), CPER_SEV_RECOVERABLE, (sig), (comp), (loc), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_emit_corrected(pdev, sig, comp, loc, data, len, fmt, args...) \
+	xe_log_emit((pdev), CPER_SEV_CORRECTED, (sig), (comp), (loc), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_emit_info(pdev, sig, comp, loc, data, len, fmt, args...) \
+	xe_log_emit((pdev), CPER_SEV_INFORMATIONAL, (sig), (comp), (loc), \
+		    (data), (len), fmt, ##args)
+
  #endif
#21 lore raw

PATCH v3 6/23 drm/xe/log: Add SIGID log helpers for location

In reply to Michal Wajdeczko

We can determine the location of the SIGID error source based on the type of the xe pointer being currently available. Add helper macros that will accept any of xe_device, xe_tile or xe_gt pointers instead of plain pci_dev to generate valid XE_LOG_LOCATION identifier and then call low-level xe_log_emit(pdev) function.

---
Cc: Aravind Iddamsetty <[email protected]>
Cc: Mallesh Koujalagi <[email protected]>

---
 drivers/gpu/drm/xe/xe_log.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
drivers/gpu/drm/xe/xe_log.h +36 -0
index 73daf37d6463..510cedae6e14 100644
@@ -8,7 +8,9 @@
 
 #include <linux/cper.h>
 
+#include "abi/xe_log_abi.h"
 #include "abi/xe_sigid_abi.h"
+#include "xe_any.h"
 
 struct pci_dev;
 
@@ -33,4 +35,38 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
 	xe_log_emit((pdev), CPER_SEV_INFORMATIONAL, (sig), (comp), (loc), \
 		    (data), (len), fmt, ##args)
 
+#define xe_log_location_type(any)							\
+	_Generic((any),									\
+		 struct xe_gt * : XE_LOG_LOCATION_TYPE_GT,				\
+		 const struct xe_gt * : XE_LOG_LOCATION_TYPE_GT,			\
+		 struct xe_tile * : XE_LOG_LOCATION_TYPE_TILE,				\
+		 const struct xe_tile * : XE_LOG_LOCATION_TYPE_TILE,			\
+		 struct xe_device * : XE_LOG_LOCATION_TYPE_DEVICE,			\
+		 const struct xe_device * : XE_LOG_LOCATION_TYPE_DEVICE,		\
+		 struct pci_dev * : XE_LOG_LOCATION_TYPE_DEVICE,			\
+		 struct device * : XE_LOG_LOCATION_TYPE_DEVICE)
+
+#define xe_log_location(any) \
+	PREP_XE_LOG_LOCATION(xe_log_location_type(any), xe_any_id(any))
+
+/**
+ * xe_log_from() - Emit a structured SIGID log entry using @any pointer as location.
+ * @any: the &xe_device or &xe_tile or &xe_gt pointer this report relates to
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @args: arguments for the @fmt format string
+ *
+ * The location used to emit SIGID entry will be based on the @any pointer type.
+ * See xe_log_emit() for more details.
+ */
+#define xe_log_from(any, cper_sev, sigid, component, data, len, fmt, args...) do {	\
+	typeof(any) ___any = (any);							\
+	xe_log_emit(xe_any_to_pdev(___any), (cper_sev), (sigid), (component),		\
+		    xe_log_location(___any), (data), (len), fmt, ##args);		\
+} while (0)
+
 #endif
Signature · 1 line
2.47.1
Reviewed-by on v3 6/23
#22 lore raw

Re: [PATCH v3 06/23] drm/xe/log: Add SIGID log helpers for location

Quoted 7 lines · Michal Wajdeczko

We can determine the location of the SIGID error source based on the type of the xe pointer being currently available. Add helper macros that will accept any of xe_device, xe_tile or xe_gt pointers instead of plain pci_dev to generate valid XE_LOG_LOCATION identifier and then call low-level xe_log_emit(pdev) function.

LGTM,

Quoted 61 lines
Cc Rodrigo Vivi <[email protected]>

---
Cc: Aravind Iddamsetty <[email protected]>
Cc: Mallesh Koujalagi <[email protected]>

---
  drivers/gpu/drm/xe/xe_log.h | 36 ++++++++++++++++++++++++++++++++++++
  1 file changed, 36 insertions(+)
drivers/gpu/drm/xe/xe_log.h +36 -0
index 73daf37d6463..510cedae6e14 100644
@@ -8,7 +8,9 @@
 
  #include <linux/cper.h>
 
+#include "abi/xe_log_abi.h"
  #include "abi/xe_sigid_abi.h"
+#include "xe_any.h"
 
  struct pci_dev;
 
@@ -33,4 +35,38 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
  	xe_log_emit((pdev), CPER_SEV_INFORMATIONAL, (sig), (comp), (loc), \
  		    (data), (len), fmt, ##args)
 
+#define xe_log_location_type(any)							\
+	_Generic((any),									\
+		 struct xe_gt * : XE_LOG_LOCATION_TYPE_GT,				\
+		 const struct xe_gt * : XE_LOG_LOCATION_TYPE_GT,			\
+		 struct xe_tile * : XE_LOG_LOCATION_TYPE_TILE,				\
+		 const struct xe_tile * : XE_LOG_LOCATION_TYPE_TILE,			\
+		 struct xe_device * : XE_LOG_LOCATION_TYPE_DEVICE,			\
+		 const struct xe_device * : XE_LOG_LOCATION_TYPE_DEVICE,		\
+		 struct pci_dev * : XE_LOG_LOCATION_TYPE_DEVICE,			\
+		 struct device * : XE_LOG_LOCATION_TYPE_DEVICE)
+
+#define xe_log_location(any) \
+	PREP_XE_LOG_LOCATION(xe_log_location_type(any), xe_any_id(any))
+
+/**
+ * xe_log_from() - Emit a structured SIGID log entry using @any pointer as location.
+ * @any: the &xe_device or &xe_tile or &xe_gt pointer this report relates to
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @sigid: signature identifier, see &enum xe_sigid
+ * @component: component identifer
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style format string
+ * @args: arguments for the @fmt format string
+ *
+ * The location used to emit SIGID entry will be based on the @any pointer type.
+ * See xe_log_emit() for more details.
+ */
+#define xe_log_from(any, cper_sev, sigid, component, data, len, fmt, args...) do {	\
+	typeof(any) ___any = (any);							\
+	xe_log_emit(xe_any_to_pdev(___any), (cper_sev), (sigid), (component),		\
+		    xe_log_location(___any), (data), (len), fmt, ##args);		\
+} while (0)
+
  #endif
#23 lore raw

PATCH v3 7/23 drm/xe/log: Add SIGID log helpers for location & severity

In reply to Michal Wajdeczko

There are only few CPER severity levels defined, add more helpers to avoid forcing developers to write full CPER severity name in every function call.

---
v2: fix argument list (Sashiko)

---
 drivers/gpu/drm/xe/xe_log.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/xe/xe_log.h +16 -0
index 510cedae6e14..916218560297 100644
@@ -69,4 +69,20 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
 		    xe_log_location(___any), (data), (len), fmt, ##args);		\
 } while (0)
 
+#define xe_log_from_fatal(any, sig, comp, data, len, fmt, args...) \
+	xe_log_from((any), CPER_SEV_FATAL, (sig), (comp), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_from_recoverable(any, sig, comp, data, len, fmt, args...) \
+	xe_log_from((any), CPER_SEV_RECOVERABLE, (sig), (comp), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_from_corrected(any, sig, comp, data, len, fmt, args...) \
+	xe_log_from((any), CPER_SEV_CORRECTED, (sig), (comp), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_from_info(any, sig, comp, data, len, fmt, args...) \
+	xe_log_from((any), CPER_SEV_INFORMATIONAL, (sig), (comp), \
+		    (data), (len), fmt, ##args)
+
 #endif
Signature · 1 line
2.47.1
Reviewed-by on v3 7/23
#24 lore raw

Re: [PATCH v3 07/23] drm/xe/log: Add SIGID log helpers for location & severity

Quoted 5 lines · Michal Wajdeczko

There are only few CPER severity levels defined, add more helpers to avoid forcing developers to write full CPER severity name in every function call.

LGTM,

Quoted 32 lines
Cc Rodrigo Vivi <[email protected]>

---
v2: fix argument list (Sashiko)

---
  drivers/gpu/drm/xe/xe_log.h | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
drivers/gpu/drm/xe/xe_log.h +16 -0
index 510cedae6e14..916218560297 100644
@@ -69,4 +69,20 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
  		    xe_log_location(___any), (data), (len), fmt, ##args);		\
  } while (0)
 
+#define xe_log_from_fatal(any, sig, comp, data, len, fmt, args...) \
+	xe_log_from((any), CPER_SEV_FATAL, (sig), (comp), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_from_recoverable(any, sig, comp, data, len, fmt, args...) \
+	xe_log_from((any), CPER_SEV_RECOVERABLE, (sig), (comp), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_from_corrected(any, sig, comp, data, len, fmt, args...) \
+	xe_log_from((any), CPER_SEV_CORRECTED, (sig), (comp), \
+		    (data), (len), fmt, ##args)
+
+#define xe_log_from_info(any, sig, comp, data, len, fmt, args...) \
+	xe_log_from((any), CPER_SEV_INFORMATIONAL, (sig), (comp), \
+		    (data), (len), fmt, ##args)
+
  #endif
#25 lore raw

PATCH v3 8/23 drm/xe/log: Add SIGID log helpers for components

In reply to Michal Wajdeczko

Our component list already defines relation between the component name, identified by the TAG, and its numerical identifier and the assigned SIGID. We can also already prepare location identifier based on the pointer type used to emit the log entry. Add helper that will prepare SIGID, COMPONENT and LOCATION parameters for xe_log_emit() using provided components TAG and the pointer.

---
Cc: Aravind Iddamsetty <[email protected]>
Cc: Mallesh Koujalagi <[email protected]>
---
v2: rebased/simplified (Michal)

---
 drivers/gpu/drm/xe/xe_log.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/xe/xe_log.h +18 -0
index 916218560297..c30db02950b0 100644
@@ -85,4 +85,22 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
 	xe_log_from((any), CPER_SEV_INFORMATIONAL, (sig), (comp), \
 		    (data), (len), fmt, ##args)
 
+/**
+ * xe_log_comp() - Emit a structured SIGID log entry on the component behalf.
+ * @any: the &xe_device or &xe_tile or &xe_gt pointer this report relates to
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @TAG: the component tag to use
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style free text format string (not a stable interface)
+ * @args: arguments for the @fmt format string
+ *
+ * The SIGID will be determined from the component's @TAG.
+ * The component identifier will be determined from the component's @TAG.
+ * The location used to emit SIGID entry will be based on the @any pointer type.
+ */
+#define xe_log_comp(any, cper_sev, TAG, data, len, fmt, args...) \
+	xe_log_from((any), (cper_sev), (int)XE_LOG_COMPONENT_##TAG##_SIGID, \
+		    XE_LOG_COMPONENT_##TAG, (data), (len), fmt, ##args)
+
 #endif
Signature · 1 line
2.47.1
Reviewed-by on v3 8/23
#26 lore raw

Re: [PATCH v3 08/23] drm/xe/log: Add SIGID log helpers for components

Quoted 8 lines · Michal Wajdeczko

Our component list already defines relation between the component name, identified by the TAG, and its numerical identifier and the assigned SIGID. We can also already prepare location identifier based on the pointer type used to emit the log entry. Add helper that will prepare SIGID, COMPONENT and LOCATION parameters for xe_log_emit() using provided components TAG and the pointer.

LGTM,

Quoted 37 lines
Cc Rodrigo Vivi <[email protected]>

---
Cc: Aravind Iddamsetty <[email protected]>
Cc: Mallesh Koujalagi <[email protected]>
---
v2: rebased/simplified (Michal)

---
  drivers/gpu/drm/xe/xe_log.h | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
drivers/gpu/drm/xe/xe_log.h +18 -0
index 916218560297..c30db02950b0 100644
@@ -85,4 +85,22 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
  	xe_log_from((any), CPER_SEV_INFORMATIONAL, (sig), (comp), \
  		    (data), (len), fmt, ##args)
 
+/**
+ * xe_log_comp() - Emit a structured SIGID log entry on the component behalf.
+ * @any: the &xe_device or &xe_tile or &xe_gt pointer this report relates to
+ * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...)
+ * @TAG: the component tag to use
+ * @data: pointer to the additional details, or ERR_PTR, or NULL if not applicable
+ * @len: length of the @data in bytes, or 0 if not applicable
+ * @fmt: printf-style free text format string (not a stable interface)
+ * @args: arguments for the @fmt format string
+ *
+ * The SIGID will be determined from the component's @TAG.
+ * The component identifier will be determined from the component's @TAG.
+ * The location used to emit SIGID entry will be based on the @any pointer type.
+ */
+#define xe_log_comp(any, cper_sev, TAG, data, len, fmt, args...) \
+	xe_log_from((any), (cper_sev), (int)XE_LOG_COMPONENT_##TAG##_SIGID, \
+		    XE_LOG_COMPONENT_##TAG, (data), (len), fmt, ##args)
+
  #endif
#27 lore raw

PATCH v3 9/23 drm/xe/log: Add SIGID log helpers for errno-only

In reply to Michal Wajdeczko

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.

---
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(+)
drivers/gpu/drm/xe/xe_log.h +52 -0
index c30db02950b0..5716fb7eeb31 100644
@@ -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)
+
 #endif
Signature · 1 line
2.47.1
Reviewed-by on v3 9/23
#28 lore raw

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

Quoted 73 lines · Michal Wajdeczko

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.

---
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(+)
drivers/gpu/drm/xe/xe_log.h +42 -0
index c30db02950b0..5716fb7eeb31 100644
@@ -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.

drivers/gpu/drm/xe/xe_log.h void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid, · line 157

Quoted 10 lines
drivers/gpu/drm/xe/xe_log.h +10 -0
+ * @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

Quoted 1 line
drivers/gpu/drm/xe/xe_log.h +0 -0
  #endif
#29 lore raw

PATCH v3 10/23 drm/xe/log: Add hardware error signatures

In reply to Michal Wajdeczko

Extend our error signatures definitions xe_sigid to cover also hardware-originated errors and make them distinguishable from initially defined software-initiated errors.

Cc Rodrigo Vivi <[email protected]>
Cc Yoni Levitt <[email protected]>

---
v2: update comment (Sashiko)

---
 drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +14 -2
index 99717fdf74a6..69cce4b45635 100644
@@ -159,14 +159,19 @@
  * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
  * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
  * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ * @XE_SIGID_HW: Generic hardware failure.
+ * @XE_SIGID_PCIE: PCIe interface errors.
+ * @XE_SIGID_DEVICE_MEMORY: Device memory errors
+ * @XE_SIGID_CORE_COMPUTE: Compute/shader core errors.
+ * @XE_SIGID_FABRIC: Fabric errors.
+ * @XE_SIGID_SOC_INTERNAL: SoC-internal errors.
  *
  * The situations the driver detects and reports in software. Values are
  * numbered sequentially, are only ever appended, and are never renumbered or
  * reused. The tag in brackets is the default resolution bucket (see the `Xe
  * Error Signatures (SIGID)`_ section).
  *
- * Firmware- and hardware-originated signatures are not listed here; they are
- * logged as reported by those layers.
+ * Firmware- and hardware-originated signatures are numbered separately.
  */
 enum xe_sigid {
 	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,
@@ -178,6 +183,13 @@ enum xe_sigid {
 	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
 	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
 	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+
+	XE_SIGID_HW			= INTEL_SIGID_GPU_XE_HARDWARE_START,
+	XE_SIGID_PCIE			= INTEL_SIGID_GPU_XE_HARDWARE_START + 1,
+	XE_SIGID_DEVICE_MEMORY		= INTEL_SIGID_GPU_XE_HARDWARE_START + 2,
+	XE_SIGID_CORE_COMPUTE		= INTEL_SIGID_GPU_XE_HARDWARE_START + 3,
+	XE_SIGID_FABRIC			= INTEL_SIGID_GPU_XE_HARDWARE_START + 4,
+	XE_SIGID_SOC_INTERNAL		= INTEL_SIGID_GPU_XE_HARDWARE_START + 5,
 };
 
 #endif
Signature · 1 line
2.47.1
#30 lore raw

Re: [PATCH v3 10/23] drm/xe/log: Add hardware error signatures

Quoted 18 lines · Michal Wajdeczko

Extend our error signatures definitions xe_sigid to cover also hardware-originated errors and make them distinguishable from initially defined software-initiated errors.

Cc Rodrigo Vivi <[email protected]>
Cc Yoni Levitt <[email protected]>

---
v2: update comment (Sashiko)

---
  drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
index 99717fdf74a6..69cce4b45635 100644

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 164

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +3 -0
@@ -159,14 +159,19 @@
   * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
   * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
   * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ * @XE_SIGID_HW: Generic hardware failure.
+ * @XE_SIGID_PCIE: PCIe interface errors.
+ * @XE_SIGID_DEVICE_MEMORY: Device memory errors

Add . @ end

Quoted 16 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +4 -2
+ * @XE_SIGID_CORE_COMPUTE: Compute/shader core errors.
+ * @XE_SIGID_FABRIC: Fabric errors.
+ * @XE_SIGID_SOC_INTERNAL: SoC-internal errors.
   *
   * The situations the driver detects and reports in software. Values are
   * numbered sequentially, are only ever appended, and are never renumbered or
   * reused. The tag in brackets is the default resolution bucket (see the `Xe
   * Error Signatures (SIGID)`_ section).
   *
- * Firmware- and hardware-originated signatures are not listed here; they are
- * logged as reported by those layers.
+ * Firmware- and hardware-originated signatures are numbered separately.
   */
  enum xe_sigid {
  	XE_SIGID_SW			= INTEL_SIGID_GPU_XE_SOFTWARE_START,

drivers/gpu/drm/xe/abi/xe_sigid_abi.h enum xe_sigid { · line 192

Quoted 10 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +7 -0
@@ -178,6 +183,13 @@ enum xe_sigid {
  	XE_SIGID_GT_TDR			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
  	XE_SIGID_MEM_FAULT		= INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
  	XE_SIGID_IO_BUS			= INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+
+	XE_SIGID_HW			= INTEL_SIGID_GPU_XE_HARDWARE_START,
+	XE_SIGID_PCIE			= INTEL_SIGID_GPU_XE_HARDWARE_START + 1,
+	XE_SIGID_DEVICE_MEMORY		= INTEL_SIGID_GPU_XE_HARDWARE_START + 2,
+	XE_SIGID_CORE_COMPUTE		= INTEL_SIGID_GPU_XE_HARDWARE_START + 3,
+	XE_SIGID_FABRIC			= INTEL_SIGID_GPU_XE_HARDWARE_START + 4,
+	XE_SIGID_SOC_INTERNAL		= INTEL_SIGID_GPU_XE_HARDWARE_START + 5,

Since we've resolution bucket for SW sigid so do we need resolution bucket for HW sigid as well? If so how are we going to put HW sigid to resolution bucket?

Thanks,

-/Mallesh

Quoted 3 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
  };
 
  #endif
#31 lore raw

Re: [PATCH v3 10/23] drm/xe/log: Add hardware error signatures

Quoted 47 lines · Koujalagi
Quoted 18 lines · Michal Wajdeczko

Extend our error signatures definitions xe_sigid to cover also hardware-originated errors and make them distinguishable from initially defined software-initiated errors.

Cc Rodrigo Vivi <[email protected]>
Cc Yoni Levitt <[email protected]>

---
v2: update comment (Sashiko)
---
  drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 16 ++++++++++++++--

  1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
index 99717fdf74a6..69cce4b45635 100644

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 164

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +3 -0
@@ -159,14 +159,19 @@
    * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
    * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
    * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ * @XE_SIGID_HW: Generic hardware failure.
+ * @XE_SIGID_PCIE: PCIe interface errors.
+ * @XE_SIGID_DEVICE_MEMORY: Device memory errors

Add . @ end

Quoted 20 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +5 -2
+ * @XE_SIGID_CORE_COMPUTE: Compute/shader core errors.
+ * @XE_SIGID_FABRIC: Fabric errors.
+ * @XE_SIGID_SOC_INTERNAL: SoC-internal errors.
    *
    * The situations the driver detects and reports in software. Values are
    * numbered sequentially, are only ever appended, and are never renumbered or
    * reused. The tag in brackets is the default resolution bucket (see the `Xe
    * Error Signatures (SIGID)`_ section).
    *
- * Firmware- and hardware-originated signatures are not listed here; they are
- * logged as reported by those layers.
+ * Firmware- and hardware-originated signatures are numbered separately.
    */
   enum xe_sigid {
       XE_SIGID_SW            = INTEL_SIGID_GPU_XE_SOFTWARE_START,
@@ -178,6 +183,13 @@ enum xe_sigid {
       XE_SIGID_GT_TDR            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
       XE_SIGID_MEM_FAULT        = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
       XE_SIGID_IO_BUS            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h enum xe_sigid { · line 192

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +6 -0
+    XE_SIGID_HW            = INTEL_SIGID_GPU_XE_HARDWARE_START,
+    XE_SIGID_PCIE            = INTEL_SIGID_GPU_XE_HARDWARE_START + 1,
+    XE_SIGID_DEVICE_MEMORY        = INTEL_SIGID_GPU_XE_HARDWARE_START + 2,
+    XE_SIGID_CORE_COMPUTE        = INTEL_SIGID_GPU_XE_HARDWARE_START + 3,
+    XE_SIGID_FABRIC            = INTEL_SIGID_GPU_XE_HARDWARE_START + 4,
+    XE_SIGID_SOC_INTERNAL        = INTEL_SIGID_GPU_XE_HARDWARE_START + 5,

Since we've resolution bucket for SW sigid so do we need resolution bucket for HW sigid as well? If so how are we going to put HW sigid to resolution bucket?

there was discussion about this already [1]

and I guess we can add [COLLECT] here as an overall recommendation for all HW SIGIDs,
as likely all such errors will sooner or later be reported as separate SW incidents with its own resolutions and official documentation will have more detailed recommendations (out of our scope here)

[1] https://patchwork.freedesktop.org/patch/742246/?series=171022&rev=1#comment_1368419

Quoted 7 lines

Thanks,

-/Mallesh

Quoted 2 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
   };
     #endif
#32 lore raw

Re: [PATCH v3 10/23] drm/xe/log: Add hardware error signatures

Quoted 46 lines · Michal Wajdeczko
Quoted 44 lines · Koujalagi
Quoted 18 lines · Michal Wajdeczko

Extend our error signatures definitions xe_sigid to cover also hardware-originated errors and make them distinguishable from initially defined software-initiated errors.

Cc Rodrigo Vivi <[email protected]>
Cc Yoni Levitt <[email protected]>

---
v2: update comment (Sashiko)

---
   drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 16 ++++++++++++++--
   1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
index 99717fdf74a6..69cce4b45635 100644

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 164

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +3 -0
@@ -159,14 +159,19 @@
    * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
    * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
    * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ * @XE_SIGID_HW: Generic hardware failure.
+ * @XE_SIGID_PCIE: PCIe interface errors.
+ * @XE_SIGID_DEVICE_MEMORY: Device memory errors

Add . @ end

Quoted 18 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +4 -2
+ * @XE_SIGID_CORE_COMPUTE: Compute/shader core errors.
+ * @XE_SIGID_FABRIC: Fabric errors.
+ * @XE_SIGID_SOC_INTERNAL: SoC-internal errors.
    *
    * The situations the driver detects and reports in software. Values are
    * numbered sequentially, are only ever appended, and are never renumbered or
    * reused. The tag in brackets is the default resolution bucket (see the `Xe
    * Error Signatures (SIGID)`_ section).
    *
- * Firmware- and hardware-originated signatures are not listed here; they are
- * logged as reported by those layers.
+ * Firmware- and hardware-originated signatures are numbered separately.
    */
   enum xe_sigid {
       XE_SIGID_SW            = INTEL_SIGID_GPU_XE_SOFTWARE_START,
@@ -178,6 +183,13 @@ enum xe_sigid {
       XE_SIGID_GT_TDR            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
       XE_SIGID_MEM_FAULT        = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h enum xe_sigid { · line 192

Quoted 8 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +7 -0
       XE_SIGID_IO_BUS            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+
+    XE_SIGID_HW            = INTEL_SIGID_GPU_XE_HARDWARE_START,
+    XE_SIGID_PCIE            = INTEL_SIGID_GPU_XE_HARDWARE_START + 1,
+    XE_SIGID_DEVICE_MEMORY        = INTEL_SIGID_GPU_XE_HARDWARE_START + 2,
+    XE_SIGID_CORE_COMPUTE        = INTEL_SIGID_GPU_XE_HARDWARE_START + 3,
+    XE_SIGID_FABRIC            = INTEL_SIGID_GPU_XE_HARDWARE_START + 4,
+    XE_SIGID_SOC_INTERNAL        = INTEL_SIGID_GPU_XE_HARDWARE_START + 5,

Nit: Maybe retain the same order as firmware

Quoted 1 line
Quoted 1 line

Since we've resolution bucket for SW sigid so do we need resolution bucket for HW sigid as well? If so how are we going to put HW sigid to resolution bucket?

We shouldn't be having resolution buckets here. This is just the high level class.
For ex: Soc internal has multiple recoveries. I think the decision in 02/23 was drop resolution buckets.

Thanks
Riana

Quoted 14 lines

there was discussion about this already [1]

and I guess we can add [COLLECT] here as an overall recommendation for all HW SIGIDs,
as likely all such errors will sooner or later be reported as separate SW incidents with its own resolutions and official documentation will have more detailed recommendations (out of our scope here)

[1] https://patchwork.freedesktop.org/patch/742246/?series=171022&rev=1#comment_1368419

Quoted 6 lines

Thanks,

-/Mallesh

Quoted 2 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
   };
     #endif
#33 lore raw

Re: [PATCH v3 10/23] drm/xe/log: Add hardware error signatures

Quoted 50 lines · Riana
Quoted 48 lines · Michal Wajdeczko
Quoted 46 lines · Koujalagi
Quoted 18 lines · Michal Wajdeczko

Extend our error signatures definitions xe_sigid to cover also hardware-originated errors and make them distinguishable from initially defined software-initiated errors.

Cc Rodrigo Vivi <[email protected]>
Cc Yoni Levitt <[email protected]>

---
v2: update comment (Sashiko)
---
   drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 16 ++++++++++++++--

   1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
index 99717fdf74a6..69cce4b45635 100644

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 164

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +3 -0
@@ -159,14 +159,19 @@
     * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
     * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
     * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ * @XE_SIGID_HW: Generic hardware failure.
+ * @XE_SIGID_PCIE: PCIe interface errors.
+ * @XE_SIGID_DEVICE_MEMORY: Device memory errors

Add . @ end

Quoted 20 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +5 -2
+ * @XE_SIGID_CORE_COMPUTE: Compute/shader core errors.
+ * @XE_SIGID_FABRIC: Fabric errors.
+ * @XE_SIGID_SOC_INTERNAL: SoC-internal errors.
     *
     * The situations the driver detects and reports in software. Values are
     * numbered sequentially, are only ever appended, and are never renumbered or
     * reused. The tag in brackets is the default resolution bucket (see the `Xe
     * Error Signatures (SIGID)`_ section).
     *
- * Firmware- and hardware-originated signatures are not listed here; they are
- * logged as reported by those layers.
+ * Firmware- and hardware-originated signatures are numbered separately.
     */
    enum xe_sigid {
        XE_SIGID_SW            = INTEL_SIGID_GPU_XE_SOFTWARE_START,
@@ -178,6 +183,13 @@ enum xe_sigid {
        XE_SIGID_GT_TDR            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
        XE_SIGID_MEM_FAULT        = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
        XE_SIGID_IO_BUS            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h enum xe_sigid { · line 192

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +6 -0
+    XE_SIGID_HW            = INTEL_SIGID_GPU_XE_HARDWARE_START,
+    XE_SIGID_PCIE            = INTEL_SIGID_GPU_XE_HARDWARE_START + 1,
+    XE_SIGID_DEVICE_MEMORY        = INTEL_SIGID_GPU_XE_HARDWARE_START + 2,
+    XE_SIGID_CORE_COMPUTE        = INTEL_SIGID_GPU_XE_HARDWARE_START + 3,
+    XE_SIGID_FABRIC            = INTEL_SIGID_GPU_XE_HARDWARE_START + 4,
+    XE_SIGID_SOC_INTERNAL        = INTEL_SIGID_GPU_XE_HARDWARE_START + 5,

Nit: Maybe retain the same order as firmware

do you mean the same order as in XE_LOG_LOCATION and XE_RAS_COMP? but there is a gap (no 3) and currently we say SIGIDs are numbered sequentially and only appended ...

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Since we've resolution bucket for SW sigid so do we need resolution bucket for HW sigid as well? If so how are we going to put HW sigid to resolution bucket?

We shouldn't be having resolution buckets here. This is just the high level class.
For ex: Soc internal has multiple recoveries. I think the decision in 02/23 was drop resolution buckets.

that's correct, in v4 there will be no [resolution backet] for any SIGID

Quoted 18 lines

Thanks
Riana

Quoted 14 lines

there was discussion about this already [1]

and I guess we can add [COLLECT] here as an overall recommendation for all HW SIGIDs,
as likely all such errors will sooner or later be reported as separate SW incidents with its own resolutions and official documentation will have more detailed recommendations (out of our scope here)

[1] https://patchwork.freedesktop.org/patch/742246/?series=171022&rev=1#comment_1368419

Quoted 6 lines

Thanks,

-/Mallesh

Quoted 2 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
    };
      #endif
#34 lore raw

Re: [PATCH v3 10/23] drm/xe/log: Add hardware error signatures

Quoted 43 lines · Michal Wajdeczko
Quoted 41 lines · Riana
Quoted 40 lines · Michal Wajdeczko
Quoted 39 lines · Koujalagi
Quoted 18 lines · Michal Wajdeczko

Extend our error signatures definitions xe_sigid to cover also hardware-originated errors and make them distinguishable from initially defined software-initiated errors.

Cc Rodrigo Vivi <[email protected]>
Cc Yoni Levitt <[email protected]>

---
v2: update comment (Sashiko)

---
    drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 16 ++++++++++++++--
    1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
index 99717fdf74a6..69cce4b45635 100644

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 164

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +3 -0
@@ -159,14 +159,19 @@
     * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
     * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
     * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ * @XE_SIGID_HW: Generic hardware failure.
+ * @XE_SIGID_PCIE: PCIe interface errors.
+ * @XE_SIGID_DEVICE_MEMORY: Device memory errors

Add . @ end

Quoted 13 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +4 -2
+ * @XE_SIGID_CORE_COMPUTE: Compute/shader core errors.
+ * @XE_SIGID_FABRIC: Fabric errors.
+ * @XE_SIGID_SOC_INTERNAL: SoC-internal errors.
     *
     * The situations the driver detects and reports in software. Values are
     * numbered sequentially, are only ever appended, and are never renumbered or
     * reused. The tag in brackets is the default resolution bucket (see the `Xe
     * Error Signatures (SIGID)`_ section).
     *
- * Firmware- and hardware-originated signatures are not listed here; they are
- * logged as reported by those layers.
+ * Firmware- and hardware-originated signatures are numbered separately.
     */
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h enum xe_sigid { · line 187

Quoted 8 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +2 -0
    enum xe_sigid {
        XE_SIGID_SW            = INTEL_SIGID_GPU_XE_SOFTWARE_START,
@@ -178,6 +183,13 @@ enum xe_sigid {
        XE_SIGID_GT_TDR            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
        XE_SIGID_MEM_FAULT        = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
        XE_SIGID_IO_BUS            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+
+    XE_SIGID_HW            = INTEL_SIGID_GPU_XE_HARDWARE_START,

What does XE_SIGID_HW indicate and how will this be used? Why not just start PCIE from the hardware_start?

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h enum xe_sigid { · line 192

Quoted 5 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +5 -0
+    XE_SIGID_PCIE            = INTEL_SIGID_GPU_XE_HARDWARE_START + 1,
+    XE_SIGID_DEVICE_MEMORY        = INTEL_SIGID_GPU_XE_HARDWARE_START + 2,
+    XE_SIGID_CORE_COMPUTE        = INTEL_SIGID_GPU_XE_HARDWARE_START + 3,
+    XE_SIGID_FABRIC            = INTEL_SIGID_GPU_XE_HARDWARE_START + 4,
+    XE_SIGID_SOC_INTERNAL        = INTEL_SIGID_GPU_XE_HARDWARE_START + 5,

Nit: Maybe retain the same order as firmware

do you mean the same order as in XE_LOG_LOCATION and XE_RAS_COMP? but there is a gap (no 3) and currently we say SIGIDs are numbered sequentially and only appended ...

Without adding a gap. It's a nit. so upto you

Thanks
Riana

Quoted 22 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Since we've resolution bucket for SW sigid so do we need resolution bucket for HW sigid as well? If so how are we going to put HW sigid to resolution bucket?

We shouldn't be having resolution buckets here. This is just the high level class.
For ex: Soc internal has multiple recoveries. I think the decision in 02/23 was drop resolution buckets.

that's correct, in v4 there will be no [resolution backet] for any SIGID

Quoted 17 lines

Thanks
Riana

Quoted 14 lines

there was discussion about this already [1]

and I guess we can add [COLLECT] here as an overall recommendation for all HW SIGIDs,
as likely all such errors will sooner or later be reported as separate SW incidents with its own resolutions and official documentation will have more detailed recommendations (out of our scope here)

[1] https://patchwork.freedesktop.org/patch/742246/?series=171022&rev=1#comment_1368419

Quoted 6 lines

Thanks,

-/Mallesh

Quoted 2 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
    };
      #endif
#35 lore raw

Re: [PATCH v3 10/23] drm/xe/log: Add hardware error signatures

Quoted 47 lines · Riana
Quoted 45 lines · Michal Wajdeczko
Quoted 43 lines · Riana
Quoted 42 lines · Michal Wajdeczko
Quoted 41 lines · Koujalagi
Quoted 18 lines · Michal Wajdeczko

Extend our error signatures definitions xe_sigid to cover also hardware-originated errors and make them distinguishable from initially defined software-initiated errors.

Cc Rodrigo Vivi <[email protected]>
Cc Yoni Levitt <[email protected]>

---
v2: update comment (Sashiko)
---
    drivers/gpu/drm/xe/abi/xe_sigid_abi.h | 16 ++++++++++++++--

    1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
index 99717fdf74a6..69cce4b45635 100644

drivers/gpu/drm/xe/abi/xe_sigid_abi.h line 164

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +3 -0
@@ -159,14 +159,19 @@
      * @XE_SIGID_GT_TDR: Engine hang / timeout detection and recovery (reset). [RETRY]
      * @XE_SIGID_MEM_FAULT: VM bind, page fault or GTT fault. [COLLECT]
      * @XE_SIGID_IO_BUS: Runtime PCIe / IOMMU / MMIO access fault. [RECOVER]
+ * @XE_SIGID_HW: Generic hardware failure.
+ * @XE_SIGID_PCIE: PCIe interface errors.
+ * @XE_SIGID_DEVICE_MEMORY: Device memory errors

Add . @ end

Quoted 15 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +4 -2
+ * @XE_SIGID_CORE_COMPUTE: Compute/shader core errors.
+ * @XE_SIGID_FABRIC: Fabric errors.
+ * @XE_SIGID_SOC_INTERNAL: SoC-internal errors.
      *
      * The situations the driver detects and reports in software. Values are
      * numbered sequentially, are only ever appended, and are never renumbered or
      * reused. The tag in brackets is the default resolution bucket (see the `Xe
      * Error Signatures (SIGID)`_ section).
      *
- * Firmware- and hardware-originated signatures are not listed here; they are
- * logged as reported by those layers.
+ * Firmware- and hardware-originated signatures are numbered separately.
      */
     enum xe_sigid {
         XE_SIGID_SW            = INTEL_SIGID_GPU_XE_SOFTWARE_START,
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/xe/abi/xe_sigid_abi.h enum xe_sigid { · line 187

Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +2 -0
@@ -178,6 +183,13 @@ enum xe_sigid {
         XE_SIGID_GT_TDR            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 6,
         XE_SIGID_MEM_FAULT        = INTEL_SIGID_GPU_XE_SOFTWARE_START + 7,
         XE_SIGID_IO_BUS            = INTEL_SIGID_GPU_XE_SOFTWARE_START + 8,
+
+    XE_SIGID_HW            = INTEL_SIGID_GPU_XE_HARDWARE_START,

What does XE_SIGID_HW indicate and how will this be used? Why not just start PCIE from the hardware_start?

I just wanted to have something more generic to cover all unnamed HW parts which can be used if other HW SIGIDs does not fit or we would like to report HW error from the SW POV

it is similar to SIGID_SW = 100, which we use for general software problems, within 1xx range of all software signatures

so here whole 2xx range is about hardware signatures, where 201, 202, .. are just more specific HW areas

something like HTTP codes: 4xx (client errors) vs 5xx (server errors)

in fact, I was wondering whether we should reserve dedicated range for firmware related codes, like 3xx, not just single 104 or 105

maybe we can return to this idea once there will be a push to make it more generic across drm/kernel

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +5 -0
+    XE_SIGID_PCIE            = INTEL_SIGID_GPU_XE_HARDWARE_START + 1,
+    XE_SIGID_DEVICE_MEMORY        = INTEL_SIGID_GPU_XE_HARDWARE_START + 2,
+    XE_SIGID_CORE_COMPUTE        = INTEL_SIGID_GPU_XE_HARDWARE_START + 3,
+    XE_SIGID_FABRIC            = INTEL_SIGID_GPU_XE_HARDWARE_START + 4,
+    XE_SIGID_SOC_INTERNAL        = INTEL_SIGID_GPU_XE_HARDWARE_START + 5,
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Nit: Maybe retain the same order as firmware

do you mean the same order as in XE_LOG_LOCATION and XE_RAS_COMP? but there is a gap (no 3) and currently we say SIGIDs are numbered sequentially and only appended ...

Without adding a gap. It's a nit. so upto you

hidden mismatch due to gap might be error prone as one could think that there is a full match between SIGID and COMP

so IMO it's better to make them be different ;)

Quoted 27 lines

Thanks
Riana

Quoted 22 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Since we've resolution bucket for SW sigid so do we need resolution bucket for HW sigid as well? If so how are we going to put HW sigid to resolution bucket?

We shouldn't be having resolution buckets here. This is just the high level class.
For ex: Soc internal has multiple recoveries. I think the decision in 02/23 was drop resolution buckets.

that's correct, in v4 there will be no [resolution backet] for any SIGID

Quoted 17 lines

Thanks
Riana

Quoted 14 lines

there was discussion about this already [1]

and I guess we can add [COLLECT] here as an overall recommendation for all HW SIGIDs,
as likely all such errors will sooner or later be reported as separate SW incidents with its own resolutions and official documentation will have more detailed recommendations (out of our scope here)

[1] https://patchwork.freedesktop.org/patch/742246/?series=171022&rev=1#comment_1368419

Quoted 6 lines

Thanks,

-/Mallesh

Quoted 2 lines
drivers/gpu/drm/xe/abi/xe_sigid_abi.h +0 -0
     };
       #endif
#36 lore raw

PATCH v3 12/23 drm/xe/ras: Check RAS and LOG component definitions

In reply to Michal Wajdeczko

While not strictly required, we want to make sure that components definitions used by the RAS firmware are in the same fixed relation with HW components definitions used by the LOG infrastructure to allow code simplification. Add static asserts to enforce that.

Cc Rodrigo Vivi <[email protected]>
Cc Aravind Iddamsetty <[email protected]>

---
Cc: Mallesh Koujalagi <[email protected]>

---
 drivers/gpu/drm/xe/xe_ras.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/xe/xe_ras.c +11 -0
index a31e06b8aa67..56c0c31e46fb 100644
@@ -5,6 +5,7 @@
 
 #include "xe_device.h"
 #include "xe_drm_ras.h"
+#include "xe_log.h"
 #include "xe_pm.h"
 #include "xe_printk.h"
 #include "xe_ras.h"
@@ -45,6 +46,16 @@ enum xe_ras_component {
 	XE_RAS_COMP_MAX
 };
 
+#define CHECK_COMPONENT(RAS_COMP, LOG_COMP) \
+	static_assert(MAKE_XE_LOG_COMPONENT(HARDWARE, (RAS_COMP)) == (LOG_COMP))
+	/* make sure components definitions maintain stable relation */
+	CHECK_COMPONENT(XE_RAS_COMP_DEVICE_MEMORY, XE_LOG_COMPONENT_DEVMEM);
+	CHECK_COMPONENT(XE_RAS_COMP_CORE_COMPUTE, XE_LOG_COMPONENT_HWCORE);
+	CHECK_COMPONENT(XE_RAS_COMP_PCIE, XE_LOG_COMPONENT_PCIE);
+	CHECK_COMPONENT(XE_RAS_COMP_FABRIC, XE_LOG_COMPONENT_FABRIC);
+	CHECK_COMPONENT(XE_RAS_COMP_SOC_INTERNAL, XE_LOG_COMPONENT_SOC);
+#undef CHECK_COMPONENT
+
 /* RAS response status codes */
 enum xe_ras_response_status {
 	XE_RAS_STATUS_SUCCESS = 0,
Signature · 1 line
2.47.1
Reviewed-by on v3 12/23
#37 lore raw

Re: [PATCH v3 12/23] drm/xe/ras: Check RAS and LOG component definitions

Quoted 6 lines · Michal Wajdeczko

While not strictly required, we want to make sure that components definitions used by the RAS firmware are in the same fixed relation with HW components definitions used by the LOG infrastructure to allow code simplification. Add static asserts to enforce that.

LGTM,

Quoted 37 lines
Cc Rodrigo Vivi <[email protected]>
Cc Aravind Iddamsetty <[email protected]>

---
Cc: Mallesh Koujalagi <[email protected]>

---
  drivers/gpu/drm/xe/xe_ras.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/xe/xe_ras.c +11 -0
index a31e06b8aa67..56c0c31e46fb 100644
@@ -5,6 +5,7 @@
 
  #include "xe_device.h"
  #include "xe_drm_ras.h"
+#include "xe_log.h"
  #include "xe_pm.h"
  #include "xe_printk.h"
  #include "xe_ras.h"
@@ -45,6 +46,16 @@ enum xe_ras_component {
  	XE_RAS_COMP_MAX
  };
 
+#define CHECK_COMPONENT(RAS_COMP, LOG_COMP) \
+	static_assert(MAKE_XE_LOG_COMPONENT(HARDWARE, (RAS_COMP)) == (LOG_COMP))
+	/* make sure components definitions maintain stable relation */
+	CHECK_COMPONENT(XE_RAS_COMP_DEVICE_MEMORY, XE_LOG_COMPONENT_DEVMEM);
+	CHECK_COMPONENT(XE_RAS_COMP_CORE_COMPUTE, XE_LOG_COMPONENT_HWCORE);
+	CHECK_COMPONENT(XE_RAS_COMP_PCIE, XE_LOG_COMPONENT_PCIE);
+	CHECK_COMPONENT(XE_RAS_COMP_FABRIC, XE_LOG_COMPONENT_FABRIC);
+	CHECK_COMPONENT(XE_RAS_COMP_SOC_INTERNAL, XE_LOG_COMPONENT_SOC);
+#undef CHECK_COMPONENT
+
  /* RAS response status codes */
  enum xe_ras_response_status {
  	XE_RAS_STATUS_SUCCESS = 0,
#38 lore raw

PATCH v3 13/23 drm/xe/kunit: Setup driver data in the test device

In reply to Michal Wajdeczko

While we have helpers pdev_to_xe_device() and kdev_to_xe_device() to obtain the xe_device pointer from the struct device pointer or from the struct pci_dev pointer, we must also setup the drm_device pointer as driver data in the device to make them work.

---
 drivers/gpu/drm/xe/tests/xe_kunit_helpers.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/xe/tests/xe_kunit_helpers.c +4 -0
index bc5156966ce9..27740b40c8ae 100644
@@ -39,6 +39,10 @@ struct xe_device *xe_kunit_helper_alloc_xe_device(struct kunit *test,
 					       struct xe_device,
 					       drm, DRIVER_GEM);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xe);
+
+	dev_set_drvdata(xe->drm.dev, &xe->drm);
+	KUNIT_ASSERT_PTR_EQ(test, xe, kdev_to_xe_device(dev));
+
 	return xe;
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_kunit_helper_alloc_xe_device);
Signature · 1 line
2.47.1
Reviewed-by on v3 13/23
#39 lore raw

Re: [PATCH v3 13/23] drm/xe/kunit: Setup driver data in the test device

Quoted 6 lines · Michal Wajdeczko

While we have helpers pdev_to_xe_device() and kdev_to_xe_device() to obtain the xe_device pointer from the struct device pointer or from the struct pci_dev pointer, we must also setup the drm_device pointer as driver data in the device to make them work.

LGTM,

Quoted 19 lines
---
  drivers/gpu/drm/xe/tests/xe_kunit_helpers.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/xe/tests/xe_kunit_helpers.c +4 -0
index bc5156966ce9..27740b40c8ae 100644
@@ -39,6 +39,10 @@ struct xe_device *xe_kunit_helper_alloc_xe_device(struct kunit *test,
  					       struct xe_device,
  					       drm, DRIVER_GEM);
  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xe);
+
+	dev_set_drvdata(xe->drm.dev, &xe->drm);
+	KUNIT_ASSERT_PTR_EQ(test, xe, kdev_to_xe_device(dev));
+
  	return xe;
  }
  EXPORT_SYMBOL_IF_KUNIT(xe_kunit_helper_alloc_xe_device);
#40 lore raw

PATCH v3 14/23 drm/xe/tests: Add Kunit tests for xe_log

In reply to Michal Wajdeczko

All dmesg log lines generated by the xe_log() functions or helper macros are expected to have a stable format. Add tests to verify that generated output is not accidentally changed. Add demo pseudo tests to show how to use all variants of the xe_log() helpers.

---
Cc: Aravind Iddamsetty <[email protected]>
Cc: Yoni Levitt <[email protected]>
Cc: Mallesh Koujalagi <[email protected]>
---
v2: less demos/more tests (Michal)
v3: expect tile.id is already set (Michal)
add invalid params test (Michal)

---
 drivers/gpu/drm/xe/tests/xe_log_kunit.c | 545 ++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_log.c             |  11 +
 2 files changed, 556 insertions(+)
 create mode 100644 drivers/gpu/drm/xe/tests/xe_log_kunit.c
drivers/gpu/drm/xe/tests/xe_log_kunit.c new file +545 -0
new file mode 100644
index 000000000000..27f3c322cc26
@@ -0,0 +1,545 @@
+// SPDX-License-Identifier: GPL-2.0 AND MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include <kunit/static_stub.h>
+#include <kunit/test.h>
+#include <kunit/test-bug.h>
+
+#include "tests/xe_kunit_helpers.h"
+#include "tests/xe_pci_test.h"
+#include "xe_device.h"
+#include "xe_log.h"
+
+static void nop_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+}
+
+static void nop_emit_cper(struct pci_dev *pdev, int cper_sev,
+			  enum xe_sigid sigid, u32 component, u32 location,
+			  const void *data, size_t len, struct va_format *vaf)
+{
+}
+
+static const char *component_name(u32 component)
+{
+	switch (component) {
+#define make_component_tag_case(_CLASS, _ID, _TAG, _SIG, _NAME) \
+	case XE_LOG_COMPONENT_##_TAG: return _NAME;
+	DEFINE_XE_LOG_COMPONENTS(make_component_tag_case)
+#undef make_component_tag_case
+	}
+	return component ? "???" : "";
+}
+
+static const char *location_type(u32 location)
+{
+	u32 type = FIELD_GET(XE_LOG_LOCATION_TYPE_MASK, location);
+
+	return type == XE_LOG_LOCATION_TYPE_DEVICE ? "DEVICE" :
+	       type == XE_LOG_LOCATION_TYPE_TILE ? "TILE" :
+	       type == XE_LOG_LOCATION_TYPE_GT ? "GT" :
+	       location ? "?" : "";
+}
+
+static void fake_emit_cper(struct pci_dev *pdev, int cper_sev,
+			   enum xe_sigid sigid, u32 component, u32 location,
+			   const void *data, size_t len, struct va_format *vaf)
+{
+	char msg[64];
+	int n, err;
+
+	pr_info("\n");
+	pr_info("CPER SEV=%u SIGID=%u\n", cper_sev, sigid);
+	pr_info("CPER DEVICE=%s\n", dev_name(&pdev->dev));
+	if (location)
+		pr_info("CPER LOCATION=%#x \t# %s.%u\n",
+			location, location_type(location),
+			FIELD_GET(XE_LOG_LOCATION_ID_MASK, location));
+	if (component)
+		pr_info("CPER COMPONENT=%#x \t# %s\n",
+			component, component_name(component));
+	if (IS_ERR(data)) {
+		err = PTR_ERR(data);
+		pr_info("CPER ERR=%d \t\t# %pe\n", err, data);
+	} else if (len) {
+		print_hex_dump(KERN_INFO, "CPER BIN=", DUMP_PREFIX_OFFSET,
+			       16, 1, data, len, false);
+	}
+
+	n = vscnprintf(msg, sizeof(msg), vaf->fmt, *vaf->va);
+	print_hex_dump(KERN_INFO, "CPER MSG=", DUMP_PREFIX_OFFSET, 16, 1, msg, n, true);
+	pr_info("CPER END\n");
+}
+
+static const u8 blob[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
+static const u8 dead[] = { 0xde, 0xad, 0xbe, 0xef };
+
+static struct xe_tile *to_tile_safe(struct xe_device *xe)
+{
+	return xe ? &xe->tiles[1] : NULL;
+}
+
+static struct xe_gt *to_gt_safe(struct xe_device *xe)
+{
+	return xe ? to_tile_safe(xe)->primary_gt : NULL;
+}
+
+static struct pci_dev *to_pdev_safe(struct xe_device *xe)
+{
+	return xe ? xe_any_to_pdev(xe) : NULL;
+}
+
+static void demo(struct xe_device *xe)
+{
+	struct pci_dev *pdev = xe_any_to_pdev(xe);
+	struct xe_tile *tile = to_tile_safe(xe);
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	/* SW errno */
+	xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PROBE,
+		    XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+		    ERR_PTR(-ENODEV), 0, "testing %s signature\n", "software");
+
+	xe_log_err(tile, PROBE, -ENODEV, "testing %s signature\n", "software");
+	xe_log_err_corrected(gt, PROBE, -ENODEV, "testing %s signature\n", "software");
+	xe_log_info(gt, PROBE, "testing %s signature\n", "software");
+
+	/* HW data */
+	xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PCIE,
+		    XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+		    blob, sizeof(blob), "testing %s signature\n", "HARDWARE");
+	xe_log_emit_recoverable(pdev, XE_SIGID_FABRIC,
+				XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				blob, sizeof(blob), "testing %s signature\n", "HARDWARE");
+	xe_log_from_corrected(tile, XE_SIGID_DEVICE_MEMORY, XE_LOG_COMPONENT_NONE,
+			      blob, sizeof(blob), "testing %s signature\n", "HARDWARE");
+	xe_log_from_info(gt, XE_SIGID_CORE_COMPUTE, XE_LOG_COMPONENT_NONE,
+			 blob, sizeof(blob), "testing %s signature\n", "HARDWARE");
+}
+
+static void demo_dmesg(struct kunit *test)
+{
+	kunit_activate_static_stub(test, log_emit_cper, nop_emit_cper);
+	demo(test->priv);
+}
+
+static void demo_cper(struct kunit *test)
+{
+	kunit_activate_static_stub(test, log_emit_cper, fake_emit_cper);
+	kunit_activate_static_stub(test, log_dmesg_vprintk, nop_dmesg_vprintk);
+	demo(test->priv);
+}
+
+static const char *test_fatal(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_fatal(pdev, XE_SIGID_PROBE,
+				  XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				  NULL, 0, "testing %d\n", 123);
+	return "SIGID=101 FATAL testing 123\n";
+}
+
+static const char *test_fatal_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_from_fatal(tile, XE_SIGID_PROBE, XE_LOG_COMPONENT_NONE,
+				  ERR_PTR(-ENODEV), 0, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: testing 123\n";
+}
+
+static const char *test_fatal_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_from_fatal(gt, XE_SIGID_PROBE, XE_LOG_COMPONENT_NONE,
+				  ERR_PTR(-ENODEV), 0, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: GT1: testing 123\n";
+}
+
+static const char *test_fatal_comp(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_err_fatal(pdev, PROBE, -ENODEV, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) PROBE: testing 123\n";
+}
+
+static const char *test_fatal_comp_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_err_fatal(tile, PROBE, -ENODEV, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: PROBE: testing 123\n";
+}
+
+static const char *test_fatal_comp_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_err_fatal(gt, PROBE, -ENODEV, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: GT1: PROBE: testing 123\n";
+}
+
+static const char *test_fatal_all(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (pdev)
+		xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PROBE,
+			    XE_LOG_COMPONENT_PROBE, MAKE_XE_LOG_LOCATION(GT, gt->info.id),
+			    ERR_PTR(-ENODEV), 0, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: GT1: PROBE: testing 123\n";
+}
+
+static const char *test_recoverable(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_recoverable(pdev, XE_SIGID_RUNTIME_FW,
+					XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+					ERR_PTR(-EIO), 0, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) testing 123\n";
+}
+
+static const char *test_recoverable_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_from_recoverable(tile, XE_SIGID_RUNTIME_FW, XE_LOG_COMPONENT_NONE,
+					ERR_PTR(-EIO), 0, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: testing 123\n";
+}
+
+static const char *test_recoverable_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_from_recoverable(gt, XE_SIGID_RUNTIME_FW, XE_LOG_COMPONENT_NONE,
+					ERR_PTR(-EIO), 0, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: GT1: testing 123\n";
+}
+
+static const char *test_recoverable_comp(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_err(pdev, GUC, -EIO, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) GUC: testing 123\n";
+}
+
+static const char *test_recoverable_comp_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_err(tile, GUC, -EIO, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: GUC: testing 123\n";
+}
+
+static const char *test_recoverable_comp_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_err(gt, GUC, -EIO, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: GT1: GUC: testing 123\n";
+}
+
+static const char *test_recoverable_all(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (pdev)
+		xe_log_emit(pdev, CPER_SEV_RECOVERABLE, XE_SIGID_RUNTIME_FW,
+			    XE_LOG_COMPONENT_GUC, MAKE_XE_LOG_LOCATION(GT, gt->info.id),
+			    ERR_PTR(-EIO), 0, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: GT1: GUC: testing 123\n";
+}
+
+static const char *test_info(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit(pdev, CPER_SEV_INFORMATIONAL, XE_SIGID_DEVICE_FW,
+			    XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+			    NULL, 0, "testing %d\n", 123);
+	return "SIGID=105 testing 123\n";
+}
+
+static const char *test_info_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_from_info(tile, XE_SIGID_DEVICE_FW, XE_LOG_COMPONENT_NONE,
+				 NULL, 0, "testing %d\n", 123);
+	return "SIGID=105 Tile1: testing 123\n";
+}
+
+static const char *test_info_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_from_info(gt, XE_SIGID_DEVICE_FW, XE_LOG_COMPONENT_NONE,
+				 NULL, 0, "testing %d\n", 123);
+	return "SIGID=105 Tile1: GT1: testing 123\n";
+}
+
+static const char *test_info_comp(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_info(pdev, PCODE, "testing %d\n", 123);
+	return "SIGID=105 PCODE: testing 123\n";
+}
+
+static const char *test_info_comp_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_info(tile, PCODE, "testing %d\n", 123);
+	return "SIGID=105 Tile1: PCODE: testing 123\n";
+}
+
+static const char *test_info_comp_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_info(gt, PCODE, "testing %d\n", 123);
+	return "SIGID=105 Tile1: GT1: PCODE: testing 123\n";
+}
+
+static const char *test_info_all(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (pdev)
+		xe_log_emit(pdev, CPER_SEV_INFORMATIONAL, XE_SIGID_DEVICE_FW,
+			    XE_LOG_COMPONENT_PCODE, MAKE_XE_LOG_LOCATION(GT, gt->info.id),
+			    NULL, 0, "testing %d\n", 123);
+	return "SIGID=105 Tile1: GT1: PCODE: testing 123\n";
+}
+
+static const char *test_hw_fatal(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_fatal(pdev, XE_SIGID_PCIE,
+				  XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				  dead, sizeof(dead), "testing %d\n", 123);
+	return "SIGID=201 FATAL (deadbeef) " HW_ERR "testing 123\n";
+}
+
+static const char *test_hw_recoverable(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_recoverable(pdev, XE_SIGID_DEVICE_MEMORY,
+					XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+					dead, sizeof(dead), "testing %d\n", 123);
+	return "SIGID=202 (deadbeef) " HW_ERR "testing 123\n";
+}
+
+static const char *test_hw_corrected(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_corrected(pdev, XE_SIGID_DEVICE_MEMORY,
+				      XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				      dead, sizeof(dead), "testing %d\n", 123);
+	return "SIGID=202 CORRECTED (deadbeef) " HW_ERR "testing 123\n";
+}
+
+static const char *test_hw_informational(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_info(pdev, XE_SIGID_DEVICE_MEMORY,
+				 XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				 dead, sizeof(dead), "testing %d\n", 123);
+	return "SIGID=202 (deadbeef) testing 123\n";
+}
+
+static const struct log_test_param {
+	const char *(*func)(struct xe_device *xe);
+} log_test_params[] = {
+	{ .func = test_fatal },
+	{ .func = test_fatal_tile },
+	{ .func = test_fatal_gt },
+	{ .func = test_fatal_comp },
+	{ .func = test_fatal_comp_tile },
+	{ .func = test_fatal_comp_gt },
+	{ .func = test_fatal_all },
+	{ .func = test_recoverable },
+	{ .func = test_recoverable_tile },
+	{ .func = test_recoverable_gt },
+	{ .func = test_recoverable_comp },
+	{ .func = test_recoverable_comp_tile },
+	{ .func = test_recoverable_comp_gt },
+	{ .func = test_recoverable_all },
+	{ .func = test_info },
+	{ .func = test_info_tile },
+	{ .func = test_info_gt },
+	{ .func = test_info_comp },
+	{ .func = test_info_comp_tile },
+	{ .func = test_info_comp_gt },
+	{ .func = test_info_all },
+	{ .func = test_hw_fatal },
+	{ .func = test_hw_recoverable },
+	{ .func = test_hw_corrected },
+	{ .func = test_hw_informational },
+};
+
+static void log_param_get_desc(const struct log_test_param *p, char *desc)
+{
+	snprintf(desc, KUNIT_PARAM_DESC_SIZE, "%ps", p->func);
+}
+
+KUNIT_ARRAY_PARAM(log, log_test_params, log_param_get_desc);
+
+static void check_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	struct kunit *test = kunit_get_current_test();
+	const struct log_test_param *param = test->param_value;
+	const char *exp = param->func(NULL);
+	char msg[64];
+	int n;
+
+	n = vsnprintf(msg, sizeof(msg), vaf->fmt, *vaf->va);
+	KUNIT_EXPECT_LT(test, n, sizeof(msg));
+	KUNIT_EXPECT_STREQ(test, msg, exp);
+}
+
+static void test_dmesg(struct kunit *test)
+{
+	const struct log_test_param *param = test->param_value;
+
+	kunit_activate_static_stub(test, log_emit_cper, nop_emit_cper);
+	kunit_activate_static_stub(test, log_dmesg_vprintk, check_dmesg_vprintk);
+
+	param->func(test->priv);
+}
+
+#define INVALID_TILEID	(XE_MAX_TILES_PER_DEVICE + 1)
+#define INVALID_GTID	(XE_MAX_TILES_PER_DEVICE * XE_MAX_GT_PER_TILE + 1)
+
+#define PREP_TEST_LOCATION(type, id) \
+	(FIELD_PREP_CONST(XE_LOG_LOCATION_TYPE_MASK, (type)) | \
+	 FIELD_PREP_CONST(XE_LOG_LOCATION_ID_MASK, (id)))
+#define PREP_TEST_COMPONENT(class, type) \
+	(FIELD_PREP_CONST(XE_LOG_COMPONENT_CLASS_MASK, (class)) | \
+	 FIELD_PREP_CONST(XE_LOG_COMPONENT_TYPE_MASK, (type)))
+
+static const struct {
+	u32 comp;
+	u32 loc;
+	const char *name;
+} invalid_params[] = {
+	{	.name = "no-component no-location no-warn" },
+	{	.loc = PREP_TEST_LOCATION(0, 1),
+		.name = "reserved location" },
+	{	.loc = PREP_TEST_LOCATION(255, 0),
+		.name = "unknown location" },
+	{	.loc = PREP_TEST_LOCATION(XE_LOG_LOCATION_TYPE_DEVICE, 1),
+		.name = "nonzero-device-id location" },
+	{	.loc = PREP_TEST_LOCATION(XE_LOG_LOCATION_TYPE_TILE, INVALID_TILEID),
+		.name = "invalid-tile-id location" },
+	{	.loc = PREP_TEST_LOCATION(XE_LOG_LOCATION_TYPE_GT, INVALID_GTID),
+		.name = "invalid-gt-id location" },
+	{	.comp = PREP_TEST_COMPONENT(255, 0),
+		.name = "unknown component class" },
+	{	.comp = PREP_TEST_COMPONENT(XE_LOG_COMPONENT_CLASS_SYSTEM, 255),
+		.name = "unknown system component" },
+	{	.comp = PREP_TEST_COMPONENT(XE_LOG_COMPONENT_CLASS_HARDWARE, 255),
+		.name = "unknown hardware component" },
+	{	.comp = PREP_TEST_COMPONENT(255, 1),
+		.loc = PREP_TEST_LOCATION(255, 1),
+		.name = "unknown component and location" },
+};
+
+KUNIT_ARRAY_PARAM_DESC(invalid_param, invalid_params, name);
+
+static void test_invalid(struct kunit *test)
+{
+	struct xe_device *xe = test->priv;
+	typeof(invalid_params[0]) *param = test->param_value;
+
+	struct pci_dev *pdev = xe_any_to_pdev(xe);
+
+	if (!IS_ENABLED(CONFIG_DRM_XE_DEBUG))
+		kunit_skip(test, "requires CONFIG_DRM_XE_DEBUG\n");
+
+	kunit_activate_static_stub(test, log_emit_cper, nop_emit_cper);
+	kunit_activate_static_stub(test, log_dmesg_vprintk, nop_dmesg_vprintk);
+
+	kunit_warning_suppress(test) {
+		xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PROBE,
+			param->comp, param->loc,
+			NULL, 0, "testing %s\n", param->name);
+		KUNIT_EXPECT_SUPPRESSED_WARNING_COUNT(test, !!param->comp + !!param->loc);
+	}
+}
+
+static int xe_log_test_init(struct kunit *test)
+{
+	struct xe_pci_fake_data fake = {
+		.platform = XE_PVC, /* with max_remote_tiles != 0 */
+		.subplatform = XE_SUBPLATFORM_NONE,
+		.graphics_verx100 = 2001,
+		.media_verx100 = 2001,
+	};
+	struct xe_device *xe;
+
+	test->priv = &fake;
+	xe_kunit_helper_xe_device_test_init(test);
+	xe = test->priv;
+
+	KUNIT_ASSERT_NOT_NULL(test, to_tile_safe(xe));
+	KUNIT_ASSERT_NOT_NULL(test, to_gt_safe(xe));
+	KUNIT_EXPECT_EQ(test, 1, xe_any_id(to_tile_safe(xe)));
+	KUNIT_EXPECT_EQ(test, 1, xe_any_id(to_gt_safe(xe)));
+
+	return 0;
+}
+
+static struct kunit_case xe_log_test_cases[] = {
+	KUNIT_CASE(demo_cper),
+	KUNIT_CASE(demo_dmesg),
+	KUNIT_CASE_PARAM(test_dmesg, log_gen_params),
+	KUNIT_CASE_PARAM(test_invalid, invalid_param_gen_params),
+	{}
+};
+
+static struct kunit_suite xe_log_suite = {
+	.name = "xe_log",
+	.test_cases = xe_log_test_cases,
+	.init = xe_log_test_init,
+};
+
+kunit_test_suites(&xe_log_suite);
drivers/gpu/drm/xe/xe_log.c +11 -0
index ff6a61f1ac7c..b462e75d4ad0 100644
@@ -3,6 +3,9 @@
  * Copyright © 2026 Intel Corporation
  */
 
+#include <kunit/static_stub.h>
+#include <kunit/visibility.h>
+
 #include "abi/xe_log_abi.h"
 
 #include "xe_device.h"
@@ -13,6 +16,8 @@ static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigi
 			  u32 component, u32 location, const void *data, size_t len,
 			  struct va_format *vaf)
 {
+	KUNIT_STATIC_STUB_REDIRECT(log_emit_cper, pdev, cper_sev, sigid,
+				   component, location, data, len, vaf);
 	/* TODO */
 }
 
@@ -129,6 +134,8 @@ static const char *log_sev_prefix(int cper_sev)
 
 static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
 {
+	KUNIT_STATIC_STUB_REDIRECT(log_dmesg_vprintk, pdev, cper_sev, vaf);
+
 	if (cper_sev == CPER_SEV_INFORMATIONAL)
 		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
 	else
@@ -219,3 +226,7 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
 
 	va_end(args);
 }
+
+#if IS_BUILTIN(CONFIG_DRM_XE_KUNIT_TEST)
+#include "tests/xe_log_kunit.c"
+#endif
Signature · 1 line
2.47.1
Reviewed-by on v3 14/23
#41 lore raw

Re: [PATCH v3 14/23] drm/xe/tests: Add Kunit tests for xe_log

Quoted 80 lines · Michal Wajdeczko

All dmesg log lines generated by the xe_log() functions or helper macros are expected to have a stable format. Add tests to verify that generated output is not accidentally changed. Add demo pseudo tests to show how to use all variants of the xe_log() helpers.

---
Cc: Aravind Iddamsetty <[email protected]>
Cc: Yoni Levitt <[email protected]>
Cc: Mallesh Koujalagi <[email protected]>
---
v2: less demos/more tests (Michal)
v3: expect tile.id is already set (Michal)
add invalid params test (Michal)

---
  drivers/gpu/drm/xe/tests/xe_log_kunit.c | 545 ++++++++++++++++++++++++
  drivers/gpu/drm/xe/xe_log.c             |  11 +
  2 files changed, 556 insertions(+)

create mode 100644 drivers/gpu/drm/xe/tests/xe_log_kunit.c

drivers/gpu/drm/xe/tests/xe_log_kunit.c new file +53 -0
new file mode 100644
index 000000000000..27f3c322cc26
@@ -0,0 +1,545 @@
+// SPDX-License-Identifier: GPL-2.0 AND MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include <kunit/static_stub.h>
+#include <kunit/test.h>
+#include <kunit/test-bug.h>
+
+#include "tests/xe_kunit_helpers.h"
+#include "tests/xe_pci_test.h"
+#include "xe_device.h"
+#include "xe_log.h"
+
+static void nop_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+}
+
+static void nop_emit_cper(struct pci_dev *pdev, int cper_sev,
+			  enum xe_sigid sigid, u32 component, u32 location,
+			  const void *data, size_t len, struct va_format *vaf)
+{
+}
+
+static const char *component_name(u32 component)
+{
+	switch (component) {
+#define make_component_tag_case(_CLASS, _ID, _TAG, _SIG, _NAME) \
+	case XE_LOG_COMPONENT_##_TAG: return _NAME;
+	DEFINE_XE_LOG_COMPONENTS(make_component_tag_case)
+#undef make_component_tag_case
+	}
+	return component ? "???" : "";
+}
+
+static const char *location_type(u32 location)
+{
+	u32 type = FIELD_GET(XE_LOG_LOCATION_TYPE_MASK, location);
+
+	return type == XE_LOG_LOCATION_TYPE_DEVICE ? "DEVICE" :
+	       type == XE_LOG_LOCATION_TYPE_TILE ? "TILE" :
+	       type == XE_LOG_LOCATION_TYPE_GT ? "GT" :
+	       location ? "?" : "";
+}
+
+static void fake_emit_cper(struct pci_dev *pdev, int cper_sev,
+			   enum xe_sigid sigid, u32 component, u32 location,
+			   const void *data, size_t len, struct va_format *vaf)
+{
+	char msg[64];
+	int n, err;
+
+	pr_info("\n");

drivers/gpu/drm/xe/tests/xe_log_kunit.c line 63

Quoted 10 lines
drivers/gpu/drm/xe/tests/xe_log_kunit.c new file +10 -0
+	pr_info("CPER SEV=%u SIGID=%u\n", cper_sev, sigid);
+	pr_info("CPER DEVICE=%s\n", dev_name(&pdev->dev));
+	if (location)
+		pr_info("CPER LOCATION=%#x \t# %s.%u\n",
+			location, location_type(location),
+			FIELD_GET(XE_LOG_LOCATION_ID_MASK, location));
+	if (component)
+		pr_info("CPER COMPONENT=%#x \t# %s\n",
+			component, component_name(component));
+	if (IS_ERR(data)) {

Please move 'err' variable within the block.

after changing that

LGTM,

Quoted 522 lines
drivers/gpu/drm/xe/tests/xe_log_kunit.c new file +482 -0
+		err = PTR_ERR(data);
+		pr_info("CPER ERR=%d \t\t# %pe\n", err, data);
+	} else if (len) {
+		print_hex_dump(KERN_INFO, "CPER BIN=", DUMP_PREFIX_OFFSET,
+			       16, 1, data, len, false);
+	}
+
+	n = vscnprintf(msg, sizeof(msg), vaf->fmt, *vaf->va);
+	print_hex_dump(KERN_INFO, "CPER MSG=", DUMP_PREFIX_OFFSET, 16, 1, msg, n, true);
+	pr_info("CPER END\n");
+}
+
+static const u8 blob[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
+static const u8 dead[] = { 0xde, 0xad, 0xbe, 0xef };
+
+static struct xe_tile *to_tile_safe(struct xe_device *xe)
+{
+	return xe ? &xe->tiles[1] : NULL;
+}
+
+static struct xe_gt *to_gt_safe(struct xe_device *xe)
+{
+	return xe ? to_tile_safe(xe)->primary_gt : NULL;
+}
+
+static struct pci_dev *to_pdev_safe(struct xe_device *xe)
+{
+	return xe ? xe_any_to_pdev(xe) : NULL;
+}
+
+static void demo(struct xe_device *xe)
+{
+	struct pci_dev *pdev = xe_any_to_pdev(xe);
+	struct xe_tile *tile = to_tile_safe(xe);
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	/* SW errno */
+	xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PROBE,
+		    XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+		    ERR_PTR(-ENODEV), 0, "testing %s signature\n", "software");
+
+	xe_log_err(tile, PROBE, -ENODEV, "testing %s signature\n", "software");
+	xe_log_err_corrected(gt, PROBE, -ENODEV, "testing %s signature\n", "software");
+	xe_log_info(gt, PROBE, "testing %s signature\n", "software");
+
+	/* HW data */
+	xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PCIE,
+		    XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+		    blob, sizeof(blob), "testing %s signature\n", "HARDWARE");
+	xe_log_emit_recoverable(pdev, XE_SIGID_FABRIC,
+				XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				blob, sizeof(blob), "testing %s signature\n", "HARDWARE");
+	xe_log_from_corrected(tile, XE_SIGID_DEVICE_MEMORY, XE_LOG_COMPONENT_NONE,
+			      blob, sizeof(blob), "testing %s signature\n", "HARDWARE");
+	xe_log_from_info(gt, XE_SIGID_CORE_COMPUTE, XE_LOG_COMPONENT_NONE,
+			 blob, sizeof(blob), "testing %s signature\n", "HARDWARE");
+}
+
+static void demo_dmesg(struct kunit *test)
+{
+	kunit_activate_static_stub(test, log_emit_cper, nop_emit_cper);
+	demo(test->priv);
+}
+
+static void demo_cper(struct kunit *test)
+{
+	kunit_activate_static_stub(test, log_emit_cper, fake_emit_cper);
+	kunit_activate_static_stub(test, log_dmesg_vprintk, nop_dmesg_vprintk);
+	demo(test->priv);
+}
+
+static const char *test_fatal(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_fatal(pdev, XE_SIGID_PROBE,
+				  XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				  NULL, 0, "testing %d\n", 123);
+	return "SIGID=101 FATAL testing 123\n";
+}
+
+static const char *test_fatal_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_from_fatal(tile, XE_SIGID_PROBE, XE_LOG_COMPONENT_NONE,
+				  ERR_PTR(-ENODEV), 0, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: testing 123\n";
+}
+
+static const char *test_fatal_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_from_fatal(gt, XE_SIGID_PROBE, XE_LOG_COMPONENT_NONE,
+				  ERR_PTR(-ENODEV), 0, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: GT1: testing 123\n";
+}
+
+static const char *test_fatal_comp(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_err_fatal(pdev, PROBE, -ENODEV, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) PROBE: testing 123\n";
+}
+
+static const char *test_fatal_comp_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_err_fatal(tile, PROBE, -ENODEV, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: PROBE: testing 123\n";
+}
+
+static const char *test_fatal_comp_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_err_fatal(gt, PROBE, -ENODEV, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: GT1: PROBE: testing 123\n";
+}
+
+static const char *test_fatal_all(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (pdev)
+		xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PROBE,
+			    XE_LOG_COMPONENT_PROBE, MAKE_XE_LOG_LOCATION(GT, gt->info.id),
+			    ERR_PTR(-ENODEV), 0, "testing %d\n", 123);
+	return "SIGID=101 FATAL (-ENODEV) Tile1: GT1: PROBE: testing 123\n";
+}
+
+static const char *test_recoverable(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_recoverable(pdev, XE_SIGID_RUNTIME_FW,
+					XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+					ERR_PTR(-EIO), 0, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) testing 123\n";
+}
+
+static const char *test_recoverable_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_from_recoverable(tile, XE_SIGID_RUNTIME_FW, XE_LOG_COMPONENT_NONE,
+					ERR_PTR(-EIO), 0, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: testing 123\n";
+}
+
+static const char *test_recoverable_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_from_recoverable(gt, XE_SIGID_RUNTIME_FW, XE_LOG_COMPONENT_NONE,
+					ERR_PTR(-EIO), 0, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: GT1: testing 123\n";
+}
+
+static const char *test_recoverable_comp(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_err(pdev, GUC, -EIO, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) GUC: testing 123\n";
+}
+
+static const char *test_recoverable_comp_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_err(tile, GUC, -EIO, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: GUC: testing 123\n";
+}
+
+static const char *test_recoverable_comp_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_err(gt, GUC, -EIO, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: GT1: GUC: testing 123\n";
+}
+
+static const char *test_recoverable_all(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (pdev)
+		xe_log_emit(pdev, CPER_SEV_RECOVERABLE, XE_SIGID_RUNTIME_FW,
+			    XE_LOG_COMPONENT_GUC, MAKE_XE_LOG_LOCATION(GT, gt->info.id),
+			    ERR_PTR(-EIO), 0, "testing %d\n", 123);
+	return "SIGID=104 (-EIO) Tile1: GT1: GUC: testing 123\n";
+}
+
+static const char *test_info(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit(pdev, CPER_SEV_INFORMATIONAL, XE_SIGID_DEVICE_FW,
+			    XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+			    NULL, 0, "testing %d\n", 123);
+	return "SIGID=105 testing 123\n";
+}
+
+static const char *test_info_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_from_info(tile, XE_SIGID_DEVICE_FW, XE_LOG_COMPONENT_NONE,
+				 NULL, 0, "testing %d\n", 123);
+	return "SIGID=105 Tile1: testing 123\n";
+}
+
+static const char *test_info_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_from_info(gt, XE_SIGID_DEVICE_FW, XE_LOG_COMPONENT_NONE,
+				 NULL, 0, "testing %d\n", 123);
+	return "SIGID=105 Tile1: GT1: testing 123\n";
+}
+
+static const char *test_info_comp(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_info(pdev, PCODE, "testing %d\n", 123);
+	return "SIGID=105 PCODE: testing 123\n";
+}
+
+static const char *test_info_comp_tile(struct xe_device *xe)
+{
+	struct xe_tile *tile = to_tile_safe(xe);
+
+	if (tile)
+		xe_log_info(tile, PCODE, "testing %d\n", 123);
+	return "SIGID=105 Tile1: PCODE: testing 123\n";
+}
+
+static const char *test_info_comp_gt(struct xe_device *xe)
+{
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (gt)
+		xe_log_info(gt, PCODE, "testing %d\n", 123);
+	return "SIGID=105 Tile1: GT1: PCODE: testing 123\n";
+}
+
+static const char *test_info_all(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+	struct xe_gt *gt = to_gt_safe(xe);
+
+	if (pdev)
+		xe_log_emit(pdev, CPER_SEV_INFORMATIONAL, XE_SIGID_DEVICE_FW,
+			    XE_LOG_COMPONENT_PCODE, MAKE_XE_LOG_LOCATION(GT, gt->info.id),
+			    NULL, 0, "testing %d\n", 123);
+	return "SIGID=105 Tile1: GT1: PCODE: testing 123\n";
+}
+
+static const char *test_hw_fatal(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_fatal(pdev, XE_SIGID_PCIE,
+				  XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				  dead, sizeof(dead), "testing %d\n", 123);
+	return "SIGID=201 FATAL (deadbeef) " HW_ERR "testing 123\n";
+}
+
+static const char *test_hw_recoverable(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_recoverable(pdev, XE_SIGID_DEVICE_MEMORY,
+					XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+					dead, sizeof(dead), "testing %d\n", 123);
+	return "SIGID=202 (deadbeef) " HW_ERR "testing 123\n";
+}
+
+static const char *test_hw_corrected(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_corrected(pdev, XE_SIGID_DEVICE_MEMORY,
+				      XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				      dead, sizeof(dead), "testing %d\n", 123);
+	return "SIGID=202 CORRECTED (deadbeef) " HW_ERR "testing 123\n";
+}
+
+static const char *test_hw_informational(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pdev_safe(xe);
+
+	if (pdev)
+		xe_log_emit_info(pdev, XE_SIGID_DEVICE_MEMORY,
+				 XE_LOG_COMPONENT_NONE, XE_LOG_LOCATION_NONE,
+				 dead, sizeof(dead), "testing %d\n", 123);
+	return "SIGID=202 (deadbeef) testing 123\n";
+}
+
+static const struct log_test_param {
+	const char *(*func)(struct xe_device *xe);
+} log_test_params[] = {
+	{ .func = test_fatal },
+	{ .func = test_fatal_tile },
+	{ .func = test_fatal_gt },
+	{ .func = test_fatal_comp },
+	{ .func = test_fatal_comp_tile },
+	{ .func = test_fatal_comp_gt },
+	{ .func = test_fatal_all },
+	{ .func = test_recoverable },
+	{ .func = test_recoverable_tile },
+	{ .func = test_recoverable_gt },
+	{ .func = test_recoverable_comp },
+	{ .func = test_recoverable_comp_tile },
+	{ .func = test_recoverable_comp_gt },
+	{ .func = test_recoverable_all },
+	{ .func = test_info },
+	{ .func = test_info_tile },
+	{ .func = test_info_gt },
+	{ .func = test_info_comp },
+	{ .func = test_info_comp_tile },
+	{ .func = test_info_comp_gt },
+	{ .func = test_info_all },
+	{ .func = test_hw_fatal },
+	{ .func = test_hw_recoverable },
+	{ .func = test_hw_corrected },
+	{ .func = test_hw_informational },
+};
+
+static void log_param_get_desc(const struct log_test_param *p, char *desc)
+{
+	snprintf(desc, KUNIT_PARAM_DESC_SIZE, "%ps", p->func);
+}
+
+KUNIT_ARRAY_PARAM(log, log_test_params, log_param_get_desc);
+
+static void check_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
+{
+	struct kunit *test = kunit_get_current_test();
+	const struct log_test_param *param = test->param_value;
+	const char *exp = param->func(NULL);
+	char msg[64];
+	int n;
+
+	n = vsnprintf(msg, sizeof(msg), vaf->fmt, *vaf->va);
+	KUNIT_EXPECT_LT(test, n, sizeof(msg));
+	KUNIT_EXPECT_STREQ(test, msg, exp);
+}
+
+static void test_dmesg(struct kunit *test)
+{
+	const struct log_test_param *param = test->param_value;
+
+	kunit_activate_static_stub(test, log_emit_cper, nop_emit_cper);
+	kunit_activate_static_stub(test, log_dmesg_vprintk, check_dmesg_vprintk);
+
+	param->func(test->priv);
+}
+
+#define INVALID_TILEID	(XE_MAX_TILES_PER_DEVICE + 1)
+#define INVALID_GTID	(XE_MAX_TILES_PER_DEVICE * XE_MAX_GT_PER_TILE + 1)
+
+#define PREP_TEST_LOCATION(type, id) \
+	(FIELD_PREP_CONST(XE_LOG_LOCATION_TYPE_MASK, (type)) | \
+	 FIELD_PREP_CONST(XE_LOG_LOCATION_ID_MASK, (id)))
+#define PREP_TEST_COMPONENT(class, type) \
+	(FIELD_PREP_CONST(XE_LOG_COMPONENT_CLASS_MASK, (class)) | \
+	 FIELD_PREP_CONST(XE_LOG_COMPONENT_TYPE_MASK, (type)))
+
+static const struct {
+	u32 comp;
+	u32 loc;
+	const char *name;
+} invalid_params[] = {
+	{	.name = "no-component no-location no-warn" },
+	{	.loc = PREP_TEST_LOCATION(0, 1),
+		.name = "reserved location" },
+	{	.loc = PREP_TEST_LOCATION(255, 0),
+		.name = "unknown location" },
+	{	.loc = PREP_TEST_LOCATION(XE_LOG_LOCATION_TYPE_DEVICE, 1),
+		.name = "nonzero-device-id location" },
+	{	.loc = PREP_TEST_LOCATION(XE_LOG_LOCATION_TYPE_TILE, INVALID_TILEID),
+		.name = "invalid-tile-id location" },
+	{	.loc = PREP_TEST_LOCATION(XE_LOG_LOCATION_TYPE_GT, INVALID_GTID),
+		.name = "invalid-gt-id location" },
+	{	.comp = PREP_TEST_COMPONENT(255, 0),
+		.name = "unknown component class" },
+	{	.comp = PREP_TEST_COMPONENT(XE_LOG_COMPONENT_CLASS_SYSTEM, 255),
+		.name = "unknown system component" },
+	{	.comp = PREP_TEST_COMPONENT(XE_LOG_COMPONENT_CLASS_HARDWARE, 255),
+		.name = "unknown hardware component" },
+	{	.comp = PREP_TEST_COMPONENT(255, 1),
+		.loc = PREP_TEST_LOCATION(255, 1),
+		.name = "unknown component and location" },
+};
+
+KUNIT_ARRAY_PARAM_DESC(invalid_param, invalid_params, name);
+
+static void test_invalid(struct kunit *test)
+{
+	struct xe_device *xe = test->priv;
+	typeof(invalid_params[0]) *param = test->param_value;
+
+	struct pci_dev *pdev = xe_any_to_pdev(xe);
+
+	if (!IS_ENABLED(CONFIG_DRM_XE_DEBUG))
+		kunit_skip(test, "requires CONFIG_DRM_XE_DEBUG\n");
+
+	kunit_activate_static_stub(test, log_emit_cper, nop_emit_cper);
+	kunit_activate_static_stub(test, log_dmesg_vprintk, nop_dmesg_vprintk);
+
+	kunit_warning_suppress(test) {
+		xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PROBE,
+			param->comp, param->loc,
+			NULL, 0, "testing %s\n", param->name);
+		KUNIT_EXPECT_SUPPRESSED_WARNING_COUNT(test, !!param->comp + !!param->loc);
+	}
+}
+
+static int xe_log_test_init(struct kunit *test)
+{
+	struct xe_pci_fake_data fake = {
+		.platform = XE_PVC, /* with max_remote_tiles != 0 */
+		.subplatform = XE_SUBPLATFORM_NONE,
+		.graphics_verx100 = 2001,
+		.media_verx100 = 2001,
+	};
+	struct xe_device *xe;
+
+	test->priv = &fake;
+	xe_kunit_helper_xe_device_test_init(test);
+	xe = test->priv;
+
+	KUNIT_ASSERT_NOT_NULL(test, to_tile_safe(xe));
+	KUNIT_ASSERT_NOT_NULL(test, to_gt_safe(xe));
+	KUNIT_EXPECT_EQ(test, 1, xe_any_id(to_tile_safe(xe)));
+	KUNIT_EXPECT_EQ(test, 1, xe_any_id(to_gt_safe(xe)));
+
+	return 0;
+}
+
+static struct kunit_case xe_log_test_cases[] = {
+	KUNIT_CASE(demo_cper),
+	KUNIT_CASE(demo_dmesg),
+	KUNIT_CASE_PARAM(test_dmesg, log_gen_params),
+	KUNIT_CASE_PARAM(test_invalid, invalid_param_gen_params),
+	{}
+};
+
+static struct kunit_suite xe_log_suite = {
+	.name = "xe_log",
+	.test_cases = xe_log_test_cases,
+	.init = xe_log_test_init,
+};
+
+kunit_test_suites(&xe_log_suite);
drivers/gpu/drm/xe/xe_log.c +11 -0
index ff6a61f1ac7c..b462e75d4ad0 100644
@@ -3,6 +3,9 @@
   * Copyright © 2026 Intel Corporation
   */
 
+#include <kunit/static_stub.h>
+#include <kunit/visibility.h>
+
  #include "abi/xe_log_abi.h"
 
  #include "xe_device.h"
@@ -13,6 +16,8 @@ static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigi
  			  u32 component, u32 location, const void *data, size_t len,
  			  struct va_format *vaf)
  {
+	KUNIT_STATIC_STUB_REDIRECT(log_emit_cper, pdev, cper_sev, sigid,
+				   component, location, data, len, vaf);
  	/* TODO */
  }
 
@@ -129,6 +134,8 @@ static const char *log_sev_prefix(int cper_sev)
 
  static void log_dmesg_vprintk(struct pci_dev *pdev, int cper_sev, struct va_format *vaf)
  {
+	KUNIT_STATIC_STUB_REDIRECT(log_dmesg_vprintk, pdev, cper_sev, vaf);
+
  	if (cper_sev == CPER_SEV_INFORMATIONAL)
  		pci_info(pdev, __LOG_DRM_PRINTK_FMT("%pV", vaf));
  	else
@@ -219,3 +226,7 @@ void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid,
 
  	va_end(args);
  }
+
+#if IS_BUILTIN(CONFIG_DRM_XE_KUNIT_TEST)
+#include "tests/xe_log_kunit.c"
+#endif
#42 lore raw

PATCH v3 16/23 drm/xe: Report 'probe blocked' error using SIGID

In reply to Michal Wajdeczko

Report 'probe blocked' error using xe_log_info() helper.

Cc Rodrigo Vivi <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>

---
v2: use info severity (Aravind)

---
 drivers/gpu/drm/xe/xe_pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pci.c +3 -2
index 36d62927b969..a3c4046b56cf 100644
@@ -25,6 +25,7 @@
 #include "xe_gt_printk.h"
 #include "xe_gt_sriov_vf.h"
 #include "xe_guc.h"
+#include "xe_log.h"
 #include "xe_mmio.h"
 #include "xe_module.h"
 #include "xe_pci_error.h"
@@ -1172,8 +1173,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	}
 
 	if (id_blocked(pdev->device)) {
-		dev_info(&pdev->dev, "Probe blocked for device [%04x:%04x].\n",
-			 pdev->vendor, pdev->device);
+		xe_log_info(pdev, PROBE, "Probe blocked for device [%04x:%04x]\n",
+			    pdev->vendor, pdev->device);
 		return -ENODEV;
 	}
 
Signature · 1 line
2.47.1
#43 lore raw

Re: [PATCH v3 16/23] drm/xe: Report 'probe blocked' error using SIGID

Quoted 25 lines · Michal Wajdeczko

Report 'probe blocked' error using xe_log_info() helper.

Cc Rodrigo Vivi <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>

---
v2: use info severity (Aravind)

---
  drivers/gpu/drm/xe/xe_pci.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pci.c +1 -0
index 36d62927b969..a3c4046b56cf 100644
@@ -25,6 +25,7 @@
  #include "xe_gt_printk.h"
  #include "xe_gt_sriov_vf.h"
  #include "xe_guc.h"
+#include "xe_log.h"
  #include "xe_mmio.h"
  #include "xe_module.h"
  #include "xe_pci_error.h"

drivers/gpu/drm/xe/xe_pci.c static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 1177

Quoted 7 lines
drivers/gpu/drm/xe/xe_pci.c +2 -2
@@ -1172,8 +1173,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  	}
 
  	if (id_blocked(pdev->device)) {
-		dev_info(&pdev->dev, "Probe blocked for device [%04x:%04x].\n",
-			 pdev->vendor, pdev->device);
+		xe_log_info(pdev, PROBE, "Probe blocked for device [%04x:%04x]\n",
+			    pdev->vendor, pdev->device);

Please drop Probe from message.

Thanks,

-/Mallesh

Quoted 3 lines
drivers/gpu/drm/xe/xe_pci.c +0 -0
  		return -ENODEV;
  	}
 
#44 lore raw

PATCH v3 17/23 drm/xe: Report 'device wedged' errors using SIGID

In reply to Michal Wajdeczko

Report 'device wedged' error using xe_log_err_fatal() helper. Use -EIO as the error cause, as nothing else is provided here. The hints about the recovery method and bug filling are now separated as it only needs to be printed once.

Cc Rodrigo Vivi <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
 drivers/gpu/drm/xe/xe_device.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_device.c +10 -6
index 4eed9a251e65..b1e9bcd9f5b4 100644
@@ -48,6 +48,7 @@
 #include "xe_i2c.h"
 #include "xe_irq.h"
 #include "xe_late_bind_fw.h"
+#include "xe_log.h"
 #include "xe_mmio.h"
 #include "xe_module.h"
 #include "xe_nvm.h"
@@ -1396,6 +1397,9 @@ void xe_device_set_wedged_method(struct xe_device *xe, unsigned long method)
 	xe->wedged.method = method;
 }
 
+#define WEDGED_URL	"https://docs.kernel.org/gpu/drm-uapi.html#device-wedging"
+#define XE_BUG_URL	"https://gitlab.freedesktop.org/drm/xe/kernel/issues/new"
+
 /**
  * xe_device_declare_wedged - Declare device wedged
  * @xe: xe device instance
@@ -1427,12 +1431,12 @@ void xe_device_declare_wedged(struct xe_device *xe)
 	if (!atomic_xchg(&xe->wedged.flag, 1)) {
 		xe->needs_flr_on_fini = true;
 		xe_pm_runtime_get_noresume(xe);
-		drm_err(&xe->drm,
-			"CRITICAL: Xe has declared device %s as wedged.\n"
-			"IOCTLs and executions are blocked.\n"
-			"For recovery procedure, refer to https://docs.kernel.org/gpu/drm-uapi.html#device-wedging\n"
-			"Please file a _new_ bug report at https://gitlab.freedesktop.org/drm/xe/kernel/issues/new\n",
-			dev_name(xe->drm.dev));
+
+		xe_log_err_fatal(xe, WEDGED, -EIO, "Device declared wedged!\n");
+		xe_err_once(xe, "IOCTLs and executions are now blocked!\n"
+			    "For recovery procedure, refer to %s\n"
+			    "Please file a _new_ bug report at %s\n",
+			    WEDGED_URL, XE_BUG_URL);
 	}
 
 	for_each_gt(gt, xe, id)
Signature · 1 line
2.47.1
#45 lore raw

Re: [PATCH v3 17/23] drm/xe: Report 'device wedged' errors using SIGID

Quoted 3 lines · Michal Wajdeczko

Report 'device wedged' error using xe_log_err_fatal() helper. Use -EIO as the error cause, as nothing else is provided here. The hints about the recovery method and bug filling are now

Typo 'filing'

Quoted 23 lines

separated as it only needs to be printed once.

Cc Rodrigo Vivi <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
  drivers/gpu/drm/xe/xe_device.c | 16 ++++++++++------
  1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_device.c +1 -0
index 4eed9a251e65..b1e9bcd9f5b4 100644
@@ -48,6 +48,7 @@
  #include "xe_i2c.h"
  #include "xe_irq.h"
  #include "xe_late_bind_fw.h"
+#include "xe_log.h"
  #include "xe_mmio.h"
  #include "xe_module.h"
  #include "xe_nvm.h"

drivers/gpu/drm/xe/xe_device.c void xe_device_set_wedged_method(struct xe_device *xe, unsigned long method) · line 1401

Quoted 5 lines
drivers/gpu/drm/xe/xe_device.c +2 -0
@@ -1396,6 +1397,9 @@ void xe_device_set_wedged_method(struct xe_device *xe, unsigned long method)
  	xe->wedged.method = method;
  }
 
+#define WEDGED_URL	"https://docs.kernel.org/gpu/drm-uapi.html#device-wedging"
+#define XE_BUG_URL	"https://gitlab.freedesktop.org/drm/xe/kernel/issues/new"

We can directly used url string, instead of define as macro, since we are not using anywhere else. OR

Please make scope to file only.

Quoted 6 lines
drivers/gpu/drm/xe/xe_device.c +1 -0
+
  /**
   * xe_device_declare_wedged - Declare device wedged
   * @xe: xe device instance
@@ -1427,12 +1431,12 @@ void xe_device_declare_wedged(struct xe_device *xe)
  	if (!atomic_xchg(&xe->wedged.flag, 1)) {

drivers/gpu/drm/xe/xe_device.c void xe_device_declare_wedged(struct xe_device *xe) · line 1435

Quoted 10 lines
drivers/gpu/drm/xe/xe_device.c +2 -6
  		xe->needs_flr_on_fini = true;
  		xe_pm_runtime_get_noresume(xe);
-		drm_err(&xe->drm,
-			"CRITICAL: Xe has declared device %s as wedged.\n"
-			"IOCTLs and executions are blocked.\n"
-			"For recovery procedure, refer to https://docs.kernel.org/gpu/drm-uapi.html#device-wedging\n"
-			"Please file a _new_ bug report at https://gitlab.freedesktop.org/drm/xe/kernel/issues/new\n",
-			dev_name(xe->drm.dev));
+
+		xe_log_err_fatal(xe, WEDGED, -EIO, "Device declared wedged!\n");

Using -EIO is right? since we called this function with difference location (since we are not propagating errors), we may have different errors.

which may be misleading with -EIO.

Thanks,

-/Mallesh

Quoted 8 lines
drivers/gpu/drm/xe/xe_device.c +4 -0
+		xe_err_once(xe, "IOCTLs and executions are now blocked!\n"
+			    "For recovery procedure, refer to %s\n"
+			    "Please file a _new_ bug report at %s\n",
+			    WEDGED_URL, XE_BUG_URL);
 
  	}
 

for_each_gt(gt, xe, id)

#46 lore raw

Re: [PATCH v3 17/23] drm/xe: Report 'device wedged' errors using SIGID

Quoted 27 lines · Koujalagi
Quoted 3 lines · Michal Wajdeczko

Report 'device wedged' error using xe_log_err_fatal() helper. Use -EIO as the error cause, as nothing else is provided here. The hints about the recovery method and bug filling are now

Typo 'filing'

Quoted 21 lines

separated as it only needs to be printed once.

Cc Rodrigo Vivi <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>

---
  drivers/gpu/drm/xe/xe_device.c | 16 ++++++++++------

  1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_device.c +1 -0
index 4eed9a251e65..b1e9bcd9f5b4 100644
@@ -48,6 +48,7 @@
   #include "xe_i2c.h"
   #include "xe_irq.h"
   #include "xe_late_bind_fw.h"
+#include "xe_log.h"
   #include "xe_mmio.h"
   #include "xe_module.h"
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/xe/xe_device.c +0 -0
   #include "xe_nvm.h"
@@ -1396,6 +1397,9 @@ void xe_device_set_wedged_method(struct xe_device *xe, unsigned long method)
       xe->wedged.method = method;
   }

  +#define WEDGED_URL    "https://docs.kernel.org/gpu/drm-uapi.html#device-wedging" +#define XE_BUG_URL    "https://gitlab.freedesktop.org/drm/xe/kernel/issues/new"

We can directly used url string, instead of define as macro, since we are not using anywhere else. OR

URLs change from time to time
IMO it is easier to change a dedicated macro then full message, that will remain unchanged otherwise

Quoted 2 lines

Please make scope to file only.

hmm?

we can try to promote WEDGED_URL to drm/drm_device.h as DRM_WEDGE_URL_DOC and move XE_BUG_URL to xe/xe_drv.h, but I don't want to this right now

Quoted 20 lines
Quoted 7 lines

+
  /**
   * xe_device_declare_wedged - Declare device wedged
   * @xe: xe device instance

drivers/gpu/drm/xe/xe_device.c +0 -0
@@ -1427,12 +1431,12 @@ void xe_device_declare_wedged(struct xe_device *xe)
       if (!atomic_xchg(&xe->wedged.flag, 1)) {

drivers/gpu/drm/xe/xe_device.c void xe_device_declare_wedged(struct xe_device *xe) · line 1435

Quoted 10 lines
drivers/gpu/drm/xe/xe_device.c +2 -6
           xe->needs_flr_on_fini = true;
           xe_pm_runtime_get_noresume(xe);
-        drm_err(&xe->drm,
-            "CRITICAL: Xe has declared device %s as wedged.\n"
-            "IOCTLs and executions are blocked.\n"
-            "For recovery procedure, refer to https://docs.kernel.org/gpu/drm-uapi.html#device-wedging\n"
-            "Please file a _new_ bug report at https://gitlab.freedesktop.org/drm/xe/kernel/issues/new\n",
-            dev_name(xe->drm.dev));
+
+        xe_log_err_fatal(xe, WEDGED, -EIO, "Device declared wedged!\n");

Using -EIO is right? since we called this function with difference location (since we are not propagating errors), we may have different errors.

Quoted 1 line

which may be misleading with -EIO.

true, but there is no errno available at this point and most callers don't use any errno at all

we can change that to -ENOTRECOVERABLE, which was introduced recently to indicate a WEDGED state, but then it will be little redundant

or

change the xe_device_declare_wedged signature and require errno to be assigned by the callers (but that would be a separate task/patch from this example

Quoted 13 lines

Thanks,

-/Mallesh

Quoted 7 lines
drivers/gpu/drm/xe/xe_device.c +4 -0
+        xe_err_once(xe, "IOCTLs and executions are now blocked!\n"
+                "For recovery procedure, refer to %s\n"
+                "Please file a _new_ bug report at %s\n",
+                WEDGED_URL, XE_BUG_URL);
 
       }
         for_each_gt(gt, xe, id)
#47 lore raw

Re: [PATCH v3 17/23] drm/xe: Report 'device wedged' errors using SIGID

Quoted 35 lines · Michal Wajdeczko
Quoted 25 lines · Koujalagi
Quoted 3 lines · Michal Wajdeczko

Report 'device wedged' error using xe_log_err_fatal() helper. Use -EIO as the error cause, as nothing else is provided here. The hints about the recovery method and bug filling are now

Typo 'filing'

Quoted 20 lines

separated as it only needs to be printed once.

Cc Rodrigo Vivi <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
   drivers/gpu/drm/xe/xe_device.c | 16 ++++++++++------
   1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_device.c +1 -0
index 4eed9a251e65..b1e9bcd9f5b4 100644
@@ -48,6 +48,7 @@
   #include "xe_i2c.h"
   #include "xe_irq.h"
   #include "xe_late_bind_fw.h"
+#include "xe_log.h"
   #include "xe_mmio.h"
Quoted 8 lines

drivers/gpu/drm/xe/xe_device.c void xe_device_set_wedged_method(struct xe_device *xe, unsigned long method) · line 1400

Quoted 7 lines
drivers/gpu/drm/xe/xe_device.c +1 -0
   #include "xe_module.h"
   #include "xe_nvm.h"
@@ -1396,6 +1397,9 @@ void xe_device_set_wedged_method(struct xe_device *xe, unsigned long method)
       xe->wedged.method = method;
   }
   +#define WEDGED_URL    "https://docs.kernel.org/gpu/drm-uapi.html#device-wedging"
+#define XE_BUG_URL    "https://gitlab.freedesktop.org/drm/xe/kernel/issues/new"

We can directly used url string, instead of define as macro, since we are not using anywhere else. OR

Quoted 3 lines

URLs change from time to time
IMO it is easier to change a dedicated macro then full message, that will remain unchanged otherwise

In that case, I would prefer keeping macros, even if they are currently used only once, it's good for readability and future updates.

Quoted 5 lines
Quoted 1 line

Please make scope to file only.

hmm?

we can try to promote WEDGED_URL to drm/drm_device.h as DRM_WEDGE_URL_DOC and move XE_BUG_URL to xe/xe_drv.h, but I don't want to this right now

Longer term, I agree it could make sense to move those macros to a more common location, e.g

a generic DRM_WEDGE_URL in drm_device.h and XE_BUF_URL in xe_drv.h. I would like keep this change focused

rather than refactoring the patch.

Quoted 18 lines
Quoted 18 lines
Quoted 6 lines
drivers/gpu/drm/xe/xe_device.c +1 -0
+
   /**
    * xe_device_declare_wedged - Declare device wedged
    * @xe: xe device instance
@@ -1427,12 +1431,12 @@ void xe_device_declare_wedged(struct xe_device *xe)
       if (!atomic_xchg(&xe->wedged.flag, 1)) {

drivers/gpu/drm/xe/xe_device.c void xe_device_declare_wedged(struct xe_device *xe) · line 1435

Quoted 10 lines
drivers/gpu/drm/xe/xe_device.c +2 -6
           xe->needs_flr_on_fini = true;
           xe_pm_runtime_get_noresume(xe);
-        drm_err(&xe->drm,
-            "CRITICAL: Xe has declared device %s as wedged.\n"
-            "IOCTLs and executions are blocked.\n"
-            "For recovery procedure, refer to https://docs.kernel.org/gpu/drm-uapi.html#device-wedging\n"
-            "Please file a _new_ bug report at https://gitlab.freedesktop.org/drm/xe/kernel/issues/new\n",
-            dev_name(xe->drm.dev));
+
+        xe_log_err_fatal(xe, WEDGED, -EIO, "Device declared wedged!\n");

Using -EIO is right? since we called this function with difference location (since we are not propagating errors), we may have different errors.

Quoted 3 lines
Quoted 1 line

which may be misleading with -EIO.

true, but there is no errno available at this point and most callers don't use any errno at all

That's  a fair point.

-EIO was chosen as a generic one, but there is no meaning errno available at the point where the device is declared

wedged and most callers don't propagate that.

Quoted 3 lines

we can change that to -ENOTRECOVERABLE, which was introduced recently to indicate a WEDGED state, but then it will be little redundant

This would be arguable be more accurate right. We can remove log message right? since errno itself explainable.

Quoted 7 lines

or

change the xe_device_declare_wedged signature and require errno to be assigned by the callers (but that would be a separate task/patch from this example

Agreed! I'd view that as a separate cleanup/refactoring task.

OR

xe_device struct we can keep sigid_errno as member we can use it whenever required rather than passing arguments. any thoughts?

Thanks,

-/Mallesh

Quoted 11 lines
Quoted 11 lines

Thanks,

-/Mallesh

Quoted 6 lines
drivers/gpu/drm/xe/xe_device.c +4 -0
+        xe_err_once(xe, "IOCTLs and executions are now blocked!\n"
+                "For recovery procedure, refer to %s\n"
+                "Please file a _new_ bug report at %s\n",
+                WEDGED_URL, XE_BUG_URL);
       }
         for_each_gt(gt, xe, id)
#48 lore raw

PATCH v3 18/23 drm/xe: Report 'Survivability Mode' errors using SIGID

In reply to Michal Wajdeczko

Report various 'Survivability Mode' errors using xe_log() helpers.

Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
 drivers/gpu/drm/xe/xe_survivability_mode.c | 24 +++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/xe/xe_survivability_mode.c +14 -10
index 4c506027fa94..788b7e8137a9 100644
@@ -14,9 +14,11 @@
 #include "xe_device.h"
 #include "xe_heci_gsc.h"
 #include "xe_i2c.h"
+#include "xe_log.h"
 #include "xe_mmio.h"
 #include "xe_nvm.h"
 #include "xe_pcode_api.h"
+#include "xe_printk.h"
 #include "xe_vsec.h"
 
 /**
@@ -179,11 +181,11 @@ static void log_survivability_info(struct pci_dev *pdev)
 	u32 *info = survivability->info;
 	int id;
 
-	dev_info(&pdev->dev, "Survivability Boot Status : Critical Failure (%d)\n",
-		 survivability->boot_status);
+	xe_log_info(xe, SURVIVABILITY, "Boot Status : Critical Failure (%d)\n",
+		    survivability->boot_status);
 	for (id = 0; id < MAX_SCRATCH_REG; id++) {
 		if (info[id])
-			dev_info(&pdev->dev, "%s: 0x%x\n", reg_map[id], info[id]);
+			xe_log_info(xe, SURVIVABILITY, "%s: 0x%x\n", reg_map[id], info[id]);
 	}
 }
 
@@ -316,7 +318,6 @@ static int create_survivability_sysfs(struct pci_dev *pdev)
 
 static int enable_boot_survivability_mode(struct pci_dev *pdev)
 {
-	struct device *dev = &pdev->dev;
 	struct xe_device *xe = pdev_to_xe_device(pdev);
 	struct xe_survivability *survivability = &xe->survivability;
 	int ret = 0;
@@ -342,12 +343,12 @@ static int enable_boot_survivability_mode(struct pci_dev *pdev)
 	if (ret)
 		goto err;
 
-	dev_err(dev, "In Survivability Mode\n");
-
+	xe_log_emit(pdev, check_boot_failure(xe) ? CPER_SEV_FATAL : CPER_SEV_INFORMATIONAL,
+		    XE_SIGID_SURVIVABILITY, 0, 0, 0, 0, "In Survivability Boot Mode\n");
 	return 0;
 
 err:
-	dev_err(dev, "Failed to enable Survivability Mode\n");
+	xe_log_err_fatal(xe, SURVIVABILITY, ret, "Failed to enable Survivability Mode\n");
 	survivability->mode = false;
 	return ret;
 }
@@ -412,7 +413,7 @@ void xe_survivability_mode_runtime_enable(struct xe_device *xe)
 	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
 
 	if (!IS_DGFX(xe) || IS_SRIOV_VF(xe) || xe->info.platform < XE_BATTLEMAGE) {
-		dev_err(&pdev->dev, "Runtime Survivability Mode not supported\n");
+		xe_log_info(xe, SURVIVABILITY, "Runtime Mode not supported!\n");
 		return;
 	}
 
@@ -422,11 +423,14 @@ void xe_survivability_mode_runtime_enable(struct xe_device *xe)
 		dev_err(&pdev->dev, "Failed to create survivability sysfs\n");
 
 	survivability->type = XE_SURVIVABILITY_TYPE_RUNTIME;
-	dev_err(&pdev->dev, "Runtime Survivability mode enabled\n");
+	xe_log_err_fatal(xe, SURVIVABILITY, 0, "Runtime Mode enabled!\n");
 
 	xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_VENDOR);
 	xe_device_declare_wedged(xe);
-	dev_err(&pdev->dev, "Firmware flash required, Please refer to the userspace documentation for more details!\n");
+
+	xe_log_err_fatal(xe, SURVIVABILITY, 0, "Firmware flash required!\n");
+	xe_info(xe, "Please refer to the userspace documentation for more details how to flash the firmware on %s!\n",
+		xe->info.platform_name);
 }
 
 /**
Signature · 1 line
2.47.1
#49 lore raw

Re: [PATCH v3 18/23] drm/xe: Report 'Survivability Mode' errors using SIGID

Quoted 51 lines · Michal Wajdeczko

Report various 'Survivability Mode' errors using xe_log() helpers.

Cc Rodrigo Vivi<[email protected]>
Cc Riana Tauro<[email protected]>
Cc Aravind Iddamsetty<[email protected]>
Cc Mallesh Koujalagi<[email protected]>
---
  drivers/gpu/drm/xe/xe_survivability_mode.c | 24 +++++++++++++---------
  1 file changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/xe/xe_survivability_mode.c +5 -4
index 4c506027fa94..788b7e8137a9 100644
@@ -14,9 +14,11 @@
  #include "xe_device.h"
  #include "xe_heci_gsc.h"
  #include "xe_i2c.h"
+#include "xe_log.h"
  #include "xe_mmio.h"
  #include "xe_nvm.h"
  #include "xe_pcode_api.h"
+#include "xe_printk.h"
  #include "xe_vsec.h"
 
  /**
@@ -179,11 +181,11 @@ static void log_survivability_info(struct pci_dev *pdev)
  	u32 *info = survivability->info;
  	int id;
 
-	dev_info(&pdev->dev, "Survivability Boot Status : Critical Failure (%d)\n",
-		 survivability->boot_status);
+	xe_log_info(xe, SURVIVABILITY, "Boot Status : Critical Failure (%d)\n",
+		    survivability->boot_status);
  	for (id = 0; id < MAX_SCRATCH_REG; id++) {
  		if (info[id])
-			dev_info(&pdev->dev, "%s: 0x%x\n", reg_map[id], info[id]);
+			xe_log_info(xe, SURVIVABILITY, "%s: 0x%x\n", reg_map[id], info[id]);
  	}
  }
 
@@ -316,7 +318,6 @@ static int create_survivability_sysfs(struct pci_dev *pdev)
 
  static int enable_boot_survivability_mode(struct pci_dev *pdev)
  {
-	struct device *dev = &pdev->dev;
  	struct xe_device *xe = pdev_to_xe_device(pdev);
  	struct xe_survivability *survivability = &xe->survivability;
  	int ret = 0;

drivers/gpu/drm/xe/xe_survivability_mode.c static int enable_boot_survivability_mode(struct pci_dev *pdev) · line 347

Quoted 7 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -2
@@ -342,12 +343,12 @@ static int enable_boot_survivability_mode(struct pci_dev *pdev)
  	if (ret)
  		goto err;
 
-	dev_err(dev, "In Survivability Mode\n");
-
+	xe_log_emit(pdev, check_boot_failure(xe) ? CPER_SEV_FATAL : CPER_SEV_INFORMATIONAL,
+		    XE_SIGID_SURVIVABILITY, 0, 0, 0, 0, "In Survivability Boot Mode\n");

Please make it cleaner and simpler.

if(check_boot_failure(xe))

    xe_log_err_fatal(xe, SURVIVABILITY, .. );

else

     xe_log_info(xe, SURVIVABILITY, .. );

OR

xe_log_emit(xe_any_to_pdev(xe),
            check_boot_failure(xe) ? CPER_SEV_FATAL : CPER_SEV_INFORMATIONAL, XE_SIGID_SURVIVABILITY, XE_LOG_COMPONENT_SURVIVABILITY, xe_log_location(xe),
            &survivability->boot_status, sizeof(survivability->boot_status), "In Survivability Boot Mode\n");

Quoted 9 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
  	return 0;
 
  err:
-	dev_err(dev, "Failed to enable Survivability Mode\n");
+	xe_log_err_fatal(xe, SURVIVABILITY, ret, "Failed to enable Survivability Mode\n");
  	survivability->mode = false;
  	return ret;
  }

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 416

Quoted 5 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
@@ -412,7 +413,7 @@ void xe_survivability_mode_runtime_enable(struct xe_device *xe)
  	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
 
  	if (!IS_DGFX(xe) || IS_SRIOV_VF(xe) || xe->info.platform < XE_BATTLEMAGE) {
-		dev_err(&pdev->dev, "Runtime Survivability Mode not supported\n");
+		xe_log_info(xe, SURVIVABILITY, "Runtime Mode not supported!\n");

We can add xe_log_err(xe, SURVIVABILITY, -EOPNOTSUPP, ...);

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 423

Quoted 5 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +0 -0
  		return;
  	}
 
@@ -422,11 +423,14 @@ void xe_survivability_mode_runtime_enable(struct xe_device *xe)
  		dev_err(&pdev->dev, "Failed to create survivability sysfs\n");

need to use xe_log_err(xe, SURVIVABILITY. -EIO, ... );

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 426

Quoted 4 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
  	survivability->type = XE_SURVIVABILITY_TYPE_RUNTIME;
-	dev_err(&pdev->dev, "Runtime Survivability mode enabled\n");
+	xe_log_err_fatal(xe, SURVIVABILITY, 0, "Runtime Mode enabled!\n");

hmm, Logging error as fatal, however passing err=0 (Success). is it right? or simply we can log as xe_log_err or xe_log_info ? any thoughts.

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 431

Quoted 6 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -1
  	xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_VENDOR);
  	xe_device_declare_wedged(xe);
-	dev_err(&pdev->dev, "Firmware flash required, Please refer to the userspace documentation for more details!\n");
+
+	xe_log_err_fatal(xe, SURVIVABILITY, 0, "Firmware flash required!\n");

ditto

Quoted 5 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -0
+	xe_info(xe, "Please refer to the userspace documentation for more details how to flash the firmware on %s!\n",
+		xe->info.platform_name);
  }
 
  /**
#50 lore raw

Re: [PATCH v3 18/23] drm/xe: Report 'Survivability Mode' errors using SIGID

Quoted 33 lines · Koujalagi
Quoted 31 lines · Michal Wajdeczko

Report various 'Survivability Mode' errors using xe_log() helpers.

Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
 drivers/gpu/drm/xe/xe_survivability_mode.c | 24 +++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -0
index 4c506027fa94..788b7e8137a9 100644
@@ -14,9 +14,11 @@
 #include "xe_device.h"
 #include "xe_heci_gsc.h"
 #include "xe_i2c.h"
+#include "xe_log.h"
 #include "xe_mmio.h"
 #include "xe_nvm.h"
 #include "xe_pcode_api.h"
+#include "xe_printk.h"
 #include "xe_vsec.h"
 
 /**
@@ -179,11 +181,11 @@ static void log_survivability_info(struct pci_dev *pdev)
 	u32 *info = survivability->info;
 	int id;
 
Quoted 4 lines

drivers/gpu/drm/xe/xe_survivability_mode.c static void log_survivability_info(struct pci_dev *pdev) · line 185

Quoted 4 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -2
-	dev_info(&pdev->dev, "Survivability Boot Status : Critical Failure (%d)\n",
-		 survivability->boot_status);
+	xe_log_info(xe, SURVIVABILITY, "Boot Status : Critical Failure (%d)\n",
+		    survivability->boot_status);

btw, is it OK that we use INFO level for "critical failure" ?

Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -2
 	for (id = 0; id < MAX_SCRATCH_REG; id++) {
 		if (info[id])
-			dev_info(&pdev->dev, "%s: 0x%x\n", reg_map[id], info[id]);
+			xe_log_info(xe, SURVIVABILITY, "%s: 0x%x\n", reg_map[id], info[id]);
 	}
 }
 
@@ -316,7 +318,6 @@ static int create_survivability_sysfs(struct pci_dev *pdev)
 
 static int enable_boot_survivability_mode(struct pci_dev *pdev)
 {
-	struct device *dev = &pdev->dev;
 	struct xe_device *xe = pdev_to_xe_device(pdev);
 	struct xe_survivability *survivability = &xe->survivability;
 	int ret = 0;
@@ -342,12 +343,12 @@ static int enable_boot_survivability_mode(struct pci_dev *pdev)
 	if (ret)
 		goto err;
 
Quoted 6 lines

drivers/gpu/drm/xe/xe_survivability_mode.c static int enable_boot_survivability_mode(struct pci_dev *pdev) · line 347

Quoted 4 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -2
-	dev_err(dev, "In Survivability Mode\n");
-
+	xe_log_emit(pdev, check_boot_failure(xe) ? CPER_SEV_FATAL : CPER_SEV_INFORMATIONAL,
+		    XE_SIGID_SURVIVABILITY, 0, 0, 0, 0, "In Survivability Boot Mode\n");

Please make it cleaner and simpler.

sure

it was one of the earliest examples of the new xe_log API, and that's why it was using the base xe_log function

Quoted 5 lines

if(check_boot_failure(xe))

    xe_log_err_fatal(xe, SURVIVABILITY, .. );

Quoted 8 lines

else

     xe_log_info(xe, SURVIVABILITY, .. );

OR

xe_log_emit(xe_any_to_pdev(xe),

we do have pdev already, no need to cast back to xe

Quoted 4 lines

            check_boot_failure(xe) ? CPER_SEV_FATAL : CPER_SEV_INFORMATIONAL, XE_SIGID_SURVIVABILITY, XE_LOG_COMPONENT_SURVIVABILITY, xe_log_location(xe),
            &survivability->boot_status, sizeof(survivability->boot_status),

cool, but isn't this already printed in log_survivability_info() ?

Quoted 1 line

            "In Survivability Boot Mode\n");

btw, as we use SURVIVABILITY component, the dmesg will already have "SURVIVABILITY: " decoration, so maybe this msg should be:

"Boot mode enabled!\n"

with dmesg:

<3> [drm] ERROR SIGID=103 FATAL (04) SURVIVABILITY: Boot mode enabled!
or
<6> [drm] SIGID=103 SURVIVABILITY: Boot mode enabled!

Quoted 6 lines

drivers/gpu/drm/xe/xe_survivability_mode.c static int enable_boot_survivability_mode(struct pci_dev *pdev) · line 351

Quoted 6 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
 	return 0;
 
 err:
-	dev_err(dev, "Failed to enable Survivability Mode\n");
+	xe_log_err_fatal(xe, SURVIVABILITY, ret, "Failed to enable Survivability Mode\n");

and here:

"Failed to enter Boot mode!\n"

with dmesg:

<3> [drm] ERROR SIGID=103 FATAL (-ENOMEM) SURVIVABILITY: Failed to enter Boot mode!

Quoted 10 lines

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 416

Quoted 9 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
 	survivability->mode = false;
 	return ret;
 }
@@ -412,7 +413,7 @@ void xe_survivability_mode_runtime_enable(struct xe_device *xe)
 	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
 
 	if (!IS_DGFX(xe) || IS_SRIOV_VF(xe) || xe->info.platform < XE_BATTLEMAGE) {
-		dev_err(&pdev->dev, "Runtime Survivability Mode not supported\n");
+		xe_log_info(xe, SURVIVABILITY, "Runtime Mode not supported!\n");

We can add xe_log_err(xe, SURVIVABILITY, -EOPNOTSUPP, ...);

hmm, actually I was wondering if this dev_err() was correct maybe it should be just xe_dbg() as we are not doing anything related to SURVIVABILITY ?

Quoted 11 lines

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 423

Quoted 5 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +0 -0
 		return;
 	}
 
@@ -422,11 +423,14 @@ void xe_survivability_mode_runtime_enable(struct xe_device *xe)
 		dev_err(&pdev->dev, "Failed to create survivability sysfs\n");

need to use xe_log_err(xe, SURVIVABILITY. -EIO, ... );

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 426

Quoted 4 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
 	survivability->type = XE_SURVIVABILITY_TYPE_RUNTIME;
-	dev_err(&pdev->dev, "Runtime Survivability mode enabled\n");
+	xe_log_err_fatal(xe, SURVIVABILITY, 0, "Runtime Mode enabled!\n");

hmm, Logging error as fatal, however passing err=0 (Success). is it right? or simply we can log as xe_log_err or xe_log_info ? any thoughts.

passing 0 instead of errno to xe_log_err() helpers will just omit printing anything in ( ), no %pe nor %phN

whether this should be info/fatal/recoverable it's not me to answer your initial documentation [1] was saying that all XE_SIG_SURVIVABILITY should have CPER_SEV_FATAL

[1] https://patchwork.freedesktop.org/patch/732271/?series=168333&rev=1

Quoted 7 lines

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 431

Quoted 6 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -1
 	xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_VENDOR);
 	xe_device_declare_wedged(xe);
-	dev_err(&pdev->dev, "Firmware flash required, Please refer to the userspace documentation for more details!\n");
+
+	xe_log_err_fatal(xe, SURVIVABILITY, 0, "Firmware flash required!\n");

ditto

ditto ;)

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -0
+	xe_info(xe, "Please refer to the userspace documentation for more details how to flash the firmware on %s!\n",
+		xe->info.platform_name);
 }
 
 /**
#51 lore raw

Re: [PATCH v3 18/23] drm/xe: Report 'Survivability Mode' errors using SIGID

Quoted 34 lines · Michal Wajdeczko
Quoted 32 lines · Koujalagi
Quoted 31 lines · Michal Wajdeczko

Report various 'Survivability Mode' errors using xe_log() helpers.

Cc Rodrigo Vivi<[email protected]>
Cc Riana Tauro<[email protected]>
Cc Aravind Iddamsetty<[email protected]>
Cc Mallesh Koujalagi<[email protected]>
---
  drivers/gpu/drm/xe/xe_survivability_mode.c | 24 +++++++++++++---------
  1 file changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -0
index 4c506027fa94..788b7e8137a9 100644
@@ -14,9 +14,11 @@
  #include "xe_device.h"
  #include "xe_heci_gsc.h"
  #include "xe_i2c.h"
+#include "xe_log.h"
  #include "xe_mmio.h"
  #include "xe_nvm.h"
  #include "xe_pcode_api.h"
+#include "xe_printk.h"
  #include "xe_vsec.h"
 
  /**
@@ -179,11 +181,11 @@ static void log_survivability_info(struct pci_dev *pdev)
  	u32 *info = survivability->info;
  	int id;
 
Quoted 5 lines
Quoted 4 lines

drivers/gpu/drm/xe/xe_survivability_mode.c static void log_survivability_info(struct pci_dev *pdev) · line 185

Quoted 4 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -2
-	dev_info(&pdev->dev, "Survivability Boot Status : Critical Failure (%d)\n",
-		 survivability->boot_status);
+	xe_log_info(xe, SURVIVABILITY, "Boot Status : Critical Failure (%d)\n",
+		    survivability->boot_status);

btw, is it OK that we use INFO level for "critical failure" ?

Good catch! We log the message when the device has a critical boot failure and the survivability is too old to handle if (version < 2)

so the driver is about to abort with -ENXIO. Using xe_log_info for that situation is wrong one. Using

xe_log_err_fatal(xe, SURVIVABILITY, -ENXIO, ...); we can fix it.

Quoted 35 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -2
  	for (id = 0; id < MAX_SCRATCH_REG; id++) {
  		if (info[id])
-			dev_info(&pdev->dev, "%s: 0x%x\n", reg_map[id], info[id]);
+			xe_log_info(xe, SURVIVABILITY, "%s: 0x%x\n", reg_map[id], info[id]);
  	}
  }
 
@@ -316,7 +318,6 @@ static int create_survivability_sysfs(struct pci_dev *pdev)
 
  static int enable_boot_survivability_mode(struct pci_dev *pdev)
  {
-	struct device *dev = &pdev->dev;
  	struct xe_device *xe = pdev_to_xe_device(pdev);
  	struct xe_survivability *survivability = &xe->survivability;
  	int ret = 0;
@@ -342,12 +343,12 @@ static int enable_boot_survivability_mode(struct pci_dev *pdev)
  	if (ret)
  		goto err;
 
Quoted 5 lines

drivers/gpu/drm/xe/xe_survivability_mode.c static int enable_boot_survivability_mode(struct pci_dev *pdev) · line 347

Quoted 4 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -2
-	dev_err(dev, "In Survivability Mode\n");
-
+	xe_log_emit(pdev, check_boot_failure(xe) ? CPER_SEV_FATAL : CPER_SEV_INFORMATIONAL,
+		    XE_SIGID_SURVIVABILITY, 0, 0, 0, 0, "In Survivability Boot Mode\n");

Please make it cleaner and simpler.

sure

it was one of the earliest examples of the new xe_log API, and that's why it was using the base xe_log function

Quoted 6 lines

if(check_boot_failure(xe))

    xe_log_err_fatal(xe, SURVIVABILITY, .. );

else

Quoted 7 lines
Quoted 6 lines

     xe_log_info(xe, SURVIVABILITY, .. );

OR

xe_log_emit(xe_any_to_pdev(xe),

we do have pdev already, no need to cast back to xe

Agreed!

Quoted 6 lines
Quoted 5 lines

            check_boot_failure(xe) ? CPER_SEV_FATAL : CPER_SEV_INFORMATIONAL, XE_SIGID_SURVIVABILITY, XE_LOG_COMPONENT_SURVIVABILITY, xe_log_location(xe),
            &survivability->boot_status, sizeof(survivability->boot_status),

cool, but isn't this already printed in log_survivability_info() ?

it's not print both, either it print log_survivability_info() (based on condition and return) or enable_boot_survivability_mode.

Quoted 5 lines
Quoted 2 lines

            "In Survivability Boot Mode\n");

btw, as we use SURVIVABILITY component, the dmesg will already have "SURVIVABILITY: " decoration, so maybe this msg should be:

Quoted 7 lines

"Boot mode enabled!\n"

with dmesg:

<3> [drm] ERROR SIGID=103 FATAL (04) SURVIVABILITY: Boot mode enabled!
or
<6> [drm] SIGID=103 SURVIVABILITY: Boot mode enabled!

Agreed!

Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/xe/xe_survivability_mode.c static int enable_boot_survivability_mode(struct pci_dev *pdev) · line 351

Quoted 6 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
  	return 0;
 
  err:
-	dev_err(dev, "Failed to enable Survivability Mode\n");
+	xe_log_err_fatal(xe, SURVIVABILITY, ret, "Failed to enable Survivability Mode\n");

and here:

Quoted 6 lines

"Failed to enter Boot mode!\n"

with dmesg:

<3> [drm] ERROR SIGID=103 FATAL (-ENOMEM) SURVIVABILITY: Failed to enter Boot mode!

Make sense.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +0 -0
  	survivability->mode = false;
  	return ret;
  }
@@ -412,7 +413,7 @@ void xe_survivability_mode_runtime_enable(struct xe_device *xe)
  	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
 
Quoted 7 lines
Quoted 4 lines

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 416

Quoted 3 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
  	if (!IS_DGFX(xe) || IS_SRIOV_VF(xe) || xe->info.platform < XE_BATTLEMAGE) {
-		dev_err(&pdev->dev, "Runtime Survivability Mode not supported\n");
+		xe_log_info(xe, SURVIVABILITY, "Runtime Mode not supported!\n");

We can add xe_log_err(xe, SURVIVABILITY, -EOPNOTSUPP, ...);

hmm, actually I was wondering if this dev_err() was correct maybe it should be just xe_dbg() as we are not doing anything related to SURVIVABILITY ?

That function is called in runtime survivability, so debugger will get the context easily and figure it out

what cause it.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +0 -0
  		return;
  	}
 
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 423

Quoted 2 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +0 -0
@@ -422,11 +423,14 @@ void xe_survivability_mode_runtime_enable(struct xe_device *xe)
  		dev_err(&pdev->dev, "Failed to create survivability sysfs\n");

need to use xe_log_err(xe, SURVIVABILITY. -EIO, ... );

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 426

Quoted 4 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +1 -1
  	survivability->type = XE_SURVIVABILITY_TYPE_RUNTIME;
-	dev_err(&pdev->dev, "Runtime Survivability mode enabled\n");
+	xe_log_err_fatal(xe, SURVIVABILITY, 0, "Runtime Mode enabled!\n");

hmm, Logging error as fatal, however passing err=0 (Success). is it right? or simply we can log as xe_log_err or xe_log_info ? any thoughts.

Already I checked with Arch team, better to provide as xe_log_info rather than fatal. Just indicate to user it's Runtime survivability mode in such case.

Quoted 10 lines

passing 0 instead of errno to xe_log_err() helpers will just omit printing anything in ( ), no %pe nor %phN

whether this should be info/fatal/recoverable it's not me to answer your initial documentation [1] was saying that all XE_SIG_SURVIVABILITY should have CPER_SEV_FATAL

[1]https://patchwork.freedesktop.org/patch/732271/?series=168333&rev=1

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 6 lines

drivers/gpu/drm/xe/xe_survivability_mode.c void xe_survivability_mode_runtime_enable(struct xe_device *xe) · line 431

Quoted 5 lines
  	xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_VENDOR);
  	xe_device_declare_wedged(xe);
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -1
-	dev_err(&pdev->dev, "Firmware flash required, Please refer to the userspace documentation for more details!\n");
+
+	xe_log_err_fatal(xe, SURVIVABILITY, 0, "Firmware flash required!\n");

ditto

ditto ;)

ditto ;)

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/xe/xe_survivability_mode.c +2 -0
+	xe_info(xe, "Please refer to the userspace documentation for more details how to flash the firmware on %s!\n",
+		xe->info.platform_name);
  }
 
  /**
#52 lore raw

PATCH v3 20/23 drm/xe/pcode: Report 'Mailbox failed' error using SIGID

In reply to Michal Wajdeczko

Report 'Mailbox failed' error using xe_log() helper.

Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
 drivers/gpu/drm/xe/xe_pcode.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_pcode.c +2 -3
index ccc3bdeed6bb..014632e11338 100644
@@ -14,6 +14,7 @@
 #include "regs/xe_pmt.h"
 #include "xe_assert.h"
 #include "xe_device.h"
+#include "xe_log.h"
 #include "xe_mmio.h"
 #include "xe_pcode_api.h"
 #include "xe_pm.h"
@@ -61,9 +62,7 @@ static int pcode_mailbox_status(struct xe_tile *tile)
 	}
 
 	if (err) {
-		drm_err(&tile_to_xe(tile)->drm, "PCODE Mailbox failed: %d %s",
-			err_decode, err_str);
-
+		xe_log_err(tile, PCODE, err_decode, "Mailbox failed: %s\n", err_str);
 		return err_decode;
 	}
 
Signature · 1 line
2.47.1
Reviewed-by on v3 20/23
#53 lore raw

Re: [PATCH v3 20/23] drm/xe/pcode: Report 'Mailbox failed' error using SIGID

Quoted 1 line · Michal Wajdeczko

Report 'Mailbox failed' error using xe_log() helper.

Please change to xe_log_err()

with that

Quoted 33 lines
Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
  drivers/gpu/drm/xe/xe_pcode.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_pcode.c +2 -3
index ccc3bdeed6bb..014632e11338 100644
@@ -14,6 +14,7 @@
  #include "regs/xe_pmt.h"
  #include "xe_assert.h"
  #include "xe_device.h"
+#include "xe_log.h"
  #include "xe_mmio.h"
  #include "xe_pcode_api.h"
  #include "xe_pm.h"
@@ -61,9 +62,7 @@ static int pcode_mailbox_status(struct xe_tile *tile)
  	}
 
  	if (err) {
-		drm_err(&tile_to_xe(tile)->drm, "PCODE Mailbox failed: %d %s",
-			err_decode, err_str);
-
+		xe_log_err(tile, PCODE, err_decode, "Mailbox failed: %s\n", err_str);
  		return err_decode;
  	}
 
#54 lore raw

PATCH v3 22/23 drm/xe/gt: Report 'pagefault' errors using SIGID

In reply to Michal Wajdeczko

Report 'Queue full/Unsuccessful response' pagefault errors using xe_log() helpers.

Cc Rodrigo Vivi <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
 drivers/gpu/drm/xe/xe_pagefault.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/xe/xe_pagefault.c +5 -5
index dd3c068e1a39..e78c855759e1 100644
@@ -14,6 +14,7 @@
 #include "xe_gt_types.h"
 #include "xe_gt_stats.h"
 #include "xe_hw_engine.h"
+#include "xe_log.h"
 #include "xe_pagefault.h"
 #include "xe_pagefault_types.h"
 #include "xe_svm.h"
@@ -309,8 +310,7 @@ static void xe_pagefault_queue_work(struct work_struct *w)
 			xe_pagefault_save_to_vm(gt_to_xe(pf.gt), &pf);
 			if (!(pf.consumer.access_type & XE_PAGEFAULT_ACCESS_PREFETCH)) {
 				xe_pagefault_print(&pf);
-				xe_gt_info(pf.gt, "Fault response: Unsuccessful %pe\n",
-					   ERR_PTR(err));
+				xe_log_err(pf.gt, PAGEFAULT, err, "Fault response: Unsuccessful\n");
 			} else {
 				xe_gt_stats_incr(pf.gt, XE_GT_STATS_ID_INVALID_PREFETCH_PAGEFAULT_COUNT, 1);
 				xe_gt_dbg(pf.gt, "Prefetch Fault response: Unsuccessful %pe\n",
@@ -487,9 +487,9 @@ int xe_pagefault_handler(struct xe_device *xe, struct xe_pagefault *pf)
 			pf_queue->size;
 		queue_work(xe->usm.pf_wq, &pf_queue->worker);
 	} else {
-		drm_warn(&xe->drm,
-			 "PageFault Queue (%d) full, shouldn't be possible\n",
-			 pf->consumer.asid % XE_PAGEFAULT_QUEUE_COUNT);
+		xe_log_err(xe, PAGEFAULT, -ENOSPC,
+			   "Queue (%d) full, shouldn't be possible\n",
+			   pf->consumer.asid % XE_PAGEFAULT_QUEUE_COUNT);
 	}
 	spin_unlock_irqrestore(&pf_queue->lock, flags);
 
Signature · 1 line
2.47.1
#55 lore raw

Re: [PATCH v3 22/23] drm/xe/gt: Report 'pagefault' errors using SIGID

Quoted 26 lines · Michal Wajdeczko

Report 'Queue full/Unsuccessful response' pagefault errors using xe_log() helpers.

Cc Rodrigo Vivi<[email protected]>
Cc Matthew Brost<[email protected]>
Cc Daniele Ceraolo Spurio<[email protected]>
Cc Aravind Iddamsetty<[email protected]>
Cc Mallesh Koujalagi<[email protected]>
---
  drivers/gpu/drm/xe/xe_pagefault.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/xe/xe_pagefault.c +1 -0
index dd3c068e1a39..e78c855759e1 100644
@@ -14,6 +14,7 @@
  #include "xe_gt_types.h"
  #include "xe_gt_stats.h"
  #include "xe_hw_engine.h"
+#include "xe_log.h"
  #include "xe_pagefault.h"
  #include "xe_pagefault_types.h"
  #include "xe_svm.h" @@ -309,8 +310,7 @@ static void xe_pagefault_queue_work(struct 

work_struct *w) xe_pagefault_save_to_vm(gt_to_xe(pf.gt), &pf); if (!(pf.consumer.access_type & XE_PAGEFAULT_ACCESS_PREFETCH)) { xe_pagefault_print(&pf); - xe_gt_info(pf.gt, "Fault response: Unsuccessful %pe\n",

drivers/gpu/drm/xe/xe_pagefault.c static void xe_pagefault_queue_work(struct work_struct *w) · line 313

Quoted 2 lines
drivers/gpu/drm/xe/xe_pagefault.c +1 -1
-					   ERR_PTR(err));
+				xe_log_err(pf.gt, PAGEFAULT, err, "Fault response: Unsuccessful\n");

Drop Fault in message, otherwise "Page Fault:  Fault response: Unsuccessful"

Thanks,

-/Mallesh

Quoted 16 lines
  			} else {
  				xe_gt_stats_incr(pf.gt, XE_GT_STATS_ID_INVALID_PREFETCH_PAGEFAULT_COUNT, 1);
  				xe_gt_dbg(pf.gt, "Prefetch Fault response: Unsuccessful %pe\n",
drivers/gpu/drm/xe/xe_pagefault.c +3 -3
@@ -487,9 +487,9 @@ int xe_pagefault_handler(struct xe_device *xe, struct xe_pagefault *pf)
  			pf_queue->size;
  		queue_work(xe->usm.pf_wq, &pf_queue->worker);
  	} else {
-		drm_warn(&xe->drm,
-			 "PageFault Queue (%d) full, shouldn't be possible\n",
-			 pf->consumer.asid % XE_PAGEFAULT_QUEUE_COUNT);
+		xe_log_err(xe, PAGEFAULT, -ENOSPC,
+			   "Queue (%d) full, shouldn't be possible\n",
+			   pf->consumer.asid % XE_PAGEFAULT_QUEUE_COUNT);
  	}
  	spin_unlock_irqrestore(&pf_queue->lock, flags);
 
#56 lore raw

PATCH v3 23/23 drm/xe/pci: Report 'cannot re-enable' error using SIGID

In reply to Michal Wajdeczko

Report 'cannot re-enable PCI device' error using xe_log() helper.

Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
 drivers/gpu/drm/xe/xe_pci_error.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pci_error.c +5 -2
index e41af2ac7f23..fb965f52be5e 100644
@@ -7,6 +7,7 @@
 
 #include "xe_device.h"
 #include "xe_gt.h"
+#include "xe_log.h"
 #include "xe_pci.h"
 #include "xe_pm.h"
 #include "xe_printk.h"
@@ -90,13 +91,15 @@ static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev)
 {
 	const struct pci_device_id *ent = pci_match_id(pdev->driver->id_table, pdev);
 	struct xe_device *xe = pdev_to_xe_device(pdev);
+	int err;
 
 	xe_info(xe, "PCI error: slot reset\n");
 
 	pci_restore_state(pdev);
 
-	if (pci_enable_device(pdev)) {
-		xe_err(xe, "Cannot re-enable PCI device after reset\n");
+	err = pci_enable_device(pdev);
+	if (err) {
+		xe_log_err_fatal(xe, PCI, err, "Cannot re-enable PCI device after reset\n");
 		return PCI_ERS_RESULT_DISCONNECT;
 	}
 
Signature · 1 line
2.47.1
#57 lore raw

Re: [PATCH v3 23/23] drm/xe/pci: Report 'cannot re-enable' error using SIGID

Quoted 24 lines · Michal Wajdeczko

Report 'cannot re-enable PCI device' error using xe_log() helper.

Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
  drivers/gpu/drm/xe/xe_pci_error.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pci_error.c +1 -0
index e41af2ac7f23..fb965f52be5e 100644
@@ -7,6 +7,7 @@
 
  #include "xe_device.h"
  #include "xe_gt.h"
+#include "xe_log.h"
  #include "xe_pci.h"
  #include "xe_pm.h"
  #include "xe_printk.h"

drivers/gpu/drm/xe/xe_pci_error.c static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev) · line 96

Quoted 6 lines
drivers/gpu/drm/xe/xe_pci_error.c +1 -0
@@ -90,13 +91,15 @@ static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev)
  {
  	const struct pci_device_id *ent = pci_match_id(pdev->driver->id_table, pdev);
  	struct xe_device *xe = pdev_to_xe_device(pdev);
+	int err;
 
  	xe_info(xe, "PCI error: slot reset\n");

Please use xe_log_info.

drivers/gpu/drm/xe/xe_pci_error.c static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev) · line 102

Quoted 8 lines
drivers/gpu/drm/xe/xe_pci_error.c +3 -2
  	pci_restore_state(pdev);
 
-	if (pci_enable_device(pdev)) {
-		xe_err(xe, "Cannot re-enable PCI device after reset\n");
+	err = pci_enable_device(pdev);
+	if (err) {
+		xe_log_err_fatal(xe, PCI, err, "Cannot re-enable PCI device after reset\n");

PCI component used XE_SIGID_SW looks semantic mismatch, we can add DRIVER_HARDWARE with PCI and make

a PCIe link failure that required active recovery right?

Thanks,

-/Mallesh

Quoted 3 lines
drivers/gpu/drm/xe/xe_pci_error.c +0 -0
  		return PCI_ERS_RESULT_DISCONNECT;
  	}
 
#58 lore raw

Re: [PATCH v3 23/23] drm/xe/pci: Report 'cannot re-enable' error using SIGID

Quoted 23 lines · Koujalagi
Quoted 21 lines · Michal Wajdeczko

Report 'cannot re-enable PCI device' error using xe_log() helper.

Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>

---
  drivers/gpu/drm/xe/xe_pci_error.c | 7 +++++--

  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pci_error.c +1 -0
index e41af2ac7f23..fb965f52be5e 100644
@@ -7,6 +7,7 @@
     #include "xe_device.h"
   #include "xe_gt.h"
+#include "xe_log.h"
   #include "xe_pci.h"
   #include "xe_pm.h"
Quoted 8 lines

drivers/gpu/drm/xe/xe_pci_error.c static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev) · line 95

Quoted 7 lines
drivers/gpu/drm/xe/xe_pci_error.c +1 -0
   #include "xe_printk.h"
@@ -90,13 +91,15 @@ static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev)
   {
       const struct pci_device_id *ent = pci_match_id(pdev->driver->id_table, pdev);
       struct xe_device *xe = pdev_to_xe_device(pdev);
+    int err;
         xe_info(xe, "PCI error: slot reset\n");

Please use xe_log_info.

but do we care now?

it's info only and I guess we should prioritize to convert real errors into SIGID logs first

Quoted 8 lines

drivers/gpu/drm/xe/xe_pci_error.c static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev) · line 102

Quoted 6 lines
drivers/gpu/drm/xe/xe_pci_error.c +3 -1
         pci_restore_state(pdev);
   -    if (pci_enable_device(pdev)) {
-        xe_err(xe, "Cannot re-enable PCI device after reset\n");
+    err = pci_enable_device(pdev);
+    if (err) {
+        xe_log_err_fatal(xe, PCI, err, "Cannot re-enable PCI device after reset\n");

PCI component used XE_SIGID_SW looks semantic mismatch, we can add DRIVER_HARDWARE with PCI

but introduced in patch 3/23 component PCI represents the component that is beyond our Xe driver (part of the SYSTEM) as we don't manage that directly

and since our SIGID choices are limited, the generic SIGID_SW is the most applicable IMO

if you disagree, please comment patch 3/23 as it is already reviewed

Quoted 3 lines

and make

a PCIe link failure that required active recovery right?

this code is already part of the HW error handling maybe we should (or there is) declare wedged

but I don't want to make here any changes beyond simple conversion from xe_err() to xe_log_err()

Quoted 8 lines

Thanks,

-/Mallesh

Quoted 3 lines
drivers/gpu/drm/xe/xe_pci_error.c +0 -0
           return PCI_ERS_RESULT_DISCONNECT;
       }

#59 lore raw

Re: [PATCH v3 23/23] drm/xe/pci: Report 'cannot re-enable' error using SIGID

Quoted 32 lines · Michal Wajdeczko
Quoted 22 lines · Koujalagi
Quoted 21 lines · Michal Wajdeczko

Report 'cannot re-enable PCI device' error using xe_log() helper.

Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>
---
   drivers/gpu/drm/xe/xe_pci_error.c | 7 +++++--
   1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pci_error.c +1 -0
index e41af2ac7f23..fb965f52be5e 100644
@@ -7,6 +7,7 @@
     #include "xe_device.h"
   #include "xe_gt.h"
+#include "xe_log.h"
   #include "xe_pci.h"
   #include "xe_pm.h"
Quoted 8 lines

drivers/gpu/drm/xe/xe_pci_error.c static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev) · line 95

Quoted 7 lines
drivers/gpu/drm/xe/xe_pci_error.c +1 -0
   #include "xe_printk.h"
@@ -90,13 +91,15 @@ static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev)
   {
       const struct pci_device_id *ent = pci_match_id(pdev->driver->id_table, pdev);
       struct xe_device *xe = pdev_to_xe_device(pdev);
+    int err;
         xe_info(xe, "PCI error: slot reset\n");

Please use xe_log_info.

Quoted 1 line

but do we care now?

Since it's showing PCI error message so up to you!

Quoted 2 lines

it's info only and I guess we should prioritize to convert real errors into SIGID logs first

Agreed!

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/xe/xe_pci_error.c +3 -1
         pci_restore_state(pdev);
   -    if (pci_enable_device(pdev)) {
-        xe_err(xe, "Cannot re-enable PCI device after reset\n");
+    err = pci_enable_device(pdev);
+    if (err) {
+        xe_log_err_fatal(xe, PCI, err, "Cannot re-enable PCI device after reset\n");
Quoted 7 lines
Quoted 1 line

PCI component used XE_SIGID_SW looks semantic mismatch, we can add DRIVER_HARDWARE with PCI

but introduced in patch 3/23 component PCI represents the component that is beyond our Xe driver (part of the SYSTEM) as we don't manage that directly

and since our SIGID choices are limited, the generic SIGID_SW is the most applicable IMO

hmm, I know, we've limited SIGID choice, PCI with SW sigid is broader scope however in this case PCI is initiating slot reset

if it's making sense we can use it right?

Quoted 2 lines

if you disagree, please comment patch 3/23 as it is already reviewed

That was just my suggestion up to you!!

Quoted 8 lines
Quoted 3 lines

and make

a PCIe link failure that required active recovery right?

this code is already part of the HW error handling maybe we should (or there is) declare wedged

but I don't want to make here any changes beyond simple conversion from xe_err() to xe_log_err()

hmm, ok

Thanks,

-/Mallesh

Quoted 7 lines
Quoted 7 lines

Thanks,

-/Mallesh

Quoted 3 lines
drivers/gpu/drm/xe/xe_pci_error.c +0 -0
           return PCI_ERS_RESULT_DISCONNECT;
       }
 
#60 lore raw

✗ CI.checkpatch: warning for drm/xe: Add structured SIGID error logging infrastructure (rev3)

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: drm/xe: Add structured SIGID error logging infrastructure (rev3)
URL : https://patchwork.freedesktop.org/series/171022/
State : warning

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 061140b9bc586ae7f40abc1249c97e1cc72d1b9d
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 134863cf20fd6c0391fd8f7ea3dca2b4c6d42d8a

Author: Michal Wajdeczko <[email protected]>
Date:   Thu Jul 30 17:21:19 2026 +0200

drm/xe/pci: Report 'cannot re-enable' error using SIGID

Report 'cannot re-enable PCI device' error using xe_log() helper.

Cc Rodrigo Vivi <[email protected]>
Cc Riana Tauro <[email protected]>
Cc Aravind Iddamsetty <[email protected]>
Cc Mallesh Koujalagi <[email protected]>

+ /mt/dim checkpatch 5e24f68d311764bf343f9def49b752b509dfd5fd drm-intel 1104637ebb9d drm/xe: Introduce xe_any helpers
-:24: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #24:
new file mode 100644

-:39: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #39: FILE: drivers/gpu/drm/xe/xe_any.h:11:
+#define __xe_any_to_self_assoc(type, any) \
+ const type * : (any), \
+ type * : (any)

BUT SEE:

do {} while (0) advice is over-stated in a few situations:

The more obvious case is macros, like MODULE_PARM_DESC, invoked at file-scope, where C disallows code (it must be in functions). See $exceptions if you have one to add by name.

More troublesome is declarative macros used at top of new scope, like DECLARE_PER_CPU. These might just compile with a do-while-0 wrapper, but would be incorrect. Most of these are handled by detecting struct,union,etc declaration primitives in $exceptions.

Theres also macros called inside an if (block), which "return" an expression. These cannot do-while, and need a ({}) wrapper.

Enjoy this qualification while we work to improve our heuristics.

-:39: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'any' - possible side-effects? #39: FILE: drivers/gpu/drm/xe/xe_any.h:11:
+#define __xe_any_to_self_assoc(type, any) \
+ const type * : (any), \
+ type * : (any)

-:50: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'any' - possible side-effects? #50: FILE: drivers/gpu/drm/xe/xe_any.h:22:
+#define xe_any_if_type(any, type) \
+ _Generic((any), \
+ __xe_any_to_self_assoc(type, (any)), \
+ default : NULL)

-:53: WARNING:TABSTOP: Statements should start on a tabstop #53: FILE: drivers/gpu/drm/xe/xe_any.h:25:
+ default : NULL)

-:53: ERROR:TRAILING_STATEMENTS: trailing statements should be on next line #53: FILE: drivers/gpu/drm/xe/xe_any.h:25:
+ default : NULL)

-:87: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'const' - possible side-effects? #87: FILE: drivers/gpu/drm/xe/xe_any.h:59:
+#define __xe_any_to_other_assoc(const, from, other, p) \
+ const struct from * : __##from##_to_##other((const struct from *)(p))

-:87: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'from' - possible side-effects? #87: FILE: drivers/gpu/drm/xe/xe_any.h:59:
+#define __xe_any_to_other_assoc(const, from, other, p) \
+ const struct from * : __##from##_to_##other((const struct from *)(p))

-:87: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'from' may be better as '(from)' to avoid precedence issues #87: FILE: drivers/gpu/drm/xe/xe_any.h:59:
+#define __xe_any_to_other_assoc(const, from, other, p) \
+ const struct from * : __##from##_to_##other((const struct from *)(p))

-:103: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'any' - possible side-effects? #103: FILE: drivers/gpu/drm/xe/xe_any.h:75:
+#define xe_any_to_xe(any) \
+ _Generic((any), \
+ __xe_any_to_self_assoc(struct xe_device, (any)), \
+ __xe_any_to_other_assoc(/* */, xe_tile, xe_device, (any)), \
+ __xe_any_to_other_assoc(const, xe_tile, xe_device, (any)), \
+ __xe_any_to_other_assoc(/* */, xe_gt, xe_device, (any)), \
+ __xe_any_to_other_assoc(const, xe_gt, xe_device, (any)), \
+ __xe_any_to_other_assoc(, drm_device, xe_device, (any)), \
+ __xe_any_to_other_assoc(, pci_dev, xe_device, (any)), \
+ __xe_any_to_other_assoc(, device, xe_device, (any)))

-:120: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'any' - possible side-effects? #120: FILE: drivers/gpu/drm/xe/xe_any.h:92:
+#define xe_any_to_drm(any) \
+ _Generic((any), \
+ __xe_any_to_self_assoc(struct drm_device, (any)), \
+ default : &xe_any_to_xe(any)->drm)

-:123: WARNING:TABSTOP: Statements should start on a tabstop #123: FILE: drivers/gpu/drm/xe/xe_any.h:95:
+ default : &xe_any_to_xe(any)->drm)

-:123: ERROR:TRAILING_STATEMENTS: trailing statements should be on next line #123: FILE: drivers/gpu/drm/xe/xe_any.h:95:
+ default : &xe_any_to_xe(any)->drm)

-:131: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'any' - possible side-effects? #131: FILE: drivers/gpu/drm/xe/xe_any.h:103:
+#define xe_any_to_dev(any) \
+ _Generic((any), \
+ __xe_any_to_self_assoc(struct device, (any)), \
+ __xe_any_to_other_assoc(, pci_dev, device, (any)), \
+ default : xe_any_to_drm(any)->dev)

-:135: WARNING:TABSTOP: Statements should start on a tabstop #135: FILE: drivers/gpu/drm/xe/xe_any.h:107:
+ default : xe_any_to_drm(any)->dev)

-:135: ERROR:TRAILING_STATEMENTS: trailing statements should be on next line #135: FILE: drivers/gpu/drm/xe/xe_any.h:107:
+ default : xe_any_to_drm(any)->dev)

-:143: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'any' - possible side-effects? #143: FILE: drivers/gpu/drm/xe/xe_any.h:115:
+#define xe_any_to_pdev(any) \
+ _Generic((any), \
+ __xe_any_to_self_assoc(struct pci_dev, (any)), \
+ default : to_pci_dev(xe_any_to_dev(any)))

-:146: WARNING:TABSTOP: Statements should start on a tabstop #146: FILE: drivers/gpu/drm/xe/xe_any.h:118:
+ default : to_pci_dev(xe_any_to_dev(any)))

-:146: ERROR:TRAILING_STATEMENTS: trailing statements should be on next line #146: FILE: drivers/gpu/drm/xe/xe_any.h:118:
+ default : to_pci_dev(xe_any_to_dev(any)))

-:157: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'any' - possible side-effects? #157: FILE: drivers/gpu/drm/xe/xe_any.h:129:
+#define xe_any_id(any) \
+ _Generic((any), \
+ __xe_any_to_other_assoc(/* */, xe_tile, id, (any)), \
+ __xe_any_to_other_assoc(const, xe_tile, id, (any)), \
+ __xe_any_to_other_assoc(/* */, xe_gt, id, (any)), \
+ __xe_any_to_other_assoc(const, xe_gt, id, (any)), \
+ default : 0)

-:163: WARNING:TABSTOP: Statements should start on a tabstop #163: FILE: drivers/gpu/drm/xe/xe_any.h:135:
+ default : 0)

-:163: ERROR:TRAILING_STATEMENTS: trailing statements should be on next line #163: FILE: drivers/gpu/drm/xe/xe_any.h:135:
+ default : 0)

total: 6 errors, 6 warnings, 10 checks, 137 lines checked
2e9b4150b3a0 drm/xe/log: Add structured SIGID error logging infrastructure
-:35: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #35:
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 363 lines checked
01c2ec090967 drm/xe/log: Introduce structured component/location identifiers -:17: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #17:
new file mode 100644

-:152: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #152: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:131:
+#define DEFINE_XE_LOG_COMPONENTS(define) \
+ /* */ \
+ define(SYSTEM, 1, PCI, SW, "Linux PCI Subsystem") \
+ define(SYSTEM, 2, DRM, SW, "DRM") \
+ /* */ \
+ define(DRIVER, 1, XE, SW, "Xe Driver") \
+ define(DRIVER, 2, PROBE, PROBE, "Driver Initialization") \
+ define(DRIVER, 3, WEDGED, WEDGED, "Device Malfunction") \
+ define(DRIVER, 4, RTP, SW, "Register Table Processing") \
+ define(DRIVER, 5, WA, SW, "Workarounds") \
+ define(DRIVER, 6, PAGEFAULT, MEM_FAULT, "Page Fault") \
+ /* */ \
+ define(DRIVER_HARDWARE, 1, REGS, IO_BUS, "Registers") \
+ define(DRIVER_HARDWARE, 2, GGTT, IO_BUS, "Global GTT") \
+ define(DRIVER_HARDWARE, 3, GT, GT_TDR, "Graphics Technology") \
+ define(DRIVER_HARDWARE, 4, LMTT, IO_BUS, "LMEM Translation Table") \
+ define(DRIVER_HARDWARE, 5, MEMIRQ, IO_BUS, "Memory Based IRQ") \
+ /* */ \
+ define(DRIVER_FEATURE, 1, PF, SW, "SR-IOV Physical Function") \
+ define(DRIVER_FEATURE, 2, VF, SW, "SR-IOV Virtual Function") \
+ define(DRIVER_FEATURE, 3, SURVIVABILITY, SURVIVABILITY, "Survivability") \
+ define(DRIVER_FEATURE, 4, RAS, SW, "Reliability, Accessibility, Serviceability") \
+ /* */ \
+ define(DRIVER_FIRMWARE, 1, GUC, RUNTIME_FW, "GuC") \
+ define(DRIVER_FIRMWARE, 2, HUC, RUNTIME_FW, "HuC") \
+ define(DRIVER_FIRMWARE, 3, GSC, RUNTIME_FW, "GSC") \
+ define(DRIVER_FIRMWARE, 16, PCODE, DEVICE_FW, "PCode") \
+ define(DRIVER_FIRMWARE, 17, SYSCTRL, DEVICE_FW, "System Controller") \
+ /* eod */

BUT SEE:

do {} while (0) advice is over-stated in a few situations:

The more obvious case is macros, like MODULE_PARM_DESC, invoked at file-scope, where C disallows code (it must be in functions). See $exceptions if you have one to add by name.

More troublesome is declarative macros used at top of new scope, like DECLARE_PER_CPU. These might just compile with a do-while-0 wrapper, but would be incorrect. Most of these are handled by detecting struct,union,etc declaration primitives in $exceptions.

Theres also macros called inside an if (block), which "return" an expression. These cannot do-while, and need a ({}) wrapper.

Enjoy this qualification while we work to improve our heuristics.

-:152: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'define' - possible side-effects? #152: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:131:
+#define DEFINE_XE_LOG_COMPONENTS(define) \
+ /* */ \
+ define(SYSTEM, 1, PCI, SW, "Linux PCI Subsystem") \
+ define(SYSTEM, 2, DRM, SW, "DRM") \
+ /* */ \
+ define(DRIVER, 1, XE, SW, "Xe Driver") \
+ define(DRIVER, 2, PROBE, PROBE, "Driver Initialization") \
+ define(DRIVER, 3, WEDGED, WEDGED, "Device Malfunction") \
+ define(DRIVER, 4, RTP, SW, "Register Table Processing") \
+ define(DRIVER, 5, WA, SW, "Workarounds") \
+ define(DRIVER, 6, PAGEFAULT, MEM_FAULT, "Page Fault") \
+ /* */ \
+ define(DRIVER_HARDWARE, 1, REGS, IO_BUS, "Registers") \
+ define(DRIVER_HARDWARE, 2, GGTT, IO_BUS, "Global GTT") \
+ define(DRIVER_HARDWARE, 3, GT, GT_TDR, "Graphics Technology") \
+ define(DRIVER_HARDWARE, 4, LMTT, IO_BUS, "LMEM Translation Table") \
+ define(DRIVER_HARDWARE, 5, MEMIRQ, IO_BUS, "Memory Based IRQ") \
+ /* */ \
+ define(DRIVER_FEATURE, 1, PF, SW, "SR-IOV Physical Function") \
+ define(DRIVER_FEATURE, 2, VF, SW, "SR-IOV Virtual Function") \
+ define(DRIVER_FEATURE, 3, SURVIVABILITY, SURVIVABILITY, "Survivability") \
+ define(DRIVER_FEATURE, 4, RAS, SW, "Reliability, Accessibility, Serviceability") \
+ /* */ \
+ define(DRIVER_FIRMWARE, 1, GUC, RUNTIME_FW, "GuC") \
+ define(DRIVER_FIRMWARE, 2, HUC, RUNTIME_FW, "HuC") \
+ define(DRIVER_FIRMWARE, 3, GSC, RUNTIME_FW, "GSC") \
+ define(DRIVER_FIRMWARE, 16, PCODE, DEVICE_FW, "PCode") \
+ define(DRIVER_FIRMWARE, 17, SYSCTRL, DEVICE_FW, "System Controller") \
+ /* eod */

-:187: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #187: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:166:
+#define MAKE_XE_LOG_COMPONENT_ENUM(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ XE_LOG_COMPONENT_##_TAG = MAKE_XE_LOG_COMPONENT(_CLASS, (_ID)), \
+ XE_LOG_COMPONENT_##_CLASS##_##_ID = XE_LOG_COMPONENT_##_TAG, \
+ /* eod */

BUT SEE:

do {} while (0) advice is over-stated in a few situations:

The more obvious case is macros, like MODULE_PARM_DESC, invoked at file-scope, where C disallows code (it must be in functions). See $exceptions if you have one to add by name.

More troublesome is declarative macros used at top of new scope, like DECLARE_PER_CPU. These might just compile with a do-while-0 wrapper, but would be incorrect. Most of these are handled by detecting struct,union,etc declaration primitives in $exceptions.

Theres also macros called inside an if (block), which "return" an expression. These cannot do-while, and need a ({}) wrapper.

Enjoy this qualification while we work to improve our heuristics.

-:187: WARNING:MACRO_ARG_UNUSED: Argument '_SIG' is not used in function-like macro #187: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:166:
+#define MAKE_XE_LOG_COMPONENT_ENUM(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ XE_LOG_COMPONENT_##_TAG = MAKE_XE_LOG_COMPONENT(_CLASS, (_ID)), \
+ XE_LOG_COMPONENT_##_CLASS##_##_ID = XE_LOG_COMPONENT_##_TAG, \
+ /* eod */

-:187: WARNING:MACRO_ARG_UNUSED: Argument '_NAME' is not used in function-like macro #187: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:166:
+#define MAKE_XE_LOG_COMPONENT_ENUM(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ XE_LOG_COMPONENT_##_TAG = MAKE_XE_LOG_COMPONENT(_CLASS, (_ID)), \
+ XE_LOG_COMPONENT_##_CLASS##_##_ID = XE_LOG_COMPONENT_##_TAG, \
+ /* eod */

-:200: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #200: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:179:
+#define MAKE_XE_LOG_COMPONENT_SIGID(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ XE_LOG_COMPONENT_##_TAG##_SIGID = XE_SIGID_##_SIG, \
+ /* eod */

BUT SEE:

do {} while (0) advice is over-stated in a few situations:

The more obvious case is macros, like MODULE_PARM_DESC, invoked at file-scope, where C disallows code (it must be in functions). See $exceptions if you have one to add by name.

More troublesome is declarative macros used at top of new scope, like DECLARE_PER_CPU. These might just compile with a do-while-0 wrapper, but would be incorrect. Most of these are handled by detecting struct,union,etc declaration primitives in $exceptions.

Theres also macros called inside an if (block), which "return" an expression. These cannot do-while, and need a ({}) wrapper.

Enjoy this qualification while we work to improve our heuristics.

-:200: WARNING:MACRO_ARG_UNUSED: Argument '_CLASS' is not used in function-like macro #200: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:179:
+#define MAKE_XE_LOG_COMPONENT_SIGID(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ XE_LOG_COMPONENT_##_TAG##_SIGID = XE_SIGID_##_SIG, \
+ /* eod */

-:200: WARNING:MACRO_ARG_UNUSED: Argument '_ID' is not used in function-like macro #200: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:179:
+#define MAKE_XE_LOG_COMPONENT_SIGID(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ XE_LOG_COMPONENT_##_TAG##_SIGID = XE_SIGID_##_SIG, \
+ /* eod */

-:200: WARNING:MACRO_ARG_UNUSED: Argument '_NAME' is not used in function-like macro #200: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:179:
+#define MAKE_XE_LOG_COMPONENT_SIGID(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ XE_LOG_COMPONENT_##_TAG##_SIGID = XE_SIGID_##_SIG, \
+ /* eod */

total: 3 errors, 6 warnings, 1 checks, 186 lines checked a71ac3694436 drm/xe/log: Add component/location decorations to dmesg -:40: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon #40: FILE: drivers/gpu/drm/xe/xe_log.c:26:
+#define MAKE_XE_LOG_COMPONENT_CLASS_PREFIX(_CLASS) \
+ case XE_LOG_COMPONENT_CLASS_##_CLASS: return #_CLASS "? ";

-:55: WARNING:MACRO_ARG_UNUSED: Argument '_CLASS' is not used in function-like macro #55: FILE: drivers/gpu/drm/xe/xe_log.c:41:
+#define MAKE_XE_LOG_COMPONENT_CASE_PREFIX(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return #_TAG ": ";

-:55: WARNING:MACRO_ARG_UNUSED: Argument '_ID' is not used in function-like macro #55: FILE: drivers/gpu/drm/xe/xe_log.c:41:
+#define MAKE_XE_LOG_COMPONENT_CASE_PREFIX(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return #_TAG ": ";

-:55: WARNING:MACRO_ARG_UNUSED: Argument '_SIG' is not used in function-like macro #55: FILE: drivers/gpu/drm/xe/xe_log.c:41:
+#define MAKE_XE_LOG_COMPONENT_CASE_PREFIX(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return #_TAG ": ";

-:55: WARNING:MACRO_ARG_UNUSED: Argument '_NAME' is not used in function-like macro #55: FILE: drivers/gpu/drm/xe/xe_log.c:41:
+#define MAKE_XE_LOG_COMPONENT_CASE_PREFIX(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return #_TAG ": ";

-:55: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon #55: FILE: drivers/gpu/drm/xe/xe_log.c:41:
+#define MAKE_XE_LOG_COMPONENT_CASE_PREFIX(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return #_TAG ": ";

total: 0 errors, 6 warnings, 0 checks, 126 lines checked e0ddd154a05d drm/xe/log: Add SIGID log helpers for severity 8196ff7a09c5 drm/xe/log: Add SIGID log helpers for location
-:44: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'any' - possible side-effects? #44: FILE: drivers/gpu/drm/xe/xe_log.h:49:
+#define xe_log_location(any) \
+ PREP_XE_LOG_LOCATION(xe_log_location_type(any), xe_any_id(any))

total: 0 errors, 0 warnings, 1 checks, 47 lines checked
72c346c194d9 drm/xe/log: Add SIGID log helpers for location & severity 0fe82a8702af drm/xe/log: Add SIGID log helpers for components 6c4987878ea9 drm/xe/log: Add SIGID log helpers for errno-only 5828bebeeab1 drm/xe/log: Add hardware error signatures
94da8c283f42 drm/xe/log: Extend components list with hardware items
-:23: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #23: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:135:
+#define DEFINE_XE_LOG_SOFTWARE_COMPONENTS(define) \
/* */ \
define(SYSTEM, 1, PCI, SW, "Linux PCI Subsystem") \
define(SYSTEM, 2, DRM, SW, "DRM") \

BUT SEE:

do {} while (0) advice is over-stated in a few situations:

The more obvious case is macros, like MODULE_PARM_DESC, invoked at file-scope, where C disallows code (it must be in functions). See $exceptions if you have one to add by name.

More troublesome is declarative macros used at top of new scope, like DECLARE_PER_CPU. These might just compile with a do-while-0 wrapper, but would be incorrect. Most of these are handled by detecting struct,union,etc declaration primitives in $exceptions.

Theres also macros called inside an if (block), which "return" an expression. These cannot do-while, and need a ({}) wrapper.

Enjoy this qualification while we work to improve our heuristics.

-:23: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'define' - possible side-effects? #23: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:135:
+#define DEFINE_XE_LOG_SOFTWARE_COMPONENTS(define) \
/* */ \
define(SYSTEM, 1, PCI, SW, "Linux PCI Subsystem") \
define(SYSTEM, 2, DRM, SW, "DRM") \

-:32: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #32: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:164:
+#define DEFINE_XE_LOG_HARDWARE_COMPONENTS(define) \
+ define(HARDWARE, 1, DEVMEM, DEVICE_MEMORY, "Device Memory") \
+ define(HARDWARE, 2, HWCORE, CORE_COMPUTE, "Core Compute") \
+ /* HARDWARE, 3, RESERVED */ \
+ define(HARDWARE, 4, PCIE, PCIE, "PCIe Interface") \
+ define(HARDWARE, 5, FABRIC, FABRIC, "Fabric") \
+ define(HARDWARE, 6, SOC, SOC_INTERNAL, "SoC Internal") \
/* eod */

BUT SEE:

do {} while (0) advice is over-stated in a few situations:

The more obvious case is macros, like MODULE_PARM_DESC, invoked at file-scope, where C disallows code (it must be in functions). See $exceptions if you have one to add by name.

More troublesome is declarative macros used at top of new scope, like DECLARE_PER_CPU. These might just compile with a do-while-0 wrapper, but would be incorrect. Most of these are handled by detecting struct,union,etc declaration primitives in $exceptions.

Theres also macros called inside an if (block), which "return" an expression. These cannot do-while, and need a ({}) wrapper.

Enjoy this qualification while we work to improve our heuristics.

-:32: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'define' - possible side-effects? #32: FILE: drivers/gpu/drm/xe/abi/xe_log_abi.h:164:
+#define DEFINE_XE_LOG_HARDWARE_COMPONENTS(define) \
+ define(HARDWARE, 1, DEVMEM, DEVICE_MEMORY, "Device Memory") \
+ define(HARDWARE, 2, HWCORE, CORE_COMPUTE, "Core Compute") \
+ /* HARDWARE, 3, RESERVED */ \
+ define(HARDWARE, 4, PCIE, PCIE, "PCIe Interface") \
+ define(HARDWARE, 5, FABRIC, FABRIC, "Fabric") \
+ define(HARDWARE, 6, SOC, SOC_INTERNAL, "SoC Internal") \
/* eod */

total: 2 errors, 0 warnings, 2 checks, 24 lines checked
d2d2d640a48f drm/xe/ras: Check RAS and LOG component definitions
06331dd4fcaf drm/xe/kunit: Setup driver data in the test device
fa4405457be7 drm/xe/tests: Add Kunit tests for xe_log
-:15: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #15:
new file mode 100644

-:47: WARNING:MACRO_ARG_UNUSED: Argument '_CLASS' is not used in function-like macro #47: FILE: drivers/gpu/drm/xe/tests/xe_log_kunit.c:28:
+#define make_component_tag_case(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return _NAME;

-:47: WARNING:MACRO_ARG_UNUSED: Argument '_ID' is not used in function-like macro #47: FILE: drivers/gpu/drm/xe/tests/xe_log_kunit.c:28:
+#define make_component_tag_case(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return _NAME;

-:47: WARNING:MACRO_ARG_UNUSED: Argument '_SIG' is not used in function-like macro #47: FILE: drivers/gpu/drm/xe/tests/xe_log_kunit.c:28:
+#define make_component_tag_case(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return _NAME;

-:47: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon #47: FILE: drivers/gpu/drm/xe/tests/xe_log_kunit.c:28:
+#define make_component_tag_case(_CLASS, _ID, _TAG, _SIG, _NAME) \
+ case XE_LOG_COMPONENT_##_TAG: return _NAME;

-:522: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #522: FILE: drivers/gpu/drm/xe/tests/xe_log_kunit.c:503:
+ xe_log_emit(pdev, CPER_SEV_FATAL, XE_SIGID_PROBE,
+ param->comp, param->loc,

total: 0 errors, 5 warnings, 1 checks, 577 lines checked
13223ad8afe9 drm/xe/tests: Add kunit tests for xe_any
-:24: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #24:
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 195 lines checked f9fc901a845b drm/xe: Report 'probe blocked' error using SIGID 55171a73c3d5 drm/xe: Report 'device wedged' errors using SIGID a90d1ad6f571 drm/xe: Report 'Survivability Mode' errors using SIGID f504a12a26da drm/xe/guc: Report 'GuC mmio' errors using SIGID 4b1ef0ba18fc drm/xe/pcode: Report 'Mailbox failed' error using SIGID e658f45ffc9f drm/xe/gt: Report 'reset failed' errors using SIGID 93f9798b6dc3 drm/xe/gt: Report 'pagefault' errors using SIGID 134863cf20fd drm/xe/pci: Report 'cannot re-enable' error using SIGID