linux/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Intel Uncore Frequency Setting
 * Copyright (c) 2022, Intel Corporation.
 * All rights reserved.
 *
 * Provide interface to set MSR 620 at a granularity of per die. On CPU online,
 * one control CPU is identified per die to read/write limit. This control CPU
 * is changed, if the CPU state is changed to offline. When the last CPU is
 * offline in a die then remove the sysfs object for that die.
 * The majority of actual code is related to sysfs create and read/write
 * attributes.
 *
 * Author: Srinivas Pandruvada <[email protected]>
 */

#include <linux/bitfield.h>
#include <linux/cpu.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/suspend.h>
#include <asm/cpu_device_id.h>
#include <asm/intel-family.h>

#include "uncore-frequency-common.h"

/* Max instances for uncore data, one for each die */
static int uncore_max_entries __read_mostly;
/* Storage for uncore data for all instances */
static struct uncore_data *uncore_instances;
/* Stores the CPU mask of the target CPUs to use during uncore read/write */
static cpumask_t uncore_cpu_mask;
/* CPU online callback register instance */
static enum cpuhp_state uncore_hp_state __read_mostly;

#define MSR_UNCORE_RATIO_LIMIT
#define MSR_UNCORE_PERF_STATUS
#define UNCORE_FREQ_KHZ_MULTIPLIER

#define UNCORE_MAX_RATIO_MASK
#define UNCORE_MIN_RATIO_MASK

#define UNCORE_CURRENT_RATIO_MASK

static int uncore_read_control_freq(struct uncore_data *data, unsigned int *value,
				    enum uncore_index index)
{}

static int uncore_write_control_freq(struct uncore_data *data, unsigned int input,
				     enum uncore_index index)
{}

static int uncore_read_freq(struct uncore_data *data, unsigned int *freq)
{}

static int uncore_read(struct uncore_data *data, unsigned int *value, enum uncore_index index)
{}

/* Caller provides protection */
static struct uncore_data *uncore_get_instance(unsigned int cpu)
{}

static int uncore_event_cpu_online(unsigned int cpu)
{}

static int uncore_event_cpu_offline(unsigned int cpu)
{}

static int uncore_pm_notify(struct notifier_block *nb, unsigned long mode,
			    void *_unused)
{}

static struct notifier_block uncore_pm_nb =;

static const struct x86_cpu_id intel_uncore_cpu_ids[] =;
MODULE_DEVICE_TABLE(x86cpu, intel_uncore_cpu_ids);

static int __init intel_uncore_init(void)
{}
module_init()

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

MODULE_IMPORT_NS();
MODULE_LICENSE();
MODULE_DESCRIPTION();