.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Machine check exception header file. |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License as published by |
---|
6 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
7 | | - * (at your option) any later version. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | | - * |
---|
14 | | - * You should have received a copy of the GNU General Public License |
---|
15 | | - * along with this program; if not, write to the Free Software |
---|
16 | | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
17 | 4 | * |
---|
18 | 5 | * Copyright 2013 IBM Corporation |
---|
19 | 6 | * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> |
---|
.. | .. |
---|
31 | 18 | enum MCE_Severity { |
---|
32 | 19 | MCE_SEV_NO_ERROR = 0, |
---|
33 | 20 | MCE_SEV_WARNING = 1, |
---|
34 | | - MCE_SEV_ERROR_SYNC = 2, |
---|
| 21 | + MCE_SEV_SEVERE = 2, |
---|
35 | 22 | MCE_SEV_FATAL = 3, |
---|
36 | 23 | }; |
---|
37 | 24 | |
---|
.. | .. |
---|
43 | 30 | enum MCE_Initiator { |
---|
44 | 31 | MCE_INITIATOR_UNKNOWN = 0, |
---|
45 | 32 | MCE_INITIATOR_CPU = 1, |
---|
| 33 | + MCE_INITIATOR_PCI = 2, |
---|
| 34 | + MCE_INITIATOR_ISA = 3, |
---|
| 35 | + MCE_INITIATOR_MEMORY= 4, |
---|
| 36 | + MCE_INITIATOR_POWERMGM = 5, |
---|
46 | 37 | }; |
---|
47 | 38 | |
---|
48 | 39 | enum MCE_ErrorType { |
---|
.. | .. |
---|
54 | 45 | MCE_ERROR_TYPE_USER = 5, |
---|
55 | 46 | MCE_ERROR_TYPE_RA = 6, |
---|
56 | 47 | MCE_ERROR_TYPE_LINK = 7, |
---|
| 48 | + MCE_ERROR_TYPE_DCACHE = 8, |
---|
| 49 | + MCE_ERROR_TYPE_ICACHE = 9, |
---|
| 50 | +}; |
---|
| 51 | + |
---|
| 52 | +enum MCE_ErrorClass { |
---|
| 53 | + MCE_ECLASS_UNKNOWN = 0, |
---|
| 54 | + MCE_ECLASS_HARDWARE, |
---|
| 55 | + MCE_ECLASS_HARD_INDETERMINATE, |
---|
| 56 | + MCE_ECLASS_SOFTWARE, |
---|
| 57 | + MCE_ECLASS_SOFT_INDETERMINATE, |
---|
57 | 58 | }; |
---|
58 | 59 | |
---|
59 | 60 | enum MCE_UeErrorType { |
---|
.. | .. |
---|
85 | 86 | enum MCE_UserErrorType { |
---|
86 | 87 | MCE_USER_ERROR_INDETERMINATE = 0, |
---|
87 | 88 | MCE_USER_ERROR_TLBIE = 1, |
---|
| 89 | + MCE_USER_ERROR_SCV = 2, |
---|
88 | 90 | }; |
---|
89 | 91 | |
---|
90 | 92 | enum MCE_RaErrorType { |
---|
.. | .. |
---|
110 | 112 | }; |
---|
111 | 113 | |
---|
112 | 114 | struct machine_check_event { |
---|
113 | | - enum MCE_Version version:8; /* 0x00 */ |
---|
114 | | - uint8_t in_use; /* 0x01 */ |
---|
115 | | - enum MCE_Severity severity:8; /* 0x02 */ |
---|
116 | | - enum MCE_Initiator initiator:8; /* 0x03 */ |
---|
117 | | - enum MCE_ErrorType error_type:8; /* 0x04 */ |
---|
118 | | - enum MCE_Disposition disposition:8; /* 0x05 */ |
---|
119 | | - uint8_t reserved_1[2]; /* 0x06 */ |
---|
120 | | - uint64_t gpr3; /* 0x08 */ |
---|
121 | | - uint64_t srr0; /* 0x10 */ |
---|
122 | | - uint64_t srr1; /* 0x18 */ |
---|
123 | | - union { /* 0x20 */ |
---|
| 115 | + enum MCE_Version version:8; |
---|
| 116 | + u8 in_use; |
---|
| 117 | + enum MCE_Severity severity:8; |
---|
| 118 | + enum MCE_Initiator initiator:8; |
---|
| 119 | + enum MCE_ErrorType error_type:8; |
---|
| 120 | + enum MCE_ErrorClass error_class:8; |
---|
| 121 | + enum MCE_Disposition disposition:8; |
---|
| 122 | + bool sync_error; |
---|
| 123 | + u16 cpu; |
---|
| 124 | + u64 gpr3; |
---|
| 125 | + u64 srr0; |
---|
| 126 | + u64 srr1; |
---|
| 127 | + union { |
---|
124 | 128 | struct { |
---|
125 | 129 | enum MCE_UeErrorType ue_error_type:8; |
---|
126 | | - uint8_t effective_address_provided; |
---|
127 | | - uint8_t physical_address_provided; |
---|
128 | | - uint8_t reserved_1[5]; |
---|
129 | | - uint64_t effective_address; |
---|
130 | | - uint64_t physical_address; |
---|
131 | | - uint8_t reserved_2[8]; |
---|
| 130 | + u8 effective_address_provided; |
---|
| 131 | + u8 physical_address_provided; |
---|
| 132 | + u8 ignore_event; |
---|
| 133 | + u8 reserved_1[4]; |
---|
| 134 | + u64 effective_address; |
---|
| 135 | + u64 physical_address; |
---|
| 136 | + u8 reserved_2[8]; |
---|
132 | 137 | } ue_error; |
---|
133 | 138 | |
---|
134 | 139 | struct { |
---|
135 | 140 | enum MCE_SlbErrorType slb_error_type:8; |
---|
136 | | - uint8_t effective_address_provided; |
---|
137 | | - uint8_t reserved_1[6]; |
---|
138 | | - uint64_t effective_address; |
---|
139 | | - uint8_t reserved_2[16]; |
---|
| 141 | + u8 effective_address_provided; |
---|
| 142 | + u8 reserved_1[6]; |
---|
| 143 | + u64 effective_address; |
---|
| 144 | + u8 reserved_2[16]; |
---|
140 | 145 | } slb_error; |
---|
141 | 146 | |
---|
142 | 147 | struct { |
---|
143 | 148 | enum MCE_EratErrorType erat_error_type:8; |
---|
144 | | - uint8_t effective_address_provided; |
---|
145 | | - uint8_t reserved_1[6]; |
---|
146 | | - uint64_t effective_address; |
---|
147 | | - uint8_t reserved_2[16]; |
---|
| 149 | + u8 effective_address_provided; |
---|
| 150 | + u8 reserved_1[6]; |
---|
| 151 | + u64 effective_address; |
---|
| 152 | + u8 reserved_2[16]; |
---|
148 | 153 | } erat_error; |
---|
149 | 154 | |
---|
150 | 155 | struct { |
---|
151 | 156 | enum MCE_TlbErrorType tlb_error_type:8; |
---|
152 | | - uint8_t effective_address_provided; |
---|
153 | | - uint8_t reserved_1[6]; |
---|
154 | | - uint64_t effective_address; |
---|
155 | | - uint8_t reserved_2[16]; |
---|
| 157 | + u8 effective_address_provided; |
---|
| 158 | + u8 reserved_1[6]; |
---|
| 159 | + u64 effective_address; |
---|
| 160 | + u8 reserved_2[16]; |
---|
156 | 161 | } tlb_error; |
---|
157 | 162 | |
---|
158 | 163 | struct { |
---|
159 | 164 | enum MCE_UserErrorType user_error_type:8; |
---|
160 | | - uint8_t effective_address_provided; |
---|
161 | | - uint8_t reserved_1[6]; |
---|
162 | | - uint64_t effective_address; |
---|
163 | | - uint8_t reserved_2[16]; |
---|
| 165 | + u8 effective_address_provided; |
---|
| 166 | + u8 reserved_1[6]; |
---|
| 167 | + u64 effective_address; |
---|
| 168 | + u8 reserved_2[16]; |
---|
164 | 169 | } user_error; |
---|
165 | 170 | |
---|
166 | 171 | struct { |
---|
167 | 172 | enum MCE_RaErrorType ra_error_type:8; |
---|
168 | | - uint8_t effective_address_provided; |
---|
169 | | - uint8_t reserved_1[6]; |
---|
170 | | - uint64_t effective_address; |
---|
171 | | - uint8_t reserved_2[16]; |
---|
| 173 | + u8 effective_address_provided; |
---|
| 174 | + u8 reserved_1[6]; |
---|
| 175 | + u64 effective_address; |
---|
| 176 | + u8 reserved_2[16]; |
---|
172 | 177 | } ra_error; |
---|
173 | 178 | |
---|
174 | 179 | struct { |
---|
175 | 180 | enum MCE_LinkErrorType link_error_type:8; |
---|
176 | | - uint8_t effective_address_provided; |
---|
177 | | - uint8_t reserved_1[6]; |
---|
178 | | - uint64_t effective_address; |
---|
179 | | - uint8_t reserved_2[16]; |
---|
| 181 | + u8 effective_address_provided; |
---|
| 182 | + u8 reserved_1[6]; |
---|
| 183 | + u64 effective_address; |
---|
| 184 | + u8 reserved_2[16]; |
---|
180 | 185 | } link_error; |
---|
181 | 186 | } u; |
---|
182 | 187 | }; |
---|
.. | .. |
---|
194 | 199 | } u; |
---|
195 | 200 | enum MCE_Severity severity:8; |
---|
196 | 201 | enum MCE_Initiator initiator:8; |
---|
| 202 | + enum MCE_ErrorClass error_class:8; |
---|
| 203 | + bool sync_error; |
---|
| 204 | + bool ignore_event; |
---|
197 | 205 | }; |
---|
198 | 206 | |
---|
199 | 207 | #define MAX_MC_EVT 100 |
---|
.. | .. |
---|
202 | 210 | #define MCE_EVENT_RELEASE true |
---|
203 | 211 | #define MCE_EVENT_DONTRELEASE false |
---|
204 | 212 | |
---|
| 213 | +struct pt_regs; |
---|
| 214 | +struct notifier_block; |
---|
| 215 | + |
---|
205 | 216 | extern void save_mce_event(struct pt_regs *regs, long handled, |
---|
206 | 217 | struct mce_error_info *mce_err, uint64_t nip, |
---|
207 | 218 | uint64_t addr, uint64_t phys_addr); |
---|
.. | .. |
---|
209 | 220 | extern void release_mce_event(void); |
---|
210 | 221 | extern void machine_check_queue_event(void); |
---|
211 | 222 | extern void machine_check_print_event_info(struct machine_check_event *evt, |
---|
212 | | - bool user_mode); |
---|
| 223 | + bool user_mode, bool in_guest); |
---|
| 224 | +unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr); |
---|
| 225 | +extern void mce_common_process_ue(struct pt_regs *regs, |
---|
| 226 | + struct mce_error_info *mce_err); |
---|
| 227 | +int mce_register_notifier(struct notifier_block *nb); |
---|
| 228 | +int mce_unregister_notifier(struct notifier_block *nb); |
---|
| 229 | +#ifdef CONFIG_PPC_BOOK3S_64 |
---|
| 230 | +void flush_and_reload_slb(void); |
---|
| 231 | +long __machine_check_early_realmode_p7(struct pt_regs *regs); |
---|
| 232 | +long __machine_check_early_realmode_p8(struct pt_regs *regs); |
---|
| 233 | +long __machine_check_early_realmode_p9(struct pt_regs *regs); |
---|
| 234 | +long __machine_check_early_realmode_p10(struct pt_regs *regs); |
---|
| 235 | +#endif /* CONFIG_PPC_BOOK3S_64 */ |
---|
213 | 236 | #endif /* __ASM_PPC64_MCE_H__ */ |
---|