linux/include/xen/interface/xen-mca.h

/* 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 <[email protected]>
 *
 * Updated by Intel Corporation
 * Author: Liu, Jinsong <[email protected]>
 *
 * 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.
 */

#ifndef __XEN_PUBLIC_ARCH_X86_MCA_H__
#define __XEN_PUBLIC_ARCH_X86_MCA_H__

/* Hypercall */
#define __HYPERVISOR_mca

#define XEN_MCA_INTERFACE_VERSION

/* IN: Dom0 calls hypercall to retrieve nonurgent error log entry */
#define XEN_MC_NONURGENT
/* IN: Dom0 calls hypercall to retrieve urgent error log entry */
#define XEN_MC_URGENT
/* IN: Dom0 acknowledges previosly-fetched error log entry */
#define XEN_MC_ACK

/* OUT: All is ok */
#define XEN_MC_OK
/* OUT: Domain could not fetch data. */
#define XEN_MC_FETCHFAILED
/* OUT: There was no machine check data to fetch. */
#define XEN_MC_NODATA

#ifndef __ASSEMBLY__
/* vIRQ injected to Dom0 */
#define VIRQ_MCA

/*
 * 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
#define MC_TYPE_BANK
#define MC_TYPE_EXTENDED
#define MC_TYPE_RECOVERY

struct mcinfo_common {};

#define MC_FLAG_CORRECTABLE
#define MC_FLAG_UNCORRECTABLE
#define MC_FLAG_RECOVERABLE
#define MC_FLAG_POLLED
#define MC_FLAG_RESET
#define MC_FLAG_CMCI
#define MC_FLAG_MCE

/* contains x86 global mc information */
struct mcinfo_global {};

/* contains x86 bank mc information */
struct mcinfo_bank {};

struct mcinfo_msr {};

/* contains mc information from other or additional mc MSRs */
struct mcinfo_extended {};

/* Recovery Action flags. Giving recovery result information to DOM0 */

/* Xen takes successful recovery action, the error is recovered */
#define REC_ACTION_RECOVERED
/* No action is performed by XEN */
#define REC_ACTION_NONE
/* It's possible DOM0 might take action ownership in some case */
#define REC_ACTION_NEED_RESET

/*
 * Different Recovery Action types, if the action is performed successfully,
 * REC_ACTION_RECOVERED flag will be returned.
 */

/* Page Offline Action */
#define MC_ACTION_PAGE_OFFLINE
/* CPU offline Action */
#define MC_ACTION_CPU_OFFLINE
/* L3 cache disable Action */
#define MC_ACTION_CACHE_SHRINK

/*
 * Below interface used between XEN/DOM0 for passing XEN's recovery action
 * information to DOM0.
 */
struct page_offline_action {};

struct cpu_offline_action {};

#define MAX_UNION_SIZE
struct mcinfo_recovery {};


#define MCINFO_MAXSIZE
struct mc_info {};
DEFINE_GUEST_HANDLE_STRUCT();

#define __MC_MSR_ARRAYSIZE
#define __MC_NMSRS
#define MC_NCAPS
struct mcinfo_logical_cpu {};
DEFINE_GUEST_HANDLE_STRUCT();

/*
 * Prototype:
 *    uint32_t x86_mcinfo_nentries(struct mc_info *mi);
 */
#define x86_mcinfo_nentries(_mi)
/*
 * Prototype:
 *    struct mcinfo_common *x86_mcinfo_first(struct mc_info *mi);
 */
#define x86_mcinfo_first(_mi)
/*
 * Prototype:
 *    struct mcinfo_common *x86_mcinfo_next(struct mcinfo_common *mic);
 */
#define x86_mcinfo_next(_mic)

/*
 * Prototype:
 *    void x86_mcinfo_lookup(void *ret, struct mc_info *mi, uint16_t type);
 */
static inline void x86_mcinfo_lookup(struct mcinfo_common **ret,
				     struct mc_info *mi, uint16_t type)
{}

/*
 * Fetch machine check data from hypervisor.
 */
#define XEN_MC_fetch
struct xen_mc_fetch {};
DEFINE_GUEST_HANDLE_STRUCT();


/*
 * This tells the hypervisor to notify a DomU about the machine check error
 */
#define XEN_MC_notifydomain
struct xen_mc_notifydomain {};
DEFINE_GUEST_HANDLE_STRUCT();

#define XEN_MC_physcpuinfo
struct xen_mc_physcpuinfo {};

#define XEN_MC_msrinject
#define MC_MSRINJ_MAXMSRS
struct xen_mc_msrinject {};

/* Flags for mcinj_flags above; bits 16-31 are reserved */
#define MC_MSRINJ_F_INTERPOSE

#define XEN_MC_mceinject
struct xen_mc_mceinject {};

struct xen_mc {};
DEFINE_GUEST_HANDLE_STRUCT();

/*
 * 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 {};

/*
 * 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.
 */

#define XEN_MCE_LOG_LEN

struct xen_mce_log {};

#define XEN_MCE_OVERFLOW

#define XEN_MCE_LOG_SIGNATURE

#define MCE_GET_RECORD_LEN
#define MCE_GET_LOG_LEN
#define MCE_GETCLEAR_FLAGS

#endif /* __ASSEMBLY__ */
#endif /* __XEN_PUBLIC_ARCH_X86_MCA_H__ */