hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/arch/powerpc/include/asm/mce.h
....@@ -1,19 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * 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.
174 *
185 * Copyright 2013 IBM Corporation
196 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
....@@ -31,7 +18,7 @@
3118 enum MCE_Severity {
3219 MCE_SEV_NO_ERROR = 0,
3320 MCE_SEV_WARNING = 1,
34
- MCE_SEV_ERROR_SYNC = 2,
21
+ MCE_SEV_SEVERE = 2,
3522 MCE_SEV_FATAL = 3,
3623 };
3724
....@@ -43,6 +30,10 @@
4330 enum MCE_Initiator {
4431 MCE_INITIATOR_UNKNOWN = 0,
4532 MCE_INITIATOR_CPU = 1,
33
+ MCE_INITIATOR_PCI = 2,
34
+ MCE_INITIATOR_ISA = 3,
35
+ MCE_INITIATOR_MEMORY= 4,
36
+ MCE_INITIATOR_POWERMGM = 5,
4637 };
4738
4839 enum MCE_ErrorType {
....@@ -54,6 +45,16 @@
5445 MCE_ERROR_TYPE_USER = 5,
5546 MCE_ERROR_TYPE_RA = 6,
5647 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,
5758 };
5859
5960 enum MCE_UeErrorType {
....@@ -85,6 +86,7 @@
8586 enum MCE_UserErrorType {
8687 MCE_USER_ERROR_INDETERMINATE = 0,
8788 MCE_USER_ERROR_TLBIE = 1,
89
+ MCE_USER_ERROR_SCV = 2,
8890 };
8991
9092 enum MCE_RaErrorType {
....@@ -110,73 +112,76 @@
110112 };
111113
112114 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 {
124128 struct {
125129 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];
132137 } ue_error;
133138
134139 struct {
135140 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];
140145 } slb_error;
141146
142147 struct {
143148 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];
148153 } erat_error;
149154
150155 struct {
151156 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];
156161 } tlb_error;
157162
158163 struct {
159164 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];
164169 } user_error;
165170
166171 struct {
167172 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];
172177 } ra_error;
173178
174179 struct {
175180 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];
180185 } link_error;
181186 } u;
182187 };
....@@ -194,6 +199,9 @@
194199 } u;
195200 enum MCE_Severity severity:8;
196201 enum MCE_Initiator initiator:8;
202
+ enum MCE_ErrorClass error_class:8;
203
+ bool sync_error;
204
+ bool ignore_event;
197205 };
198206
199207 #define MAX_MC_EVT 100
....@@ -202,6 +210,9 @@
202210 #define MCE_EVENT_RELEASE true
203211 #define MCE_EVENT_DONTRELEASE false
204212
213
+struct pt_regs;
214
+struct notifier_block;
215
+
205216 extern void save_mce_event(struct pt_regs *regs, long handled,
206217 struct mce_error_info *mce_err, uint64_t nip,
207218 uint64_t addr, uint64_t phys_addr);
....@@ -209,5 +220,17 @@
209220 extern void release_mce_event(void);
210221 extern void machine_check_queue_event(void);
211222 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 */
213236 #endif /* __ASM_PPC64_MCE_H__ */