[PATCH v2 08/10] PCI/FLIT: Add trace event for flit errors
From: Yazen Ghannam
Date: Fri Sep 18 2026 - 11:05:32 EST
Emit a trace event for each flit error logged from the Flit Error Log.
The event carries both Error Log registers.
Assisted-by: LLM
Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
---
drivers/pci/pcie/flit.c | 3 +++
include/ras/ras_event.h | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
index 7c0b9c8dd481..9eb804035997 100644
--- a/drivers/pci/pcie/flit.c
+++ b/drivers/pci/pcie/flit.c
@@ -18,6 +18,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <ras/ras_event.h>
#include "portdrv.h"
#include "../pci.h"
@@ -205,6 +206,8 @@ static void flit_report(struct pci_dev *pdev, u32 err_log1, u32 err_log2)
return;
pci_warn(pdev, "ErrLog1: 0x%08x ErrLog2: 0x%08x\n", err_log1, err_log2);
+
+ trace_flit_event(pci_name(pdev), err_log1, err_log2);
}
static irqreturn_t flit_ist(int irq, void *context)
diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
index fdb785fa4613..427585505dd6 100644
--- a/include/ras/ras_event.h
+++ b/include/ras/ras_event.h
@@ -381,6 +381,44 @@ TRACE_EVENT(aer_event,
"Not available")
);
#endif /* CONFIG_PCIEAER */
+
+/*
+ * PCIe Flit Logging trace event
+ *
+ * One event is generated for each flit error the driver logs from the Flit
+ * Error Log of a PCIe Flit Mode port.
+ *
+ * char * dev_name - The name of the slot where the device resides
+ * ([domain:]bus:device.function).
+ * u32 err_log1 - Flit Error Log 1 register value.
+ * u32 err_log2 - Flit Error Log 2 register value.
+ */
+#ifdef CONFIG_PCIE_FLIT
+TRACE_EVENT(flit_event,
+ TP_PROTO(const char *dev_name,
+ const u32 err_log1,
+ const u32 err_log2),
+
+ TP_ARGS(dev_name, err_log1, err_log2),
+
+ TP_STRUCT__entry(
+ __string( dev_name, dev_name )
+ __field( u32, err_log1 )
+ __field( u32, err_log2 )
+ ),
+
+ TP_fast_assign(
+ __assign_str(dev_name);
+ __entry->err_log1 = err_log1;
+ __entry->err_log2 = err_log2;
+ ),
+
+ TP_printk("%s err_log1:0x%08x err_log2:0x%08x",
+ __get_str(dev_name),
+ __entry->err_log1,
+ __entry->err_log2)
+);
+#endif /* CONFIG_PCIE_FLIT */
#endif /* _TRACE_HW_EVENT_MC_H */
/* This part must be outside protection */
--
2.43.0