2 * Machine check exception header file.
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.
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.
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.
18 * Copyright 2013 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
22 #ifndef __ASM_PPC64_MCE_H__
23 #define __ASM_PPC64_MCE_H__
25 #include <linux/bitops.h>
38 enum MCE_Disposition {
39 MCE_DISPOSITION_RECOVERED = 0,
40 MCE_DISPOSITION_NOT_RECOVERED = 1,
44 MCE_INITIATOR_UNKNOWN = 0,
45 MCE_INITIATOR_CPU = 1,
49 MCE_ERROR_TYPE_UNKNOWN = 0,
50 MCE_ERROR_TYPE_UE = 1,
51 MCE_ERROR_TYPE_SLB = 2,
52 MCE_ERROR_TYPE_ERAT = 3,
53 MCE_ERROR_TYPE_TLB = 4,
54 MCE_ERROR_TYPE_USER = 5,
55 MCE_ERROR_TYPE_RA = 6,
56 MCE_ERROR_TYPE_LINK = 7,
60 MCE_ECLASS_UNKNOWN = 0,
62 MCE_ECLASS_HARD_INDETERMINATE,
64 MCE_ECLASS_SOFT_INDETERMINATE,
67 enum MCE_UeErrorType {
68 MCE_UE_ERROR_INDETERMINATE = 0,
69 MCE_UE_ERROR_IFETCH = 1,
70 MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
71 MCE_UE_ERROR_LOAD_STORE = 3,
72 MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4,
75 enum MCE_SlbErrorType {
76 MCE_SLB_ERROR_INDETERMINATE = 0,
77 MCE_SLB_ERROR_PARITY = 1,
78 MCE_SLB_ERROR_MULTIHIT = 2,
81 enum MCE_EratErrorType {
82 MCE_ERAT_ERROR_INDETERMINATE = 0,
83 MCE_ERAT_ERROR_PARITY = 1,
84 MCE_ERAT_ERROR_MULTIHIT = 2,
87 enum MCE_TlbErrorType {
88 MCE_TLB_ERROR_INDETERMINATE = 0,
89 MCE_TLB_ERROR_PARITY = 1,
90 MCE_TLB_ERROR_MULTIHIT = 2,
93 enum MCE_UserErrorType {
94 MCE_USER_ERROR_INDETERMINATE = 0,
95 MCE_USER_ERROR_TLBIE = 1,
98 enum MCE_RaErrorType {
99 MCE_RA_ERROR_INDETERMINATE = 0,
100 MCE_RA_ERROR_IFETCH = 1,
101 MCE_RA_ERROR_IFETCH_FOREIGN = 2,
102 MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH = 3,
103 MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN = 4,
104 MCE_RA_ERROR_LOAD = 5,
105 MCE_RA_ERROR_STORE = 6,
106 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 7,
107 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN = 8,
108 MCE_RA_ERROR_LOAD_STORE_FOREIGN = 9,
111 enum MCE_LinkErrorType {
112 MCE_LINK_ERROR_INDETERMINATE = 0,
113 MCE_LINK_ERROR_IFETCH_TIMEOUT = 1,
114 MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT = 2,
115 MCE_LINK_ERROR_LOAD_TIMEOUT = 3,
116 MCE_LINK_ERROR_STORE_TIMEOUT = 4,
117 MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT = 5,
120 struct machine_check_event {
121 enum MCE_Version version:8;
123 enum MCE_Severity severity:8;
124 enum MCE_Initiator initiator:8;
125 enum MCE_ErrorType error_type:8;
126 enum MCE_ErrorClass error_class:8;
127 enum MCE_Disposition disposition:8;
135 enum MCE_UeErrorType ue_error_type:8;
136 u8 effective_address_provided;
137 u8 physical_address_provided;
139 u64 effective_address;
140 u64 physical_address;
145 enum MCE_SlbErrorType slb_error_type:8;
146 u8 effective_address_provided;
148 u64 effective_address;
153 enum MCE_EratErrorType erat_error_type:8;
154 u8 effective_address_provided;
156 u64 effective_address;
161 enum MCE_TlbErrorType tlb_error_type:8;
162 u8 effective_address_provided;
164 u64 effective_address;
169 enum MCE_UserErrorType user_error_type:8;
170 u8 effective_address_provided;
172 u64 effective_address;
177 enum MCE_RaErrorType ra_error_type:8;
178 u8 effective_address_provided;
180 u64 effective_address;
185 enum MCE_LinkErrorType link_error_type:8;
186 u8 effective_address_provided;
188 u64 effective_address;
194 struct mce_error_info {
195 enum MCE_ErrorType error_type:8;
197 enum MCE_UeErrorType ue_error_type:8;
198 enum MCE_SlbErrorType slb_error_type:8;
199 enum MCE_EratErrorType erat_error_type:8;
200 enum MCE_TlbErrorType tlb_error_type:8;
201 enum MCE_UserErrorType user_error_type:8;
202 enum MCE_RaErrorType ra_error_type:8;
203 enum MCE_LinkErrorType link_error_type:8;
205 enum MCE_Severity severity:8;
206 enum MCE_Initiator initiator:8;
207 enum MCE_ErrorClass error_class:8;
211 #define MAX_MC_EVT 100
213 /* Release flags for get_mce_event() */
214 #define MCE_EVENT_RELEASE true
215 #define MCE_EVENT_DONTRELEASE false
217 extern void save_mce_event(struct pt_regs *regs, long handled,
218 struct mce_error_info *mce_err, uint64_t nip,
219 uint64_t addr, uint64_t phys_addr);
220 extern int get_mce_event(struct machine_check_event *mce, bool release);
221 extern void release_mce_event(void);
222 extern void machine_check_queue_event(void);
223 extern void machine_check_print_event_info(struct machine_check_event *evt,
224 bool user_mode, bool in_guest);
225 unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr);
226 #ifdef CONFIG_PPC_BOOK3S_64
227 void flush_and_reload_slb(void);
228 #endif /* CONFIG_PPC_BOOK3S_64 */
229 #endif /* __ASM_PPC64_MCE_H__ */