#define pr_fmt(fmt) …
#include <linux/init.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
#include <linux/uaccess.h>
#include <linux/capability.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <xen/interface/xen.h>
#include <xen/events.h>
#include <xen/interface/vcpu.h>
#include <xen/xen.h>
#include <asm/xen/hypercall.h>
#include <asm/xen/hypervisor.h>
static struct mc_info g_mi;
static struct mcinfo_logical_cpu *g_physinfo;
static uint32_t ncpus;
static DEFINE_MUTEX(mcelog_lock);
static struct xen_mce_log xen_mcelog = …;
static DEFINE_SPINLOCK(xen_mce_chrdev_state_lock);
static int xen_mce_chrdev_open_count;
static int xen_mce_chrdev_open_exclu;
static DECLARE_WAIT_QUEUE_HEAD(xen_mce_chrdev_wait);
static int xen_mce_chrdev_open(struct inode *inode, struct file *file)
{ … }
static int xen_mce_chrdev_release(struct inode *inode, struct file *file)
{ … }
static ssize_t xen_mce_chrdev_read(struct file *filp, char __user *ubuf,
size_t usize, loff_t *off)
{ … }
static __poll_t xen_mce_chrdev_poll(struct file *file, poll_table *wait)
{ … }
static long xen_mce_chrdev_ioctl(struct file *f, unsigned int cmd,
unsigned long arg)
{ … }
static const struct file_operations xen_mce_chrdev_ops = …;
static struct miscdevice xen_mce_chrdev_device = …;
static void xen_mce_log(struct xen_mce *mce)
{ … }
static int convert_log(struct mc_info *mi)
{ … }
static int mc_queue_handle(uint32_t flags)
{ … }
static void xen_mce_work_fn(struct work_struct *work)
{ … }
static DECLARE_WORK(xen_mce_work, xen_mce_work_fn);
static irqreturn_t xen_mce_interrupt(int irq, void *dev_id)
{ … }
static int bind_virq_for_mce(void)
{ … }
static int __init xen_late_init_mcelog(void)
{ … }
device_initcall(xen_late_init_mcelog);