Commit ea009e47 authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Hans de Goede

platform/x86: ISST: Add SST-PP support via TPMI

This Intel Speed Select Technology - Performance Profile (SST-PP) feature
introduces a mechanism that allows multiple optimized performance profiles
per system. Each profile defines a set of CPUs that need to be online and
rest offline to sustain a guaranteed base frequency.

Five new IOCTLs are added:
ISST_IF_PERF_LEVELS : Get number of performance levels
ISST_IF_PERF_SET_LEVEL : Set to a new performance level
ISST_IF_PERF_SET_FEATURE : Activate SST-BF/SST-TF for a performance level
ISST_IF_GET_PERF_LEVEL_INFO : Get parameters for a performance level
ISST_IF_GET_PERF_LEVEL_CPU_MASK : Get CPU mask for a performance level

Once an instance is identified, read or write from correct MMIO
offset for a given field as defined in the specification.

For details on SST PP operations using intel-speed-selet utility,
refer to:
Documentation/admin-guide/pm/intel-speed-select.rst
under the kernel documentation
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
Tested-by: default avatarPragya Tanwar <pragya.tanwar@intel.com>
Link: https://lore.kernel.org/r/20230308070642.1727167-6-srinivas.pandruvada@linux.intel.comSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 12a7d2cb
......@@ -254,6 +254,178 @@ struct isst_tpmi_instance_count {
__u16 valid_mask;
};
/**
* struct isst_perf_level_info - Structure to get information on SST-PP levels
* @socket_id: Socket/package id
* @power_domain: Power Domain id
* @logical_cpu: CPU number
* @clos: Clos ID to assign to the logical CPU
* @max_level: Maximum performance level supported by the platform
* @feature_rev: The feature revision for SST-PP supported by the platform
* @level_mask: Mask of supported performance levels
* @current_level: Current performance level
* @feature_state: SST-BF and SST-TF (enabled/disabled) status at current level
* @locked: SST-PP performance level change is locked/unlocked
* @enabled: SST-PP feature is enabled or not
* @sst-tf_support: SST-TF support status at this level
* @sst-bf_support: SST-BF support status at this level
*
* Structure to get SST-PP details using IOCTL ISST_IF_PERF_LEVELS.
*/
struct isst_perf_level_info {
__u8 socket_id;
__u8 power_domain_id;
__u8 max_level;
__u8 feature_rev;
__u8 level_mask;
__u8 current_level;
__u8 feature_state;
__u8 locked;
__u8 enabled;
__u8 sst_tf_support;
__u8 sst_bf_support;
};
/**
* struct isst_perf_level_control - Structure to set SST-PP level
* @socket_id: Socket/package id
* @power_domain: Power Domain id
* @level: level to set
*
* Structure used change SST-PP level using IOCTL ISST_IF_PERF_SET_LEVEL.
*/
struct isst_perf_level_control {
__u8 socket_id;
__u8 power_domain_id;
__u8 level;
};
/**
* struct isst_perf_feature_control - Structure to activate SST-BF/SST-TF
* @socket_id: Socket/package id
* @power_domain: Power Domain id
* @feature: bit 0 = SST-BF state, bit 1 = SST-TF state
*
* Structure used to enable SST-BF/SST-TF using IOCTL ISST_IF_PERF_SET_FEATURE.
*/
struct isst_perf_feature_control {
__u8 socket_id;
__u8 power_domain_id;
__u8 feature;
};
#define TRL_MAX_BUCKETS 8
#define TRL_MAX_LEVELS 6
/**
* struct isst_perf_level_data_info - Structure to get SST-PP level details
* @socket_id: Socket/package id
* @power_domain: Power Domain id
* @level: SST-PP level for which caller wants to get information
* @tdp_ratio: TDP Ratio
* @base_freq_mhz: Base frequency in MHz
* @base_freq_avx2_mhz: AVX2 Base frequency in MHz
* @base_freq_avx512_mhz: AVX512 base frequency in MHz
* @base_freq_amx_mhz: AMX base frequency in MHz
* @thermal_design_power_w: Thermal design (TDP) power
* @tjunction_max_c: Max junction temperature
* @max_memory_freq_mhz: Max memory frequency in MHz
* @cooling_type: Type of cooling is used
* @p0_freq_mhz: core maximum frequency
* @p1_freq_mhz: Core TDP frequency
* @pn_freq_mhz: Core maximum efficiency frequency
* @pm_freq_mhz: Core minimum frequency
* @p0_fabric_freq_mhz: Fabric (Uncore) maximum frequency
* @p1_fabric_freq_mhz: Fabric (Uncore) TDP frequency
* @pn_fabric_freq_mhz: Fabric (Uncore) minimum efficiency frequency
* @pm_fabric_freq_mhz: Fabric (Uncore) minimum frequency
* @max_buckets: Maximum trl buckets
* @max_trl_levels: Maximum trl levels
* @bucket_core_counts[TRL_MAX_BUCKETS]: Number of cores per bucket
* @trl_freq_mhz[TRL_MAX_LEVELS][TRL_MAX_BUCKETS]: maximum frequency
* for a bucket and trl level
*
* Structure used to get information on frequencies and TDP for a SST-PP
* level using ISST_IF_GET_PERF_LEVEL_INFO.
*/
struct isst_perf_level_data_info {
__u8 socket_id;
__u8 power_domain_id;
__u16 level;
__u16 tdp_ratio;
__u16 base_freq_mhz;
__u16 base_freq_avx2_mhz;
__u16 base_freq_avx512_mhz;
__u16 base_freq_amx_mhz;
__u16 thermal_design_power_w;
__u16 tjunction_max_c;
__u16 max_memory_freq_mhz;
__u16 cooling_type;
__u16 p0_freq_mhz;
__u16 p1_freq_mhz;
__u16 pn_freq_mhz;
__u16 pm_freq_mhz;
__u16 p0_fabric_freq_mhz;
__u16 p1_fabric_freq_mhz;
__u16 pn_fabric_freq_mhz;
__u16 pm_fabric_freq_mhz;
__u16 max_buckets;
__u16 max_trl_levels;
__u16 bucket_core_counts[TRL_MAX_BUCKETS];
__u16 trl_freq_mhz[TRL_MAX_LEVELS][TRL_MAX_BUCKETS];
};
/**
* struct isst_perf_level_cpu_mask - Structure to get SST-PP level CPU mask
* @socket_id: Socket/package id
* @power_domain: Power Domain id
* @level: SST-PP level for which caller wants to get information
* @punit_cpu_map: Set to 1 if the CPU number is punit numbering not
* Linux CPU number. If 0 CPU buffer is copied to user space
* supplied cpu_buffer of size cpu_buffer_size. Punit
* cpu mask is copied to "mask" field.
* @mask: cpu mask for this PP level (punit CPU numbering)
* @cpu_buffer_size: size of cpu_buffer also used to return the copied CPU
* buffer size.
* @cpu_buffer: Buffer to copy CPU mask when punit_cpu_map is 0
*
* Structure used to get cpumask for a SST-PP level using
* IOCTL ISST_IF_GET_PERF_LEVEL_CPU_MASK. Also used to get CPU mask for
* IOCTL ISST_IF_GET_BASE_FREQ_CPU_MASK for SST-BF.
*/
struct isst_perf_level_cpu_mask {
__u8 socket_id;
__u8 power_domain_id;
__u8 level;
__u8 punit_cpu_map;
__u64 mask;
__u16 cpu_buffer_size;
__s8 cpu_buffer[1];
};
/**
* struct isst_base_freq_info - Structure to get SST-BF frequencies
* @socket_id: Socket/package id
* @power_domain: Power Domain id
* @level: SST-PP level for which caller wants to get information
* @high_base_freq_mhz: High priority CPU base frequency
* @low_base_freq_mhz: Low priority CPU base frequency
* @tjunction_max_c: Max junction temperature
* @thermal_design_power_w: Thermal design power in watts
*
* Structure used to get SST-BF information using
* IOCTL ISST_IF_GET_BASE_FREQ_INFO.
*/
struct isst_base_freq_info {
__u8 socket_id;
__u8 power_domain_id;
__u16 level;
__u16 high_base_freq_mhz;
__u16 low_base_freq_mhz;
__u16 tjunction_max_c;
__u16 thermal_design_power_w;
};
#define ISST_IF_MAGIC 0xFE
#define ISST_IF_GET_PLATFORM_INFO _IOR(ISST_IF_MAGIC, 0, struct isst_if_platform_info *)
#define ISST_IF_GET_PHY_ID _IOWR(ISST_IF_MAGIC, 1, struct isst_if_cpu_map *)
......@@ -266,4 +438,12 @@ struct isst_tpmi_instance_count {
#define ISST_IF_CLOS_PARAM _IOWR(ISST_IF_MAGIC, 7, struct isst_clos_param *)
#define ISST_IF_CLOS_ASSOC _IOWR(ISST_IF_MAGIC, 8, struct isst_if_clos_assoc_cmds *)
#define ISST_IF_PERF_LEVELS _IOWR(ISST_IF_MAGIC, 9, struct isst_perf_level_info *)
#define ISST_IF_PERF_SET_LEVEL _IOW(ISST_IF_MAGIC, 10, struct isst_perf_level_control *)
#define ISST_IF_PERF_SET_FEATURE _IOW(ISST_IF_MAGIC, 11, struct isst_perf_feature_control *)
#define ISST_IF_GET_PERF_LEVEL_INFO _IOR(ISST_IF_MAGIC, 12, struct isst_perf_level_data_info *)
#define ISST_IF_GET_PERF_LEVEL_CPU_MASK _IOR(ISST_IF_MAGIC, 13, struct isst_perf_level_cpu_mask *)
#define ISST_IF_GET_BASE_FREQ_INFO _IOR(ISST_IF_MAGIC, 14, struct isst_base_freq_info *)
#define ISST_IF_GET_BASE_FREQ_CPU_MASK _IOR(ISST_IF_MAGIC, 15, struct isst_perf_level_cpu_mask *)
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment