blob: 79abb9c71772efa32c41fb448fd3beaddbd3e66e [file] [log] [blame]
Mauro Carvalho Chehab53f2d022012-02-23 08:10:34 -03001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM ras
3#define TRACE_INCLUDE_FILE ras_event
4
5#if !defined(_TRACE_HW_EVENT_MC_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_HW_EVENT_MC_H
7
8#include <linux/tracepoint.h>
9#include <linux/edac.h>
10#include <linux/ktime.h>
Chen, Gong99d44022014-08-13 02:22:37 -040011#include <linux/pci.h>
Chen, Gong0a2409a2014-06-11 13:57:27 -070012#include <linux/aer.h>
Chen, Gong2dfb7d52014-06-17 22:33:07 -040013#include <linux/cper.h>
14
15/*
16 * MCE Extended Error Log trace event
17 *
18 * These events are generated when hardware detects a corrected or
19 * uncorrected event.
20 */
21
22/* memory trace event */
23
24#if defined(CONFIG_ACPI_EXTLOG) || defined(CONFIG_ACPI_EXTLOG_MODULE)
25TRACE_EVENT(extlog_mem_event,
26 TP_PROTO(struct cper_sec_mem_err *mem,
27 u32 err_seq,
28 const uuid_le *fru_id,
29 const char *fru_text,
30 u8 sev),
31
32 TP_ARGS(mem, err_seq, fru_id, fru_text, sev),
33
34 TP_STRUCT__entry(
35 __field(u32, err_seq)
36 __field(u8, etype)
37 __field(u8, sev)
38 __field(u64, pa)
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)
43 ),
44
45 TP_fast_assign(
46 __entry->err_seq = err_seq;
47 if (mem->validation_bits & CPER_MEM_VALID_ERROR_TYPE)
48 __entry->etype = mem->error_type;
49 else
50 __entry->etype = ~0;
51 __entry->sev = sev;
52 if (mem->validation_bits & CPER_MEM_VALID_PA)
53 __entry->pa = mem->physical_addr;
54 else
55 __entry->pa = ~0ull;
56
57 if (mem->validation_bits & CPER_MEM_VALID_PA_MASK)
58 __entry->pa_mask_lsb = (u8)__ffs64(mem->physical_addr_mask);
59 else
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);
64 ),
65
66 TP_printk("{%d} %s error: %s physical addr: %016llx (mask lsb: %x) %sFRU: %pUl %.20s",
67 __entry->err_seq,
68 cper_severity_str(__entry->sev),
69 cper_mem_err_type_str(__entry->etype),
70 __entry->pa,
71 __entry->pa_mask_lsb,
72 cper_mem_err_unpack(p, &__entry->data),
73 &__entry->fru_id,
74 __get_str(fru_text))
75);
76#endif
Mauro Carvalho Chehab53f2d022012-02-23 08:10:34 -030077
78/*
79 * Hardware Events Report
80 *
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.
84 *
85 * FIXME: Add events for handling memory errors originated from the
86 * MCE subsystem.
87 */
88
89/*
90 * Hardware-independent Memory Controller specific events
91 */
92
93/*
94 * Default error mechanisms for Memory Controller errors (CE and UE)
95 */
96TRACE_EVENT(mc_event,
97
98 TP_PROTO(const unsigned int err_type,
99 const char *error_msg,
100 const char *label,
101 const int error_count,
102 const u8 mc_index,
103 const s8 top_layer,
104 const s8 mid_layer,
105 const s8 low_layer,
106 unsigned long address,
107 const u8 grain_bits,
108 unsigned long syndrome,
109 const char *driver_detail),
110
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),
114
115 TP_STRUCT__entry(
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 )
128 ),
129
130 TP_fast_assign(
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);
143 ),
144
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,
Mauro Carvalho Chehab8dd93d42013-02-19 21:26:22 -0300147 mc_event_error_type(__entry->error_type),
Mauro Carvalho Chehab53f2d022012-02-23 08:10:34 -0300148 __entry->error_count > 1 ? "s" : "",
149 ((char *)__get_str(msg))[0] ? " " : "",
150 __get_str(msg),
151 __get_str(label),
152 __entry->mc_index,
153 __entry->top_layer,
154 __entry->middle_layer,
155 __entry->lower_layer,
156 __entry->address,
157 1 << __entry->grain_bits,
158 __entry->syndrome,
159 ((char *)__get_str(driver_detail))[0] ? " " : "",
160 __get_str(driver_detail))
161);
162
Chen, Gong0a2409a2014-06-11 13:57:27 -0700163/*
164 * PCIe AER Trace event
165 *
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:
169 *
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
175 */
176
Chen, Gongcb9a6842014-08-13 02:22:39 -0400177#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"}
Chen, Gong0a2409a2014-06-11 13:57:27 -0700186
Chen, Gongcb9a6842014-08-13 02:22:39 -0400187#define aer_uncorrectable_errors \
Chen, Gong846fc702014-08-13 02:22:40 -0400188 {PCI_ERR_UNC_UND, "Undefined"}, \
Chen, Gongcb9a6842014-08-13 02:22:39 -0400189 {PCI_ERR_UNC_DLP, "Data Link Protocol Error"}, \
190 {PCI_ERR_UNC_SURPDN, "Surprise Down Error"}, \
Chen, Gong99d44022014-08-13 02:22:37 -0400191 {PCI_ERR_UNC_POISON_TLP,"Poisoned TLP"}, \
Chen, Gongcb9a6842014-08-13 02:22:39 -0400192 {PCI_ERR_UNC_FCP, "Flow Control Protocol Error"}, \
Chen, Gong99d44022014-08-13 02:22:37 -0400193 {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"}, \
Chen, Gongcb9a6842014-08-13 02:22:39 -0400198 {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"}
Chen, Gong0a2409a2014-06-11 13:57:27 -0700205
206TRACE_EVENT(aer_event,
207 TP_PROTO(const char *dev_name,
208 const u32 status,
209 const u8 severity),
210
211 TP_ARGS(dev_name, status, severity),
212
213 TP_STRUCT__entry(
214 __string( dev_name, dev_name )
215 __field( u32, status )
216 __field( u8, severity )
217 ),
218
219 TP_fast_assign(
220 __assign_str(dev_name, dev_name);
221 __entry->status = status;
222 __entry->severity = severity;
223 ),
224
225 TP_printk("%s PCIe Bus Error: severity=%s, %s\n",
226 __get_str(dev_name),
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))
233);
234
Mauro Carvalho Chehab53f2d022012-02-23 08:10:34 -0300235#endif /* _TRACE_HW_EVENT_MC_H */
236
237/* This part must be outside protection */
238#include <trace/define_trace.h>