6b13f685e
김민수
BSP 최초 추가
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
|
#ifndef __XEN_PUBLIC_ARCH_X86_MCA_H__
#define __XEN_PUBLIC_ARCH_X86_MCA_H__
#define __HYPERVISOR_mca __HYPERVISOR_arch_0
#define XEN_MCA_INTERFACE_VERSION 0x01ecc003
#define XEN_MC_NONURGENT 0x1
#define XEN_MC_URGENT 0x2
#define XEN_MC_ACK 0x4
#define XEN_MC_OK 0x0
#define XEN_MC_FETCHFAILED 0x1
#define XEN_MC_NODATA 0x2
#ifndef __ASSEMBLY__
#define VIRQ_MCA VIRQ_ARCH_0
#define MC_TYPE_GLOBAL 0
#define MC_TYPE_BANK 1
#define MC_TYPE_EXTENDED 2
#define MC_TYPE_RECOVERY 3
struct mcinfo_common {
uint16_t type;
uint16_t size;
};
#define MC_FLAG_CORRECTABLE (1 << 0)
#define MC_FLAG_UNCORRECTABLE (1 << 1)
#define MC_FLAG_RECOVERABLE (1 << 2)
#define MC_FLAG_POLLED (1 << 3)
#define MC_FLAG_RESET (1 << 4)
#define MC_FLAG_CMCI (1 << 5)
#define MC_FLAG_MCE (1 << 6)
struct mcinfo_global {
struct mcinfo_common common;
uint16_t mc_domid;
uint16_t mc_vcpuid;
uint32_t mc_socketid;
uint16_t mc_coreid;
uint16_t mc_core_threadid;
uint32_t mc_apicid;
uint32_t mc_flags;
uint64_t mc_gstatus;
};
struct mcinfo_bank {
struct mcinfo_common common;
uint16_t mc_bank;
uint16_t mc_domid;
uint64_t mc_status;
uint64_t mc_addr;
uint64_t mc_misc;
uint64_t mc_ctrl2;
uint64_t mc_tsc;
};
struct mcinfo_msr {
uint64_t reg;
uint64_t value;
};
struct mcinfo_extended {
struct mcinfo_common common;
uint32_t mc_msrs;
struct mcinfo_msr mc_msr[sizeof(void *) * 4];
};
#define REC_ACTION_RECOVERED (0x1 << 0)
#define REC_ACTION_NONE (0x1 << 1)
#define REC_ACTION_NEED_RESET (0x1 << 2)
#define MC_ACTION_PAGE_OFFLINE (0x1 << 0)
#define MC_ACTION_CPU_OFFLINE (0x1 << 1)
#define MC_ACTION_CACHE_SHRINK (0x1 << 2)
struct page_offline_action {
uint64_t mfn;
uint64_t status;
};
struct cpu_offline_action {
uint32_t mc_socketid;
uint16_t mc_coreid;
uint16_t mc_core_threadid;
};
#define MAX_UNION_SIZE 16
struct mcinfo_recovery {
struct mcinfo_common common;
uint16_t mc_bank;
uint8_t action_flags;
uint8_t action_types;
union {
struct page_offline_action page_retire;
struct cpu_offline_action cpu_offline;
uint8_t pad[MAX_UNION_SIZE];
} action_info;
};
#define MCINFO_MAXSIZE 768
struct mc_info {
uint32_t mi_nentries;
uint32_t flags;
uint64_t mi_data[(MCINFO_MAXSIZE - 1) / 8];
};
DEFINE_GUEST_HANDLE_STRUCT(mc_info);
#define __MC_MSR_ARRAYSIZE 8
#define __MC_MSR_MCGCAP 0
#define __MC_NMSRS 1
#define MC_NCAPS 7
struct mcinfo_logical_cpu {
uint32_t mc_cpunr;
uint32_t mc_chipid;
uint16_t mc_coreid;
uint16_t mc_threadid;
uint32_t mc_apicid;
uint32_t mc_clusterid;
uint32_t mc_ncores;
uint32_t mc_ncores_active;
uint32_t mc_nthreads;
uint32_t mc_cpuid_level;
uint32_t mc_family;
uint32_t mc_vendor;
uint32_t mc_model;
uint32_t mc_step;
char mc_vendorid[16];
char mc_brandid[64];
uint32_t mc_cpu_caps[MC_NCAPS];
uint32_t mc_cache_size;
uint32_t mc_cache_alignment;
uint32_t mc_nmsrvals;
struct mcinfo_msr mc_msrvalues[__MC_MSR_ARRAYSIZE];
};
DEFINE_GUEST_HANDLE_STRUCT(mcinfo_logical_cpu);
#define x86_mcinfo_nentries(_mi) \
((_mi)->mi_nentries)
#define x86_mcinfo_first(_mi) \
((struct mcinfo_common *)(_mi)->mi_data)
#define x86_mcinfo_next(_mic) \
((struct mcinfo_common *)((uint8_t *)(_mic) + (_mic)->size))
static inline void x86_mcinfo_lookup(struct mcinfo_common **ret,
struct mc_info *mi, uint16_t type)
{
uint32_t i;
struct mcinfo_common *mic;
bool found = 0;
if (!ret || !mi)
return;
mic = x86_mcinfo_first(mi);
for (i = 0; i < x86_mcinfo_nentries(mi); i++) {
if (mic->type == type) {
found = 1;
break;
}
mic = x86_mcinfo_next(mic);
}
*ret = found ? mic : NULL;
}
#define XEN_MC_fetch 1
struct xen_mc_fetch {
uint32_t flags;
uint32_t _pad0;
uint64_t fetch_id;
GUEST_HANDLE(mc_info) data;
};
DEFINE_GUEST_HANDLE_STRUCT(xen_mc_fetch);
#define XEN_MC_notifydomain 2
struct xen_mc_notifydomain {
uint16_t mc_domid;
uint16_t mc_vcpuid;
uint32_t flags;
};
DEFINE_GUEST_HANDLE_STRUCT(xen_mc_notifydomain);
#define XEN_MC_physcpuinfo 3
struct xen_mc_physcpuinfo {
uint32_t ncpus;
uint32_t _pad0;
GUEST_HANDLE(mcinfo_logical_cpu) info;
};
#define XEN_MC_msrinject 4
#define MC_MSRINJ_MAXMSRS 8
struct xen_mc_msrinject {
uint32_t mcinj_cpunr;
uint32_t mcinj_flags;
uint32_t mcinj_count;
uint32_t _pad0;
struct mcinfo_msr mcinj_msr[MC_MSRINJ_MAXMSRS];
};
#define MC_MSRINJ_F_INTERPOSE 0x1
#define XEN_MC_mceinject 5
struct xen_mc_mceinject {
unsigned int mceinj_cpunr;
};
struct xen_mc {
uint32_t cmd;
uint32_t interface_version;
union {
struct xen_mc_fetch mc_fetch;
struct xen_mc_notifydomain mc_notifydomain;
struct xen_mc_physcpuinfo mc_physcpuinfo;
struct xen_mc_msrinject mc_msrinject;
struct xen_mc_mceinject mc_mceinject;
} u;
};
DEFINE_GUEST_HANDLE_STRUCT(xen_mc);
struct xen_mce {
__u64 status;
__u64 misc;
__u64 addr;
__u64 mcgstatus;
__u64 ip;
__u64 tsc;
__u64 time;
__u8 cpuvendor;
__u8 inject_flags;
__u16 pad;
__u32 cpuid;
__u8 cs;
__u8 bank;
__u8 cpu;
__u8 finished;
__u32 extcpu;
__u32 socketid;
__u32 apicid;
__u64 mcgcap;
};
#define XEN_MCE_LOG_LEN 32
struct xen_mce_log {
char signature[12];
unsigned len;
unsigned next;
unsigned flags;
unsigned recordlen;
struct xen_mce entry[XEN_MCE_LOG_LEN];
};
#define XEN_MCE_OVERFLOW 0 /* bit 0 in flags means overflow */
#define XEN_MCE_LOG_SIGNATURE "MACHINECHECK"
#define MCE_GET_RECORD_LEN _IOR('M', 1, int)
#define MCE_GET_LOG_LEN _IOR('M', 2, int)
#define MCE_GETCLEAR_FLAGS _IOR('M', 3, int)
#endif /* __ASSEMBLY__ */
#endif /* __XEN_PUBLIC_ARCH_X86_MCA_H__ */
|