2 #define TRACE_SYSTEM ras
3 #define TRACE_INCLUDE_FILE ras_event
5 #if !defined(_TRACE_HW_EVENT_MC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_HW_EVENT_MC_H
8 #include <linux/tracepoint.h>
9 #include <linux/edac.h>
10 #include <linux/ktime.h>
11 #include <linux/pci.h>
12 #include <linux/aer.h>
13 #include <linux/cper.h>
16 * MCE Extended Error Log trace event
18 * These events are generated when hardware detects a corrected or
22 /* memory trace event */
24 #if defined(CONFIG_ACPI_EXTLOG) || defined(CONFIG_ACPI_EXTLOG_MODULE)
25 TRACE_EVENT(extlog_mem_event
,
26 TP_PROTO(struct cper_sec_mem_err
*mem
,
28 const uuid_le
*fru_id
,
32 TP_ARGS(mem
, err_seq
, fru_id
, fru_text
, sev
),
39 __field(u8
, pa_mask_lsb
)
40 __field_struct(uuid_le
, fru_id
)
41 __string(fru_text
, fru_text
)
42 __field_struct(struct cper_mem_err_compact
, data
)
46 __entry
->err_seq
= err_seq
;
47 if (mem
->validation_bits
& CPER_MEM_VALID_ERROR_TYPE
)
48 __entry
->etype
= mem
->error_type
;
52 if (mem
->validation_bits
& CPER_MEM_VALID_PA
)
53 __entry
->pa
= mem
->physical_addr
;
57 if (mem
->validation_bits
& CPER_MEM_VALID_PA_MASK
)
58 __entry
->pa_mask_lsb
= (u8
)__ffs64(mem
->physical_addr_mask
);
60 __entry
->pa_mask_lsb
= ~0;
61 __entry
->fru_id
= *fru_id
;
62 __assign_str(fru_text
, fru_text
);
63 cper_mem_err_pack(mem
, &__entry
->data
);
66 TP_printk("{%d} %s error: %s physical addr: %016llx (mask lsb: %x) %sFRU: %pUl %.20s",
68 cper_severity_str(__entry
->sev
),
69 cper_mem_err_type_str(__entry
->etype
),
72 cper_mem_err_unpack(p
, &__entry
->data
),
79 * Hardware Events Report
81 * Those events are generated when hardware detected a corrected or
82 * uncorrected event, and are meant to replace the current API to report
83 * errors defined on both EDAC and MCE subsystems.
85 * FIXME: Add events for handling memory errors originated from the
90 * Hardware-independent Memory Controller specific events
94 * Default error mechanisms for Memory Controller errors (CE and UE)
98 TP_PROTO(const unsigned int err_type
,
99 const char *error_msg
,
101 const int error_count
,
106 unsigned long address
,
108 unsigned long syndrome
,
109 const char *driver_detail
),
111 TP_ARGS(err_type
, error_msg
, label
, error_count
, mc_index
,
112 top_layer
, mid_layer
, low_layer
, address
, grain_bits
,
113 syndrome
, driver_detail
),
116 __field( unsigned int, error_type
)
117 __string( msg
, error_msg
)
118 __string( label
, label
)
119 __field( u16
, error_count
)
120 __field( u8
, mc_index
)
121 __field( s8
, top_layer
)
122 __field( s8
, middle_layer
)
123 __field( s8
, lower_layer
)
124 __field( long, address
)
125 __field( u8
, grain_bits
)
126 __field( long, syndrome
)
127 __string( driver_detail
, driver_detail
)
131 __entry
->error_type
= err_type
;
132 __assign_str(msg
, error_msg
);
133 __assign_str(label
, label
);
134 __entry
->error_count
= error_count
;
135 __entry
->mc_index
= mc_index
;
136 __entry
->top_layer
= top_layer
;
137 __entry
->middle_layer
= mid_layer
;
138 __entry
->lower_layer
= low_layer
;
139 __entry
->address
= address
;
140 __entry
->grain_bits
= grain_bits
;
141 __entry
->syndrome
= syndrome
;
142 __assign_str(driver_detail
, driver_detail
);
145 TP_printk("%d %s error%s:%s%s on %s (mc:%d location:%d:%d:%d address:0x%08lx grain:%d syndrome:0x%08lx%s%s)",
146 __entry
->error_count
,
147 mc_event_error_type(__entry
->error_type
),
148 __entry
->error_count
> 1 ? "s" : "",
149 ((char *)__get_str(msg
))[0] ? " " : "",
154 __entry
->middle_layer
,
155 __entry
->lower_layer
,
157 1 << __entry
->grain_bits
,
159 ((char *)__get_str(driver_detail
))[0] ? " " : "",
160 __get_str(driver_detail
))
164 * PCIe AER Trace event
166 * These events are generated when hardware detects a corrected or
167 * uncorrected event on a PCIe device. The event report has
168 * the following structure:
170 * char * dev_name - The name of the slot where the device resides
171 * ([domain:]bus:device.function).
172 * u32 status - Either the correctable or uncorrectable register
173 * indicating what error or errors have been seen
174 * u8 severity - error severity 0:NONFATAL 1:FATAL 2:CORRECTED
177 #define aer_correctable_errors \
178 {PCI_ERR_COR_RCVR, "Receiver Error"}, \
179 {PCI_ERR_COR_BAD_TLP, "Bad TLP"}, \
180 {PCI_ERR_COR_BAD_DLLP, "Bad DLLP"}, \
181 {PCI_ERR_COR_REP_ROLL, "RELAY_NUM Rollover"}, \
182 {PCI_ERR_COR_REP_TIMER, "Replay Timer Timeout"}, \
183 {PCI_ERR_COR_ADV_NFAT, "Advisory Non-Fatal Error"}, \
184 {PCI_ERR_COR_INTERNAL, "Corrected Internal Error"}, \
185 {PCI_ERR_COR_LOG_OVER, "Header Log Overflow"}
187 #define aer_uncorrectable_errors \
188 {PCI_ERR_UNC_UND, "Undefined"}, \
189 {PCI_ERR_UNC_DLP, "Data Link Protocol Error"}, \
190 {PCI_ERR_UNC_SURPDN, "Surprise Down Error"}, \
191 {PCI_ERR_UNC_POISON_TLP,"Poisoned TLP"}, \
192 {PCI_ERR_UNC_FCP, "Flow Control Protocol Error"}, \
193 {PCI_ERR_UNC_COMP_TIME, "Completion Timeout"}, \
194 {PCI_ERR_UNC_COMP_ABORT,"Completer Abort"}, \
195 {PCI_ERR_UNC_UNX_COMP, "Unexpected Completion"}, \
196 {PCI_ERR_UNC_RX_OVER, "Receiver Overflow"}, \
197 {PCI_ERR_UNC_MALF_TLP, "Malformed TLP"}, \
198 {PCI_ERR_UNC_ECRC, "ECRC Error"}, \
199 {PCI_ERR_UNC_UNSUP, "Unsupported Request Error"}, \
200 {PCI_ERR_UNC_ACSV, "ACS Violation"}, \
201 {PCI_ERR_UNC_INTN, "Uncorrectable Internal Error"},\
202 {PCI_ERR_UNC_MCBTLP, "MC Blocked TLP"}, \
203 {PCI_ERR_UNC_ATOMEG, "AtomicOp Egress Blocked"}, \
204 {PCI_ERR_UNC_TLPPRE, "TLP Prefix Blocked Error"}
206 TRACE_EVENT(aer_event
,
207 TP_PROTO(const char *dev_name
,
211 TP_ARGS(dev_name
, status
, severity
),
214 __string( dev_name
, dev_name
)
215 __field( u32
, status
)
216 __field( u8
, severity
)
220 __assign_str(dev_name
, dev_name
);
221 __entry
->status
= status
;
222 __entry
->severity
= severity
;
225 TP_printk("%s PCIe Bus Error: severity=%s, %s\n",
227 __entry
->severity
== AER_CORRECTABLE
? "Corrected" :
228 __entry
->severity
== AER_FATAL
?
229 "Fatal" : "Uncorrected, non-fatal",
230 __entry
->severity
== AER_CORRECTABLE
?
231 __print_flags(__entry
->status
, "|", aer_correctable_errors
) :
232 __print_flags(__entry
->status
, "|", aer_uncorrectable_errors
))
235 #endif /* _TRACE_HW_EVENT_MC_H */
237 /* This part must be outside protection */
238 #include <trace/define_trace.h>