File Index
Files and directories
Sign in
FILE

uncore-frequency-common.h

File preview with syntax highlighting.

linux-6.19.14/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Intel Uncore Frequency Control: Common defines and prototypes
  4 * Copyright (c) 2022, Intel Corporation.
  5 * All rights reserved.
  6 *
  7 */
  8
  9#ifndef __INTEL_UNCORE_FREQ_COMMON_H
 10#define __INTEL_UNCORE_FREQ_COMMON_H
 11
 12#include <linux/device.h>
 13
 14/*
 15 * Define uncore agents, which are under uncore frequency control.
 16 * Defined in the same order as specified in the TPMI UFS Specifications.
 17 * It is possible that there are common uncore frequency control to more than
 18 * one hardware agents. So, these defines are used as a bit mask.
 19*/
 20
 21#define AGENT_TYPE_CORE		0x01
 22#define	AGENT_TYPE_CACHE	0x02
 23#define	AGENT_TYPE_MEMORY	0x04
 24#define	AGENT_TYPE_IO		0x08
 25
 26/**
 27 * struct uncore_data - Encapsulate all uncore data
 28 * @stored_uncore_data: Last user changed MSR 620 value, which will be restored
 29 *			on system resume.
 30 * @initial_min_freq_khz: Sampled minimum uncore frequency at driver init
 31 * @initial_max_freq_khz: Sampled maximum uncore frequency at driver init
 32 * @control_cpu:	Designated CPU for a die to read/write
 33 * @valid:		Mark the data valid/invalid
 34 * @package_id:	Package id for this instance
 35 * @die_id:		Die id for this instance
 36 * @domain_id:		Power domain id for this instance
 37 * @cluster_id:		cluster id in a domain
 38 * @instance_id:	Unique instance id to append to directory name
 39 * @name:		Sysfs entry name for this instance
 40 * @agent_type_mask:	Bit mask of all hardware agents for this domain
 41 * @uncore_attr_group:	Attribute group storage
 42 * @max_freq_khz_kobj_attr: Storage for kobject attribute max_freq_khz
 43 * @min_freq_khz_kobj_attr: Storage for kobject attribute min_freq_khz
 44 * @initial_max_freq_khz_kobj_attr: Storage for kobject attribute initial_max_freq_khz
 45 * @initial_min_freq_khz_kobj_attr: Storage for kobject attribute initial_min_freq_khz
 46 * @current_freq_khz_kobj_attr: Storage for kobject attribute current_freq_khz
 47 * @domain_id_kobj_attr: Storage for kobject attribute domain_id
 48 * @fabric_cluster_id_kobj_attr: Storage for kobject attribute fabric_cluster_id
 49 * @package_id_kobj_attr: Storage for kobject attribute package_id
 50 * @elc_low_threshold_percent_kobj_attr:
 51 *		Storage for kobject attribute elc_low_threshold_percent
 52 * @elc_high_threshold_percent_kobj_attr:
 53 *		Storage for kobject attribute elc_high_threshold_percent
 54 * @elc_high_threshold_enable_kobj_attr:
 55 *		Storage for kobject attribute elc_high_threshold_enable
 56 * @elc_floor_freq_khz_kobj_attr: Storage for kobject attribute elc_floor_freq_khz
 57 * @agent_types_kobj_attr: Storage for kobject attribute agent_type
 58 * @die_id_kobj_attr:	Attribute storage for die_id information
 59 * @uncore_attrs:	Attribute storage for group creation
 60 *
 61 * This structure is used to encapsulate all data related to uncore sysfs
 62 * settings for a die/package.
 63 */
 64struct uncore_data {
 65	u64 stored_uncore_data;
 66	u32 initial_min_freq_khz;
 67	u32 initial_max_freq_khz;
 68	int control_cpu;
 69	bool valid;
 70	int package_id;
 71	int die_id;
 72	int domain_id;
 73	int cluster_id;
 74	int instance_id;
 75	char name[32];
 76	u16  agent_type_mask;
 77
 78	struct attribute_group uncore_attr_group;
 79	struct kobj_attribute max_freq_khz_kobj_attr;
 80	struct kobj_attribute min_freq_khz_kobj_attr;
 81	struct kobj_attribute initial_max_freq_khz_kobj_attr;
 82	struct kobj_attribute initial_min_freq_khz_kobj_attr;
 83	struct kobj_attribute current_freq_khz_kobj_attr;
 84	struct kobj_attribute domain_id_kobj_attr;
 85	struct kobj_attribute fabric_cluster_id_kobj_attr;
 86	struct kobj_attribute package_id_kobj_attr;
 87	struct kobj_attribute elc_low_threshold_percent_kobj_attr;
 88	struct kobj_attribute elc_high_threshold_percent_kobj_attr;
 89	struct kobj_attribute elc_high_threshold_enable_kobj_attr;
 90	struct kobj_attribute elc_floor_freq_khz_kobj_attr;
 91	struct kobj_attribute agent_types_kobj_attr;
 92	struct kobj_attribute die_id_kobj_attr;
 93	struct attribute *uncore_attrs[15];
 94};
 95
 96#define UNCORE_DOMAIN_ID_INVALID	-1
 97
 98enum uncore_index {
 99	UNCORE_INDEX_MIN_FREQ,
100	UNCORE_INDEX_MAX_FREQ,
101	UNCORE_INDEX_CURRENT_FREQ,
102	UNCORE_INDEX_EFF_LAT_CTRL_LOW_THRESHOLD,
103	UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD,
104	UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD_ENABLE,
105	UNCORE_INDEX_EFF_LAT_CTRL_FREQ,
106	UNCORE_INDEX_DIE_ID,
107};
108
109int uncore_freq_common_init(int (*read)(struct uncore_data *data, unsigned int *value,
110					enum uncore_index index),
111			    int (*write)(struct uncore_data *data, unsigned int input,
112					 enum uncore_index index));
113void uncore_freq_common_exit(void);
114int uncore_freq_add_entry(struct uncore_data *data, int cpu);
115void uncore_freq_remove_die_entry(struct uncore_data *data);
116
117#endif
~/ Read-only file preview.