/* SPDX-License-Identifier: MIT */ /****************************************************************************** * arch-x86/mca.h * Guest OS machine check interface to x86 Xen. * * Contributed by Advanced Micro Devices, Inc. * Author: Christoph Egger <Christoph.Egger@amd.com> * * Updated by Intel Corporation * Author: Liu, Jinsong <jinsong.liu@intel.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE.
*/
/* OUT: All is ok */ #define XEN_MC_OK 0x0 /* OUT: Domain could not fetch data. */ #define XEN_MC_FETCHFAILED 0x1 /* OUT: There was no machine check data to fetch. */ #define XEN_MC_NODATA 0x2
/* * mc_info entry types * mca machine check info are recorded in mc_info entries. * when fetch mca info, it can use MC_TYPE_... to distinguish * different mca info.
*/ #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; /* structure type */
uint16_t size; /* size of this struct in bytes */
};
/* contains x86 global mc information */ struct mcinfo_global { struct mcinfo_common common;
uint16_t mc_domid; /* running domain at the time in error */
uint16_t mc_vcpuid; /* virtual cpu scheduled for mc_domid */
uint32_t mc_socketid; /* physical socket of the physical core */
uint16_t mc_coreid; /* physical impacted core */
uint16_t mc_core_threadid; /* core thread of physical core */
uint32_t mc_apicid;
uint32_t mc_flags;
uint64_t mc_gstatus; /* global status */
};
/* contains x86 bank mc information */ struct mcinfo_bank { struct mcinfo_common common;
uint16_t mc_bank; /* bank nr */
uint16_t mc_domid; /* domain referenced by mc_addr if valid */
uint64_t mc_status; /* bank status */
uint64_t mc_addr; /* bank address */
uint64_t mc_misc;
uint64_t mc_ctrl2;
uint64_t mc_tsc;
};
/* contains mc information from other or additional mc MSRs */ struct mcinfo_extended { struct mcinfo_common common;
uint32_t mc_msrs; /* Number of msr with valid values. */ /* * Currently Intel extended MSR (32/64) include all gp registers * and E(R)FLAGS, E(R)IP, E(R)MISC, up to 11/19 of them might be * useful at present. So expand this array to 16/32 to leave room.
*/ struct mcinfo_msr mc_msr[sizeof(void *) * 4];
};
/* Recovery Action flags. Giving recovery result information to DOM0 */
/* Xen takes successful recovery action, the error is recovered */ #define REC_ACTION_RECOVERED (0x1 << 0) /* No action is performed by XEN */ #define REC_ACTION_NONE (0x1 << 1) /* It's possible DOM0 might take action ownership in some case */ #define REC_ACTION_NEED_RESET (0x1 << 2)
/* * Different Recovery Action types, if the action is performed successfully, * REC_ACTION_RECOVERED flag will be returned.
*/
/* * Below interface used between XEN/DOM0 for passing XEN's recovery action * information to DOM0.
*/ struct page_offline_action { /* Params for passing the offlined page number to DOM0 */
uint64_t mfn;
uint64_t status;
};
struct cpu_offline_action { /* Params for passing the identity of the offlined CPU to DOM0 */
uint32_t mc_socketid;
uint16_t mc_coreid;
uint16_t mc_core_threadid;
};
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;
}
/* * Fetch machine check data from hypervisor.
*/ #define XEN_MC_fetch 1 struct xen_mc_fetch { /* * IN: XEN_MC_NONURGENT, XEN_MC_URGENT, * XEN_MC_ACK if ack'king an earlier fetch * OUT: XEN_MC_OK, XEN_MC_FETCHAILED, XEN_MC_NODATA
*/
uint32_t flags;
uint32_t _pad0; /* OUT: id for ack, IN: id we are ack'ing */
uint64_t fetch_id;
/* OUT variables. */
GUEST_HANDLE(mc_info) data;
};
DEFINE_GUEST_HANDLE_STRUCT(xen_mc_fetch);
/* * This tells the hypervisor to notify a DomU about the machine check error
*/ #define XEN_MC_notifydomain 2 struct xen_mc_notifydomain { /* IN variables */
uint16_t mc_domid; /* The unprivileged domain to notify */
uint16_t mc_vcpuid; /* The vcpu in mc_domid to notify */
/* * Fields are zero when not available. Also, this struct is shared with * userspace mcelog and thus must keep existing fields at current offsets. * Only add new fields to the end of the structure
*/ struct xen_mce {
__u64 status;
__u64 misc;
__u64 addr;
__u64 mcgstatus;
__u64 ip;
__u64 tsc; /* cpu time stamp counter */
__u64 time; /* wall time_t when error was detected */
__u8 cpuvendor; /* cpu vendor as encoded in system.h */
__u8 inject_flags; /* software inject flags */
__u16 pad;
__u32 cpuid; /* CPUID 1 EAX */
__u8 cs; /* code segment */
__u8 bank; /* machine check bank */
__u8 cpu; /* cpu number; obsolete; use extcpu now */
__u8 finished; /* entry is valid */
__u32 extcpu; /* linux cpu number that detected the error */
__u32 socketid; /* CPU socket ID */
__u32 apicid; /* CPU initial apic ID */
__u64 mcgcap; /* MCGCAP MSR: machine check capabilities of CPU */
__u64 synd; /* MCA_SYND MSR: only valid on SMCA systems */
__u64 ipid; /* MCA_IPID MSR: only valid on SMCA systems */
__u64 ppin; /* Protected Processor Inventory Number */
};
/* * This structure contains all data related to the MCE log. Also * carries a signature to make it easier to find from external * debugging tools. Each entry is only valid when its finished flag * is set.
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.