linux/arch/x86/kernel/msr.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* ----------------------------------------------------------------------- *
 *
 *   Copyright 2000-2008 H. Peter Anvin - All Rights Reserved
 *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
 *
 * ----------------------------------------------------------------------- */

/*
 * x86 MSR access device
 *
 * This device is accessed by lseek() to the appropriate register number
 * and then read/write in chunks of 8 bytes.  A larger size means multiple
 * reads or writes of the same register.
 *
 * This driver uses /dev/cpu/%d/msr where %d is the minor number, and on
 * an SMP box will direct the access to CPU %d.
 */

#define pr_fmt(fmt)

#include <linux/module.h>

#include <linux/types.h>
#include <linux/errno.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/smp.h>
#include <linux/major.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/cpu.h>
#include <linux/notifier.h>
#include <linux/uaccess.h>
#include <linux/gfp.h>
#include <linux/security.h>

#include <asm/cpufeature.h>
#include <asm/msr.h>

static enum cpuhp_state cpuhp_msr_state;

enum allow_write_msrs {};

static enum allow_write_msrs allow_writes =;

static ssize_t msr_read(struct file *file, char __user *buf,
			size_t count, loff_t *ppos)
{}

static int filter_write(u32 reg)
{}

static ssize_t msr_write(struct file *file, const char __user *buf,
			 size_t count, loff_t *ppos)
{}

static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg)
{}

static int msr_open(struct inode *inode, struct file *file)
{}

/*
 * File operations we support
 */
static const struct file_operations msr_fops =;

static char *msr_devnode(const struct device *dev, umode_t *mode)
{}

static const struct class msr_class =;

static int msr_device_create(unsigned int cpu)
{}

static int msr_device_destroy(unsigned int cpu)
{}

static int __init msr_init(void)
{}
module_init();

static void __exit msr_exit(void)
{}
module_exit()

static int set_allow_writes(const char *val, const struct kernel_param *cp)
{}

static int get_allow_writes(char *buf, const struct kernel_param *kp)
{}

static const struct kernel_param_ops allow_writes_ops =;

module_param_cb();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();