1 1.1 cherry /****************************************************************************** 2 1.1 cherry * arch-x86/mca.h 3 1.1 cherry * 4 1.1 cherry * Contributed by Advanced Micro Devices, Inc. 5 1.1 cherry * Author: Christoph Egger <Christoph.Egger (at) amd.com> 6 1.1 cherry * 7 1.1 cherry * Guest OS machine check interface to x86 Xen. 8 1.1 cherry * 9 1.1 cherry * Permission is hereby granted, free of charge, to any person obtaining a copy 10 1.1 cherry * of this software and associated documentation files (the "Software"), to 11 1.1 cherry * deal in the Software without restriction, including without limitation the 12 1.1 cherry * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 1.1 cherry * sell copies of the Software, and to permit persons to whom the Software is 14 1.1 cherry * furnished to do so, subject to the following conditions: 15 1.1 cherry * 16 1.1 cherry * The above copyright notice and this permission notice shall be included in 17 1.1 cherry * all copies or substantial portions of the Software. 18 1.1 cherry * 19 1.1 cherry * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 1.1 cherry * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 1.1 cherry * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 1.1 cherry * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 1.1 cherry * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 1.1 cherry * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 1.1 cherry * DEALINGS IN THE SOFTWARE. 26 1.1 cherry */ 27 1.1 cherry 28 1.1 cherry /* Full MCA functionality has the following Usecases from the guest side: 29 1.1 cherry * 30 1.1 cherry * Must have's: 31 1.1 cherry * 1. Dom0 and DomU register machine check trap callback handlers 32 1.1 cherry * (already done via "set_trap_table" hypercall) 33 1.1 cherry * 2. Dom0 registers machine check event callback handler 34 1.1 cherry * (doable via EVTCHNOP_bind_virq) 35 1.1 cherry * 3. Dom0 and DomU fetches machine check data 36 1.1 cherry * 4. Dom0 wants Xen to notify a DomU 37 1.1 cherry * 5. Dom0 gets DomU ID from physical address 38 1.1 cherry * 6. Dom0 wants Xen to kill DomU (already done for "xm destroy") 39 1.1 cherry * 40 1.1 cherry * Nice to have's: 41 1.1 cherry * 7. Dom0 wants Xen to deactivate a physical CPU 42 1.1 cherry * This is better done as separate task, physical CPU hotplugging, 43 1.1 cherry * and hypercall(s) should be sysctl's 44 1.1 cherry * 8. Page migration proposed from Xen NUMA work, where Dom0 can tell Xen to 45 1.1 cherry * move a DomU (or Dom0 itself) away from a malicious page 46 1.1 cherry * producing correctable errors. 47 1.1 cherry * 9. offlining physical page: 48 1.1 cherry * Xen free's and never re-uses a certain physical page. 49 1.1 cherry * 10. Testfacility: Allow Dom0 to write values into machine check MSR's 50 1.1 cherry * and tell Xen to trigger a machine check 51 1.1 cherry */ 52 1.1 cherry 53 1.1 cherry #ifndef __XEN_PUBLIC_ARCH_X86_MCA_H__ 54 1.1 cherry #define __XEN_PUBLIC_ARCH_X86_MCA_H__ 55 1.1 cherry 56 1.1 cherry /* Hypercall */ 57 1.1 cherry #define __HYPERVISOR_mca __HYPERVISOR_arch_0 58 1.1 cherry 59 1.1 cherry /* 60 1.1 cherry * The xen-unstable repo has interface version 0x03000001; out interface 61 1.1 cherry * is incompatible with that and any future minor revisions, so we 62 1.1 cherry * choose a different version number range that is numerically less 63 1.1 cherry * than that used in xen-unstable. 64 1.1 cherry */ 65 1.1 cherry #define XEN_MCA_INTERFACE_VERSION 0x01ecc003 66 1.1 cherry 67 1.1 cherry /* IN: Dom0 calls hypercall to retrieve nonurgent telemetry */ 68 1.1 cherry #define XEN_MC_NONURGENT 0x0001 69 1.1 cherry /* IN: Dom0/DomU calls hypercall to retrieve urgent telemetry */ 70 1.1 cherry #define XEN_MC_URGENT 0x0002 71 1.1 cherry /* IN: Dom0 acknowledges previosly-fetched telemetry */ 72 1.1 cherry #define XEN_MC_ACK 0x0004 73 1.1 cherry 74 1.1 cherry /* OUT: All is ok */ 75 1.1 cherry #define XEN_MC_OK 0x0 76 1.1 cherry /* OUT: Domain could not fetch data. */ 77 1.1 cherry #define XEN_MC_FETCHFAILED 0x1 78 1.1 cherry /* OUT: There was no machine check data to fetch. */ 79 1.1 cherry #define XEN_MC_NODATA 0x2 80 1.1 cherry /* OUT: Between notification time and this hypercall an other 81 1.1 cherry * (most likely) correctable error happened. The fetched data, 82 1.1 cherry * does not match the original machine check data. */ 83 1.1 cherry #define XEN_MC_NOMATCH 0x4 84 1.1 cherry 85 1.1 cherry /* OUT: DomU did not register MC NMI handler. Try something else. */ 86 1.1 cherry #define XEN_MC_CANNOTHANDLE 0x8 87 1.1 cherry /* OUT: Notifying DomU failed. Retry later or try something else. */ 88 1.1 cherry #define XEN_MC_NOTDELIVERED 0x10 89 1.1 cherry /* Note, XEN_MC_CANNOTHANDLE and XEN_MC_NOTDELIVERED are mutually exclusive. */ 90 1.1 cherry 91 1.1 cherry /* Applicable to all mc_vcpuid fields below. */ 92 1.1 cherry #define XEN_MC_VCPUID_INVALID 0xffff 93 1.1 cherry 94 1.1 cherry #ifndef __ASSEMBLY__ 95 1.1 cherry 96 1.1 cherry #define VIRQ_MCA VIRQ_ARCH_0 /* G. (DOM0) Machine Check Architecture */ 97 1.1 cherry 98 1.1 cherry /* 99 1.1 cherry * Machine Check Architecure: 100 1.1 cherry * structs are read-only and used to report all kinds of 101 1.1 cherry * correctable and uncorrectable errors detected by the HW. 102 1.1 cherry * Dom0 and DomU: register a handler to get notified. 103 1.1 cherry * Dom0 only: Correctable errors are reported via VIRQ_MCA 104 1.1 cherry * Dom0 and DomU: Uncorrectable errors are reported via nmi handlers 105 1.1 cherry */ 106 1.1 cherry #define MC_TYPE_GLOBAL 0 107 1.1 cherry #define MC_TYPE_BANK 1 108 1.1 cherry #define MC_TYPE_EXTENDED 2 109 1.1 cherry #define MC_TYPE_RECOVERY 3 110 1.1 cherry 111 1.1 cherry struct mcinfo_common { 112 1.1 cherry uint16_t type; /* structure type */ 113 1.1 cherry uint16_t size; /* size of this struct in bytes */ 114 1.1 cherry }; 115 1.1 cherry 116 1.1 cherry 117 1.1 cherry #define MC_FLAG_CORRECTABLE (1 << 0) 118 1.1 cherry #define MC_FLAG_UNCORRECTABLE (1 << 1) 119 1.1 cherry #define MC_FLAG_RECOVERABLE (1 << 2) 120 1.1 cherry #define MC_FLAG_POLLED (1 << 3) 121 1.1 cherry #define MC_FLAG_RESET (1 << 4) 122 1.1 cherry #define MC_FLAG_CMCI (1 << 5) 123 1.1 cherry #define MC_FLAG_MCE (1 << 6) 124 1.1 cherry /* contains global x86 mc information */ 125 1.1 cherry struct mcinfo_global { 126 1.1 cherry struct mcinfo_common common; 127 1.1 cherry 128 1.1 cherry /* running domain at the time in error (most likely the impacted one) */ 129 1.1 cherry uint16_t mc_domid; 130 1.1 cherry uint16_t mc_vcpuid; /* virtual cpu scheduled for mc_domid */ 131 1.1 cherry uint32_t mc_socketid; /* physical socket of the physical core */ 132 1.1 cherry uint16_t mc_coreid; /* physical impacted core */ 133 1.1 cherry uint16_t mc_core_threadid; /* core thread of physical core */ 134 1.1 cherry uint32_t mc_apicid; 135 1.1 cherry uint32_t mc_flags; 136 1.1 cherry uint64_t mc_gstatus; /* global status */ 137 1.1 cherry }; 138 1.1 cherry 139 1.1 cherry /* contains bank local x86 mc information */ 140 1.1 cherry struct mcinfo_bank { 141 1.1 cherry struct mcinfo_common common; 142 1.1 cherry 143 1.1 cherry uint16_t mc_bank; /* bank nr */ 144 1.1 cherry uint16_t mc_domid; /* Usecase 5: domain referenced by mc_addr on dom0 145 1.1 cherry * and if mc_addr is valid. Never valid on DomU. */ 146 1.1 cherry uint64_t mc_status; /* bank status */ 147 1.1 cherry uint64_t mc_addr; /* bank address, only valid 148 1.1 cherry * if addr bit is set in mc_status */ 149 1.1 cherry uint64_t mc_misc; 150 1.1 cherry uint64_t mc_ctrl2; 151 1.1 cherry uint64_t mc_tsc; 152 1.1 cherry }; 153 1.1 cherry 154 1.1 cherry 155 1.1 cherry struct mcinfo_msr { 156 1.1 cherry uint64_t reg; /* MSR */ 157 1.1 cherry uint64_t value; /* MSR value */ 158 1.1 cherry }; 159 1.1 cherry 160 1.1 cherry /* contains mc information from other 161 1.1 cherry * or additional mc MSRs */ 162 1.1 cherry struct mcinfo_extended { 163 1.1 cherry struct mcinfo_common common; 164 1.1 cherry 165 1.1 cherry /* You can fill up to five registers. 166 1.1 cherry * If you need more, then use this structure 167 1.1 cherry * multiple times. */ 168 1.1 cherry 169 1.1 cherry uint32_t mc_msrs; /* Number of msr with valid values. */ 170 1.1 cherry /* 171 1.1 cherry * Currently Intel extended MSR (32/64) include all gp registers 172 1.1 cherry * and E(R)FLAGS, E(R)IP, E(R)MISC, up to 11/19 of them might be 173 1.1 cherry * useful at present. So expand this array to 16/32 to leave room. 174 1.1 cherry */ 175 1.1 cherry struct mcinfo_msr mc_msr[sizeof(void *) * 4]; 176 1.1 cherry }; 177 1.1 cherry 178 1.1 cherry /* Recovery Action flags. Giving recovery result information to DOM0 */ 179 1.1 cherry 180 1.1 cherry /* Xen takes successful recovery action, the error is recovered */ 181 1.1 cherry #define REC_ACTION_RECOVERED (0x1 << 0) 182 1.1 cherry /* No action is performed by XEN */ 183 1.1 cherry #define REC_ACTION_NONE (0x1 << 1) 184 1.1 cherry /* It's possible DOM0 might take action ownership in some case */ 185 1.1 cherry #define REC_ACTION_NEED_RESET (0x1 << 2) 186 1.1 cherry 187 1.1 cherry /* Different Recovery Action types, if the action is performed successfully, 188 1.1 cherry * REC_ACTION_RECOVERED flag will be returned. 189 1.1 cherry */ 190 1.1 cherry 191 1.1 cherry /* Page Offline Action */ 192 1.1 cherry #define MC_ACTION_PAGE_OFFLINE (0x1 << 0) 193 1.1 cherry /* CPU offline Action */ 194 1.1 cherry #define MC_ACTION_CPU_OFFLINE (0x1 << 1) 195 1.1 cherry /* L3 cache disable Action */ 196 1.1 cherry #define MC_ACTION_CACHE_SHRINK (0x1 << 2) 197 1.1 cherry 198 1.1 cherry /* Below interface used between XEN/DOM0 for passing XEN's recovery action 199 1.1 cherry * information to DOM0. 200 1.1 cherry * usage Senario: After offlining broken page, XEN might pass its page offline 201 1.1 cherry * recovery action result to DOM0. DOM0 will save the information in 202 1.1 cherry * non-volatile memory for further proactive actions, such as offlining the 203 1.1 cherry * easy broken page earlier when doing next reboot. 204 1.1 cherry */ 205 1.1 cherry struct page_offline_action 206 1.1 cherry { 207 1.1 cherry /* Params for passing the offlined page number to DOM0 */ 208 1.1 cherry uint64_t mfn; 209 1.1 cherry uint64_t status; 210 1.1 cherry }; 211 1.1 cherry 212 1.1 cherry struct cpu_offline_action 213 1.1 cherry { 214 1.1 cherry /* Params for passing the identity of the offlined CPU to DOM0 */ 215 1.1 cherry uint32_t mc_socketid; 216 1.1 cherry uint16_t mc_coreid; 217 1.1 cherry uint16_t mc_core_threadid; 218 1.1 cherry }; 219 1.1 cherry 220 1.1 cherry #define MAX_UNION_SIZE 16 221 1.1 cherry struct mcinfo_recovery 222 1.1 cherry { 223 1.1 cherry struct mcinfo_common common; 224 1.1 cherry uint16_t mc_bank; /* bank nr */ 225 1.1 cherry uint8_t action_flags; 226 1.1 cherry uint8_t action_types; 227 1.1 cherry union { 228 1.1 cherry struct page_offline_action page_retire; 229 1.1 cherry struct cpu_offline_action cpu_offline; 230 1.1 cherry uint8_t pad[MAX_UNION_SIZE]; 231 1.1 cherry } action_info; 232 1.1 cherry }; 233 1.1 cherry 234 1.1 cherry 235 1.1 cherry #define MCINFO_HYPERCALLSIZE 1024 236 1.1 cherry #define MCINFO_MAXSIZE 768 237 1.1 cherry 238 1.1 cherry #define MCINFO_FLAGS_UNCOMPLETE 0x1 239 1.1 cherry struct mc_info { 240 1.1 cherry /* Number of mcinfo_* entries in mi_data */ 241 1.1 cherry uint32_t mi_nentries; 242 1.1 cherry uint32_t flags; 243 1.1 cherry uint64_t mi_data[(MCINFO_MAXSIZE - 1) / 8]; 244 1.1 cherry }; 245 1.1 cherry typedef struct mc_info mc_info_t; 246 1.1 cherry DEFINE_XEN_GUEST_HANDLE(mc_info_t); 247 1.1 cherry 248 1.1 cherry #define __MC_MSR_ARRAYSIZE 8 249 1.1 cherry #define __MC_NMSRS 1 250 1.1 cherry #define MC_NCAPS 7 /* 7 CPU feature flag words */ 251 1.1 cherry #define MC_CAPS_STD_EDX 0 /* cpuid level 0x00000001 (%edx) */ 252 1.1 cherry #define MC_CAPS_AMD_EDX 1 /* cpuid level 0x80000001 (%edx) */ 253 1.1 cherry #define MC_CAPS_TM 2 /* cpuid level 0x80860001 (TransMeta) */ 254 1.1 cherry #define MC_CAPS_LINUX 3 /* Linux-defined */ 255 1.1 cherry #define MC_CAPS_STD_ECX 4 /* cpuid level 0x00000001 (%ecx) */ 256 1.1 cherry #define MC_CAPS_VIA 5 /* cpuid level 0xc0000001 */ 257 1.1 cherry #define MC_CAPS_AMD_ECX 6 /* cpuid level 0x80000001 (%ecx) */ 258 1.1 cherry 259 1.1 cherry struct mcinfo_logical_cpu { 260 1.1 cherry uint32_t mc_cpunr; 261 1.1 cherry uint32_t mc_chipid; 262 1.1 cherry uint16_t mc_coreid; 263 1.1 cherry uint16_t mc_threadid; 264 1.1 cherry uint32_t mc_apicid; 265 1.1 cherry uint32_t mc_clusterid; 266 1.1 cherry uint32_t mc_ncores; 267 1.1 cherry uint32_t mc_ncores_active; 268 1.1 cherry uint32_t mc_nthreads; 269 1.1 cherry int32_t mc_cpuid_level; 270 1.1 cherry uint32_t mc_family; 271 1.1 cherry uint32_t mc_vendor; 272 1.1 cherry uint32_t mc_model; 273 1.1 cherry uint32_t mc_step; 274 1.1 cherry char mc_vendorid[16]; 275 1.1 cherry char mc_brandid[64]; 276 1.1 cherry uint32_t mc_cpu_caps[MC_NCAPS]; 277 1.1 cherry uint32_t mc_cache_size; 278 1.1 cherry uint32_t mc_cache_alignment; 279 1.1 cherry int32_t mc_nmsrvals; 280 1.1 cherry struct mcinfo_msr mc_msrvalues[__MC_MSR_ARRAYSIZE]; 281 1.1 cherry }; 282 1.1 cherry typedef struct mcinfo_logical_cpu xen_mc_logical_cpu_t; 283 1.1 cherry DEFINE_XEN_GUEST_HANDLE(xen_mc_logical_cpu_t); 284 1.1 cherry 285 1.1 cherry 286 1.1 cherry /* 287 1.1 cherry * OS's should use these instead of writing their own lookup function 288 1.1 cherry * each with its own bugs and drawbacks. 289 1.1 cherry * We use macros instead of static inline functions to allow guests 290 1.1 cherry * to include this header in assembly files (*.S). 291 1.1 cherry */ 292 1.1 cherry /* Prototype: 293 1.1 cherry * uint32_t x86_mcinfo_nentries(struct mc_info *mi); 294 1.1 cherry */ 295 1.1 cherry #define x86_mcinfo_nentries(_mi) \ 296 1.1 cherry (_mi)->mi_nentries 297 1.1 cherry /* Prototype: 298 1.1 cherry * struct mcinfo_common *x86_mcinfo_first(struct mc_info *mi); 299 1.1 cherry */ 300 1.1 cherry #define x86_mcinfo_first(_mi) \ 301 1.1 cherry ((struct mcinfo_common *)(_mi)->mi_data) 302 1.1 cherry /* Prototype: 303 1.1 cherry * struct mcinfo_common *x86_mcinfo_next(struct mcinfo_common *mic); 304 1.1 cherry */ 305 1.1 cherry #define x86_mcinfo_next(_mic) \ 306 1.1 cherry ((struct mcinfo_common *)((uint8_t *)(_mic) + (_mic)->size)) 307 1.1 cherry 308 1.1 cherry /* Prototype: 309 1.1 cherry * void x86_mcinfo_lookup(void *ret, struct mc_info *mi, uint16_t type); 310 1.1 cherry */ 311 1.1 cherry #define x86_mcinfo_lookup(_ret, _mi, _type) \ 312 1.1 cherry do { \ 313 1.1 cherry uint32_t found, i; \ 314 1.1 cherry struct mcinfo_common *_mic; \ 315 1.1 cherry \ 316 1.1 cherry found = 0; \ 317 1.1 cherry (_ret) = NULL; \ 318 1.1 cherry if (_mi == NULL) break; \ 319 1.1 cherry _mic = x86_mcinfo_first(_mi); \ 320 1.1 cherry for (i = 0; i < x86_mcinfo_nentries(_mi); i++) { \ 321 1.1 cherry if (_mic->type == (_type)) { \ 322 1.1 cherry found = 1; \ 323 1.1 cherry break; \ 324 1.1 cherry } \ 325 1.1 cherry _mic = x86_mcinfo_next(_mic); \ 326 1.1 cherry } \ 327 1.1 cherry (_ret) = found ? _mic : NULL; \ 328 1.1 cherry } while (0) 329 1.1 cherry 330 1.1 cherry 331 1.1 cherry /* Usecase 1 332 1.1 cherry * Register machine check trap callback handler 333 1.1 cherry * (already done via "set_trap_table" hypercall) 334 1.1 cherry */ 335 1.1 cherry 336 1.1 cherry /* Usecase 2 337 1.1 cherry * Dom0 registers machine check event callback handler 338 1.1 cherry * done by EVTCHNOP_bind_virq 339 1.1 cherry */ 340 1.1 cherry 341 1.1 cherry /* Usecase 3 342 1.1 cherry * Fetch machine check data from hypervisor. 343 1.1 cherry * Note, this hypercall is special, because both Dom0 and DomU must use this. 344 1.1 cherry */ 345 1.1 cherry #define XEN_MC_fetch 1 346 1.1 cherry struct xen_mc_fetch { 347 1.1 cherry /* IN/OUT variables. */ 348 1.1 cherry uint32_t flags; /* IN: XEN_MC_NONURGENT, XEN_MC_URGENT, 349 1.1 cherry XEN_MC_ACK if ack'ing an earlier fetch */ 350 1.1 cherry /* OUT: XEN_MC_OK, XEN_MC_FETCHFAILED, 351 1.1 cherry XEN_MC_NODATA, XEN_MC_NOMATCH */ 352 1.1 cherry uint32_t _pad0; 353 1.1 cherry uint64_t fetch_id; /* OUT: id for ack, IN: id we are ack'ing */ 354 1.1 cherry 355 1.1 cherry /* OUT variables. */ 356 1.1 cherry XEN_GUEST_HANDLE(mc_info_t) data; 357 1.1 cherry }; 358 1.1 cherry typedef struct xen_mc_fetch xen_mc_fetch_t; 359 1.1 cherry DEFINE_XEN_GUEST_HANDLE(xen_mc_fetch_t); 360 1.1 cherry 361 1.1 cherry 362 1.1 cherry /* Usecase 4 363 1.1 cherry * This tells the hypervisor to notify a DomU about the machine check error 364 1.1 cherry */ 365 1.1 cherry #define XEN_MC_notifydomain 2 366 1.1 cherry struct xen_mc_notifydomain { 367 1.1 cherry /* IN variables. */ 368 1.1 cherry uint16_t mc_domid; /* The unprivileged domain to notify. */ 369 1.1 cherry uint16_t mc_vcpuid; /* The vcpu in mc_domid to notify. 370 1.1 cherry * Usually echo'd value from the fetch hypercall. */ 371 1.1 cherry 372 1.1 cherry /* IN/OUT variables. */ 373 1.1 cherry uint32_t flags; 374 1.1 cherry 375 1.1 cherry /* IN: XEN_MC_CORRECTABLE, XEN_MC_TRAP */ 376 1.1 cherry /* OUT: XEN_MC_OK, XEN_MC_CANNOTHANDLE, XEN_MC_NOTDELIVERED, XEN_MC_NOMATCH */ 377 1.1 cherry }; 378 1.1 cherry typedef struct xen_mc_notifydomain xen_mc_notifydomain_t; 379 1.1 cherry DEFINE_XEN_GUEST_HANDLE(xen_mc_notifydomain_t); 380 1.1 cherry 381 1.1 cherry #define XEN_MC_physcpuinfo 3 382 1.1 cherry struct xen_mc_physcpuinfo { 383 1.1 cherry /* IN/OUT */ 384 1.1 cherry uint32_t ncpus; 385 1.1 cherry uint32_t _pad0; 386 1.1 cherry /* OUT */ 387 1.1 cherry XEN_GUEST_HANDLE(xen_mc_logical_cpu_t) info; 388 1.1 cherry }; 389 1.1 cherry 390 1.1 cherry #define XEN_MC_msrinject 4 391 1.1 cherry #define MC_MSRINJ_MAXMSRS 8 392 1.1 cherry struct xen_mc_msrinject { 393 1.1 cherry /* IN */ 394 1.1 cherry uint32_t mcinj_cpunr; /* target processor id */ 395 1.1 cherry uint32_t mcinj_flags; /* see MC_MSRINJ_F_* below */ 396 1.1 cherry uint32_t mcinj_count; /* 0 .. count-1 in array are valid */ 397 1.1 cherry domid_t mcinj_domid; /* valid only if MC_MSRINJ_F_GPADDR is 398 1.1 cherry present in mcinj_flags */ 399 1.1 cherry uint16_t _pad0; 400 1.1 cherry struct mcinfo_msr mcinj_msr[MC_MSRINJ_MAXMSRS]; 401 1.1 cherry }; 402 1.1 cherry 403 1.1 cherry /* Flags for mcinj_flags above; bits 16-31 are reserved */ 404 1.1 cherry #define MC_MSRINJ_F_INTERPOSE 0x1 405 1.1 cherry #define MC_MSRINJ_F_GPADDR 0x2 406 1.1 cherry 407 1.1 cherry #define XEN_MC_mceinject 5 408 1.1 cherry struct xen_mc_mceinject { 409 1.1 cherry unsigned int mceinj_cpunr; /* target processor id */ 410 1.1 cherry }; 411 1.1 cherry 412 1.1 cherry #if defined(__XEN__) || defined(__XEN_TOOLS__) 413 1.1 cherry #define XEN_MC_inject_v2 6 414 1.1 cherry #define XEN_MC_INJECT_TYPE_MASK 0x7 415 1.1 cherry #define XEN_MC_INJECT_TYPE_MCE 0x0 416 1.1 cherry #define XEN_MC_INJECT_TYPE_CMCI 0x1 417 1.1 cherry #define XEN_MC_INJECT_TYPE_LMCE 0x2 418 1.1 cherry 419 1.1 cherry #define XEN_MC_INJECT_CPU_BROADCAST 0x8 420 1.1 cherry 421 1.1 cherry struct xen_mc_inject_v2 { 422 1.1 cherry uint32_t flags; 423 1.1 cherry struct xenctl_bitmap cpumap; 424 1.1 cherry }; 425 1.1 cherry #endif 426 1.1 cherry 427 1.1 cherry struct xen_mc { 428 1.1 cherry uint32_t cmd; 429 1.1 cherry uint32_t interface_version; /* XEN_MCA_INTERFACE_VERSION */ 430 1.1 cherry union { 431 1.1 cherry struct xen_mc_fetch mc_fetch; 432 1.1 cherry struct xen_mc_notifydomain mc_notifydomain; 433 1.1 cherry struct xen_mc_physcpuinfo mc_physcpuinfo; 434 1.1 cherry struct xen_mc_msrinject mc_msrinject; 435 1.1 cherry struct xen_mc_mceinject mc_mceinject; 436 1.1 cherry #if defined(__XEN__) || defined(__XEN_TOOLS__) 437 1.1 cherry struct xen_mc_inject_v2 mc_inject_v2; 438 1.1 cherry #endif 439 1.1 cherry } u; 440 1.1 cherry }; 441 1.1 cherry typedef struct xen_mc xen_mc_t; 442 1.1 cherry DEFINE_XEN_GUEST_HANDLE(xen_mc_t); 443 1.1 cherry 444 1.1 cherry #endif /* __ASSEMBLY__ */ 445 1.1 cherry 446 1.1 cherry #endif /* __XEN_PUBLIC_ARCH_X86_MCA_H__ */ 447