]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/powerpc/include/asm/mce.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[mirror_ubuntu-artful-kernel.git] / arch / powerpc / include / asm / mce.h
1 /*
2 * 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 *
18 * Copyright 2013 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
20 */
21
22 #ifndef __ASM_PPC64_MCE_H__
23 #define __ASM_PPC64_MCE_H__
24
25 #include <linux/bitops.h>
26
27 enum MCE_Version {
28 MCE_V1 = 1,
29 };
30
31 enum MCE_Severity {
32 MCE_SEV_NO_ERROR = 0,
33 MCE_SEV_WARNING = 1,
34 MCE_SEV_ERROR_SYNC = 2,
35 MCE_SEV_FATAL = 3,
36 };
37
38 enum MCE_Disposition {
39 MCE_DISPOSITION_RECOVERED = 0,
40 MCE_DISPOSITION_NOT_RECOVERED = 1,
41 };
42
43 enum MCE_Initiator {
44 MCE_INITIATOR_UNKNOWN = 0,
45 MCE_INITIATOR_CPU = 1,
46 };
47
48 enum MCE_ErrorType {
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,
57 };
58
59 enum MCE_UeErrorType {
60 MCE_UE_ERROR_INDETERMINATE = 0,
61 MCE_UE_ERROR_IFETCH = 1,
62 MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
63 MCE_UE_ERROR_LOAD_STORE = 3,
64 MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4,
65 };
66
67 enum MCE_SlbErrorType {
68 MCE_SLB_ERROR_INDETERMINATE = 0,
69 MCE_SLB_ERROR_PARITY = 1,
70 MCE_SLB_ERROR_MULTIHIT = 2,
71 };
72
73 enum MCE_EratErrorType {
74 MCE_ERAT_ERROR_INDETERMINATE = 0,
75 MCE_ERAT_ERROR_PARITY = 1,
76 MCE_ERAT_ERROR_MULTIHIT = 2,
77 };
78
79 enum MCE_TlbErrorType {
80 MCE_TLB_ERROR_INDETERMINATE = 0,
81 MCE_TLB_ERROR_PARITY = 1,
82 MCE_TLB_ERROR_MULTIHIT = 2,
83 };
84
85 enum MCE_UserErrorType {
86 MCE_USER_ERROR_INDETERMINATE = 0,
87 MCE_USER_ERROR_TLBIE = 1,
88 };
89
90 enum MCE_RaErrorType {
91 MCE_RA_ERROR_INDETERMINATE = 0,
92 MCE_RA_ERROR_IFETCH = 1,
93 MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
94 MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN = 3,
95 MCE_RA_ERROR_LOAD = 4,
96 MCE_RA_ERROR_STORE = 5,
97 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 6,
98 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN = 7,
99 MCE_RA_ERROR_LOAD_STORE_FOREIGN = 8,
100 };
101
102 enum MCE_LinkErrorType {
103 MCE_LINK_ERROR_INDETERMINATE = 0,
104 MCE_LINK_ERROR_IFETCH_TIMEOUT = 1,
105 MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT = 2,
106 MCE_LINK_ERROR_LOAD_TIMEOUT = 3,
107 MCE_LINK_ERROR_STORE_TIMEOUT = 4,
108 MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT = 5,
109 };
110
111 struct machine_check_event {
112 enum MCE_Version version:8; /* 0x00 */
113 uint8_t in_use; /* 0x01 */
114 enum MCE_Severity severity:8; /* 0x02 */
115 enum MCE_Initiator initiator:8; /* 0x03 */
116 enum MCE_ErrorType error_type:8; /* 0x04 */
117 enum MCE_Disposition disposition:8; /* 0x05 */
118 uint8_t reserved_1[2]; /* 0x06 */
119 uint64_t gpr3; /* 0x08 */
120 uint64_t srr0; /* 0x10 */
121 uint64_t srr1; /* 0x18 */
122 union { /* 0x20 */
123 struct {
124 enum MCE_UeErrorType ue_error_type:8;
125 uint8_t effective_address_provided;
126 uint8_t physical_address_provided;
127 uint8_t reserved_1[5];
128 uint64_t effective_address;
129 uint64_t physical_address;
130 uint8_t reserved_2[8];
131 } ue_error;
132
133 struct {
134 enum MCE_SlbErrorType slb_error_type:8;
135 uint8_t effective_address_provided;
136 uint8_t reserved_1[6];
137 uint64_t effective_address;
138 uint8_t reserved_2[16];
139 } slb_error;
140
141 struct {
142 enum MCE_EratErrorType erat_error_type:8;
143 uint8_t effective_address_provided;
144 uint8_t reserved_1[6];
145 uint64_t effective_address;
146 uint8_t reserved_2[16];
147 } erat_error;
148
149 struct {
150 enum MCE_TlbErrorType tlb_error_type:8;
151 uint8_t effective_address_provided;
152 uint8_t reserved_1[6];
153 uint64_t effective_address;
154 uint8_t reserved_2[16];
155 } tlb_error;
156
157 struct {
158 enum MCE_UserErrorType user_error_type:8;
159 uint8_t effective_address_provided;
160 uint8_t reserved_1[6];
161 uint64_t effective_address;
162 uint8_t reserved_2[16];
163 } user_error;
164
165 struct {
166 enum MCE_RaErrorType ra_error_type:8;
167 uint8_t effective_address_provided;
168 uint8_t reserved_1[6];
169 uint64_t effective_address;
170 uint8_t reserved_2[16];
171 } ra_error;
172
173 struct {
174 enum MCE_LinkErrorType link_error_type:8;
175 uint8_t effective_address_provided;
176 uint8_t reserved_1[6];
177 uint64_t effective_address;
178 uint8_t reserved_2[16];
179 } link_error;
180 } u;
181 };
182
183 struct mce_error_info {
184 enum MCE_ErrorType error_type:8;
185 union {
186 enum MCE_UeErrorType ue_error_type:8;
187 enum MCE_SlbErrorType slb_error_type:8;
188 enum MCE_EratErrorType erat_error_type:8;
189 enum MCE_TlbErrorType tlb_error_type:8;
190 enum MCE_UserErrorType user_error_type:8;
191 enum MCE_RaErrorType ra_error_type:8;
192 enum MCE_LinkErrorType link_error_type:8;
193 } u;
194 enum MCE_Severity severity:8;
195 enum MCE_Initiator initiator:8;
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,
205 struct mce_error_info *mce_err, uint64_t nip,
206 uint64_t addr);
207 extern int get_mce_event(struct machine_check_event *mce, bool release);
208 extern void release_mce_event(void);
209 extern void machine_check_queue_event(void);
210 extern void machine_check_print_event_info(struct machine_check_event *evt,
211 bool user_mode);
212 extern uint64_t get_mce_fault_addr(struct machine_check_event *evt);
213
214 #endif /* __ASM_PPC64_MCE_H__ */