]>
Commit | Line | Data |
---|---|---|
1a59d1b8 | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
e22a2274 MS |
2 | /* |
3 | * Machine check exception header file. | |
4 | * | |
e22a2274 MS |
5 | * Copyright 2013 IBM Corporation |
6 | * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> | |
7 | */ | |
8 | ||
9 | #ifndef __ASM_PPC64_MCE_H__ | |
10 | #define __ASM_PPC64_MCE_H__ | |
11 | ||
12 | #include <linux/bitops.h> | |
13 | ||
36df96f8 MS |
14 | enum MCE_Version { |
15 | MCE_V1 = 1, | |
16 | }; | |
17 | ||
18 | enum MCE_Severity { | |
19 | MCE_SEV_NO_ERROR = 0, | |
20 | MCE_SEV_WARNING = 1, | |
cda6618d | 21 | MCE_SEV_SEVERE = 2, |
36df96f8 MS |
22 | MCE_SEV_FATAL = 3, |
23 | }; | |
24 | ||
25 | enum MCE_Disposition { | |
26 | MCE_DISPOSITION_RECOVERED = 0, | |
27 | MCE_DISPOSITION_NOT_RECOVERED = 1, | |
28 | }; | |
29 | ||
30 | enum MCE_Initiator { | |
31 | MCE_INITIATOR_UNKNOWN = 0, | |
32 | MCE_INITIATOR_CPU = 1, | |
33 | }; | |
34 | ||
35 | enum MCE_ErrorType { | |
36 | MCE_ERROR_TYPE_UNKNOWN = 0, | |
37 | MCE_ERROR_TYPE_UE = 1, | |
38 | MCE_ERROR_TYPE_SLB = 2, | |
39 | MCE_ERROR_TYPE_ERAT = 3, | |
40 | MCE_ERROR_TYPE_TLB = 4, | |
7b9f71f9 NP |
41 | MCE_ERROR_TYPE_USER = 5, |
42 | MCE_ERROR_TYPE_RA = 6, | |
43 | MCE_ERROR_TYPE_LINK = 7, | |
36df96f8 MS |
44 | }; |
45 | ||
50dbabe0 MS |
46 | enum MCE_ErrorClass { |
47 | MCE_ECLASS_UNKNOWN = 0, | |
48 | MCE_ECLASS_HARDWARE, | |
49 | MCE_ECLASS_HARD_INDETERMINATE, | |
50 | MCE_ECLASS_SOFTWARE, | |
51 | MCE_ECLASS_SOFT_INDETERMINATE, | |
52 | }; | |
53 | ||
36df96f8 MS |
54 | enum MCE_UeErrorType { |
55 | MCE_UE_ERROR_INDETERMINATE = 0, | |
56 | MCE_UE_ERROR_IFETCH = 1, | |
57 | MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2, | |
58 | MCE_UE_ERROR_LOAD_STORE = 3, | |
59 | MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4, | |
60 | }; | |
61 | ||
62 | enum MCE_SlbErrorType { | |
63 | MCE_SLB_ERROR_INDETERMINATE = 0, | |
64 | MCE_SLB_ERROR_PARITY = 1, | |
65 | MCE_SLB_ERROR_MULTIHIT = 2, | |
66 | }; | |
67 | ||
68 | enum MCE_EratErrorType { | |
69 | MCE_ERAT_ERROR_INDETERMINATE = 0, | |
70 | MCE_ERAT_ERROR_PARITY = 1, | |
71 | MCE_ERAT_ERROR_MULTIHIT = 2, | |
72 | }; | |
73 | ||
74 | enum MCE_TlbErrorType { | |
75 | MCE_TLB_ERROR_INDETERMINATE = 0, | |
76 | MCE_TLB_ERROR_PARITY = 1, | |
77 | MCE_TLB_ERROR_MULTIHIT = 2, | |
78 | }; | |
79 | ||
7b9f71f9 NP |
80 | enum MCE_UserErrorType { |
81 | MCE_USER_ERROR_INDETERMINATE = 0, | |
82 | MCE_USER_ERROR_TLBIE = 1, | |
83 | }; | |
84 | ||
85 | enum MCE_RaErrorType { | |
86 | MCE_RA_ERROR_INDETERMINATE = 0, | |
87 | MCE_RA_ERROR_IFETCH = 1, | |
90df4bfb NP |
88 | MCE_RA_ERROR_IFETCH_FOREIGN = 2, |
89 | MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH = 3, | |
90 | MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN = 4, | |
91 | MCE_RA_ERROR_LOAD = 5, | |
92 | MCE_RA_ERROR_STORE = 6, | |
93 | MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 7, | |
94 | MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN = 8, | |
95 | MCE_RA_ERROR_LOAD_STORE_FOREIGN = 9, | |
7b9f71f9 NP |
96 | }; |
97 | ||
98 | enum MCE_LinkErrorType { | |
99 | MCE_LINK_ERROR_INDETERMINATE = 0, | |
100 | MCE_LINK_ERROR_IFETCH_TIMEOUT = 1, | |
101 | MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT = 2, | |
102 | MCE_LINK_ERROR_LOAD_TIMEOUT = 3, | |
103 | MCE_LINK_ERROR_STORE_TIMEOUT = 4, | |
104 | MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT = 5, | |
105 | }; | |
106 | ||
36df96f8 | 107 | struct machine_check_event { |
cda6618d MS |
108 | enum MCE_Version version:8; |
109 | u8 in_use; | |
110 | enum MCE_Severity severity:8; | |
111 | enum MCE_Initiator initiator:8; | |
112 | enum MCE_ErrorType error_type:8; | |
50dbabe0 | 113 | enum MCE_ErrorClass error_class:8; |
cda6618d MS |
114 | enum MCE_Disposition disposition:8; |
115 | bool sync_error; | |
116 | u16 cpu; | |
117 | u64 gpr3; | |
118 | u64 srr0; | |
119 | u64 srr1; | |
120 | union { | |
36df96f8 MS |
121 | struct { |
122 | enum MCE_UeErrorType ue_error_type:8; | |
cda6618d MS |
123 | u8 effective_address_provided; |
124 | u8 physical_address_provided; | |
125 | u8 reserved_1[5]; | |
126 | u64 effective_address; | |
127 | u64 physical_address; | |
128 | u8 reserved_2[8]; | |
36df96f8 MS |
129 | } ue_error; |
130 | ||
131 | struct { | |
132 | enum MCE_SlbErrorType slb_error_type:8; | |
cda6618d MS |
133 | u8 effective_address_provided; |
134 | u8 reserved_1[6]; | |
135 | u64 effective_address; | |
136 | u8 reserved_2[16]; | |
36df96f8 MS |
137 | } slb_error; |
138 | ||
139 | struct { | |
140 | enum MCE_EratErrorType erat_error_type:8; | |
cda6618d MS |
141 | u8 effective_address_provided; |
142 | u8 reserved_1[6]; | |
143 | u64 effective_address; | |
144 | u8 reserved_2[16]; | |
36df96f8 MS |
145 | } erat_error; |
146 | ||
147 | struct { | |
148 | enum MCE_TlbErrorType tlb_error_type:8; | |
cda6618d MS |
149 | u8 effective_address_provided; |
150 | u8 reserved_1[6]; | |
151 | u64 effective_address; | |
152 | u8 reserved_2[16]; | |
36df96f8 | 153 | } tlb_error; |
7b9f71f9 NP |
154 | |
155 | struct { | |
156 | enum MCE_UserErrorType user_error_type:8; | |
cda6618d MS |
157 | u8 effective_address_provided; |
158 | u8 reserved_1[6]; | |
159 | u64 effective_address; | |
160 | u8 reserved_2[16]; | |
7b9f71f9 NP |
161 | } user_error; |
162 | ||
163 | struct { | |
164 | enum MCE_RaErrorType ra_error_type:8; | |
cda6618d MS |
165 | u8 effective_address_provided; |
166 | u8 reserved_1[6]; | |
167 | u64 effective_address; | |
168 | u8 reserved_2[16]; | |
7b9f71f9 NP |
169 | } ra_error; |
170 | ||
171 | struct { | |
172 | enum MCE_LinkErrorType link_error_type:8; | |
cda6618d MS |
173 | u8 effective_address_provided; |
174 | u8 reserved_1[6]; | |
175 | u64 effective_address; | |
176 | u8 reserved_2[16]; | |
7b9f71f9 | 177 | } link_error; |
36df96f8 MS |
178 | } u; |
179 | }; | |
180 | ||
181 | struct mce_error_info { | |
182 | enum MCE_ErrorType error_type:8; | |
183 | union { | |
184 | enum MCE_UeErrorType ue_error_type:8; | |
185 | enum MCE_SlbErrorType slb_error_type:8; | |
186 | enum MCE_EratErrorType erat_error_type:8; | |
187 | enum MCE_TlbErrorType tlb_error_type:8; | |
7b9f71f9 NP |
188 | enum MCE_UserErrorType user_error_type:8; |
189 | enum MCE_RaErrorType ra_error_type:8; | |
190 | enum MCE_LinkErrorType link_error_type:8; | |
36df96f8 | 191 | } u; |
c1bbf387 NP |
192 | enum MCE_Severity severity:8; |
193 | enum MCE_Initiator initiator:8; | |
50dbabe0 | 194 | enum MCE_ErrorClass error_class:8; |
cda6618d | 195 | bool sync_error; |
36df96f8 MS |
196 | }; |
197 | ||
198 | #define MAX_MC_EVT 100 | |
199 | ||
200 | /* Release flags for get_mce_event() */ | |
201 | #define MCE_EVENT_RELEASE true | |
202 | #define MCE_EVENT_DONTRELEASE false | |
203 | ||
204 | extern void save_mce_event(struct pt_regs *regs, long handled, | |
55672ecf | 205 | struct mce_error_info *mce_err, uint64_t nip, |
ba41e1e1 | 206 | uint64_t addr, uint64_t phys_addr); |
36df96f8 MS |
207 | extern int get_mce_event(struct machine_check_event *mce, bool release); |
208 | extern void release_mce_event(void); | |
b5ff4211 | 209 | extern void machine_check_queue_event(void); |
63f44d65 | 210 | extern void machine_check_print_event_info(struct machine_check_event *evt, |
c0577201 | 211 | bool user_mode, bool in_guest); |
7f177f98 | 212 | unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr); |
a43c1590 MS |
213 | #ifdef CONFIG_PPC_BOOK3S_64 |
214 | void flush_and_reload_slb(void); | |
215 | #endif /* CONFIG_PPC_BOOK3S_64 */ | |
e22a2274 | 216 | #endif /* __ASM_PPC64_MCE_H__ */ |