File Index
Files and directories
Sign in
FILE

isst_if.h

File preview with syntax highlighting.

linux-6.19.14/include/uapi/linux/isst_if.h C
  1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2/*
  3 * Intel Speed Select Interface: OS to hardware Interface
  4 * Copyright (c) 2019, Intel Corporation.
  5 * All rights reserved.
  6 *
  7 * Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  8 */
  9
 10#ifndef __ISST_IF_H
 11#define __ISST_IF_H
 12
 13#include <linux/types.h>
 14
 15/**
 16 * struct isst_if_platform_info - Define platform information
 17 * @api_version:	Version of the firmware document, which this driver
 18 *			can communicate
 19 * @driver_version:	Driver version, which will help user to send right
 20 *			commands. Even if the firmware is capable, driver may
 21 *			not be ready
 22 * @max_cmds_per_ioctl:	Returns the maximum number of commands driver will
 23 *			accept in a single ioctl
 24 * @mbox_supported:	Support of mail box interface
 25 * @mmio_supported:	Support of mmio interface for core-power feature
 26 *
 27 * Used to return output of IOCTL ISST_IF_GET_PLATFORM_INFO. This
 28 * information can be used by the user space, to get the driver, firmware
 29 * support and also number of commands to send in a single IOCTL request.
 30 */
 31struct isst_if_platform_info {
 32	__u16 api_version;
 33	__u16 driver_version;
 34	__u16 max_cmds_per_ioctl;
 35	__u8 mbox_supported;
 36	__u8 mmio_supported;
 37};
 38
 39/**
 40 * struct isst_if_cpu_map - CPU mapping between logical and physical CPU
 41 * @logical_cpu:	Linux logical CPU number
 42 * @physical_cpu:	PUNIT CPU number
 43 *
 44 * Used to convert from Linux logical CPU to PUNIT CPU numbering scheme.
 45 * The PUNIT CPU number is different than APIC ID based CPU numbering.
 46 */
 47struct isst_if_cpu_map {
 48	__u32 logical_cpu;
 49	__u32 physical_cpu;
 50};
 51
 52/**
 53 * struct isst_if_cpu_maps - structure for CPU map IOCTL
 54 * @cmd_count:	Number of CPU mapping command in cpu_map[]
 55 * @cpu_map:	Holds one or more CPU map data structure
 56 *
 57 * This structure used with ioctl ISST_IF_GET_PHY_ID to send
 58 * one or more CPU mapping commands. Here IOCTL return value indicates
 59 * number of commands sent or error number if no commands have been sent.
 60 */
 61struct isst_if_cpu_maps {
 62	__u32 cmd_count;
 63	struct isst_if_cpu_map cpu_map[1];
 64};
 65
 66/**
 67 * struct isst_if_io_reg - Read write PUNIT IO register
 68 * @read_write:		Value 0: Read, 1: Write
 69 * @logical_cpu:	Logical CPU number to get target PCI device.
 70 * @reg:		PUNIT register offset
 71 * @value:		For write operation value to write and for
 72 *			read placeholder read value
 73 *
 74 * Structure to specify read/write data to PUNIT registers.
 75 */
 76struct isst_if_io_reg {
 77	__u32 read_write; /* Read:0, Write:1 */
 78	__u32 logical_cpu;
 79	__u32 reg;
 80	__u32 value;
 81};
 82
 83/**
 84 * struct isst_if_io_regs - structure for IO register commands
 85 * @req_count:	Number of io reg commands in io_reg[]
 86 * @io_reg:	Holds one or more io_reg command structure
 87 *
 88 * This structure used with ioctl ISST_IF_IO_CMD to send
 89 * one or more read/write commands to PUNIT. Here IOCTL return value
 90 * indicates number of requests sent or error number if no requests have
 91 * been sent.
 92 */
 93struct isst_if_io_regs {
 94	__u32 req_count;
 95	struct isst_if_io_reg io_reg[1];
 96};
 97
 98/**
 99 * struct isst_if_mbox_cmd - Structure to define mail box command
100 * @logical_cpu:	Logical CPU number to get target PCI device
101 * @parameter:		Mailbox parameter value
102 * @req_data:		Request data for the mailbox
103 * @resp_data:		Response data for mailbox command response
104 * @command:		Mailbox command value
105 * @sub_command:	Mailbox sub command value
106 * @reserved:		Unused, set to 0
107 *
108 * Structure to specify mailbox command to be sent to PUNIT.
109 */
110struct isst_if_mbox_cmd {
111	__u32 logical_cpu;
112	__u32 parameter;
113	__u32 req_data;
114	__u32 resp_data;
115	__u16 command;
116	__u16 sub_command;
117	__u32 reserved;
118};
119
120/**
121 * struct isst_if_mbox_cmds - structure for mailbox commands
122 * @cmd_count:	Number of mailbox commands in mbox_cmd[]
123 * @mbox_cmd:	Holds one or more mbox commands
124 *
125 * This structure used with ioctl ISST_IF_MBOX_COMMAND to send
126 * one or more mailbox commands to PUNIT. Here IOCTL return value
127 * indicates number of commands sent or error number if no commands have
128 * been sent.
129 */
130struct isst_if_mbox_cmds {
131	__u32 cmd_count;
132	struct isst_if_mbox_cmd mbox_cmd[1];
133};
134
135/**
136 * struct isst_if_msr_cmd - Structure to define msr command
137 * @read_write:		Value 0: Read, 1: Write
138 * @logical_cpu:	Logical CPU number
139 * @msr:		MSR number
140 * @data:		For write operation, data to write, for read
141 *			place holder
142 *
143 * Structure to specify MSR command related to PUNIT.
144 */
145struct isst_if_msr_cmd {
146	__u32 read_write; /* Read:0, Write:1 */
147	__u32 logical_cpu;
148	__u64 msr;
149	__u64 data;
150};
151
152/**
153 * struct isst_if_msr_cmds - structure for msr commands
154 * @cmd_count:	Number of mailbox commands in msr_cmd[]
155 * @msr_cmd:	Holds one or more msr commands
156 *
157 * This structure used with ioctl ISST_IF_MSR_COMMAND to send
158 * one or more MSR commands. IOCTL return value indicates number of
159 * commands sent or error number if no commands have been sent.
160 */
161struct isst_if_msr_cmds {
162	__u32 cmd_count;
163	struct isst_if_msr_cmd msr_cmd[1];
164};
165
166/**
167 * struct isst_core_power - Structure to get/set core_power feature
168 * @get_set:	0: Get, 1: Set
169 * @socket_id:	Socket/package id
170 * @power_domain_id: Power Domain id
171 * @enable:	Feature enable status
172 * @supported:	Power domain supports SST_CP interface
173 * @priority_type: Priority type for the feature (ordered/proportional)
174 *
175 * Structure to get/set core_power feature state using IOCTL
176 * ISST_IF_CORE_POWER_STATE.
177 */
178struct isst_core_power {
179	__u8 get_set;
180	__u8 socket_id;
181	__u8 power_domain_id;
182	__u8 enable;
183	__u8 supported;
184	__u8 priority_type;
185};
186
187/**
188 * struct isst_clos_param - Structure to get/set clos praram
189 * @get_set:	0: Get, 1: Set
190 * @socket_id:	Socket/package id
191 * @power_domain_id:	Power Domain id
192 * @clos:	Clos ID for the parameters
193 * @min_freq_mhz: Minimum frequency in MHz
194 * @max_freq_mhz: Maximum frequency in MHz
195 * @prop_prio:	Proportional priority from 0-15
196 *
197 * Structure to get/set per clos property using IOCTL
198 * ISST_IF_CLOS_PARAM.
199 */
200struct isst_clos_param {
201	__u8 get_set;
202	__u8 socket_id;
203	__u8 power_domain_id;
204	__u8 clos;
205	__u16 min_freq_mhz;
206	__u16 max_freq_mhz;
207	__u8 prop_prio;
208};
209
210/**
211 * struct isst_if_clos_assoc - Structure to assign clos to a CPU
212 * @socket_id:	Socket/package id
213 * @power_domain_id:	Power Domain id
214 * @logical_cpu: CPU number
215 * @clos:	Clos ID to assign to the logical CPU
216 *
217 * Structure to get/set core_power feature.
218 */
219struct isst_if_clos_assoc {
220	__u8 socket_id;
221	__u8 power_domain_id;
222	__u16 logical_cpu;
223	__u16 clos;
224};
225
226/**
227 * struct isst_if_clos_assoc_cmds - Structure to assign clos to CPUs
228 * @cmd_count:	Number of cmds (cpus) in this request
229 * @get_set:	Request is for get or set
230 * @punit_cpu_map: Set to 1 if the CPU number is punit numbering not
231 *		   Linux CPU number
232 * @assoc_info: CLOS data for this CPU
233 *
234 * Structure used to get/set associate CPUs to clos using IOCTL
235 * ISST_IF_CLOS_ASSOC.
236 */
237struct isst_if_clos_assoc_cmds {
238	__u16 cmd_count;
239	__u16 get_set;
240	__u16 punit_cpu_map;
241	struct isst_if_clos_assoc assoc_info[1];
242};
243
244/**
245 * struct isst_tpmi_instance_count - Get number of TPMI instances per socket
246 * @socket_id:	Socket/package id
247 * @count:	Number of instances
248 * @valid_mask: Mask of instances as there can be holes
249 *
250 * Structure used to get TPMI instances information using
251 * IOCTL ISST_IF_COUNT_TPMI_INSTANCES.
252 */
253struct isst_tpmi_instance_count {
254	__u8 socket_id;
255	__u8 count;
256	__u16 valid_mask;
257};
258
259/**
260 * struct isst_perf_level_info - Structure to get information on SST-PP levels
261 * @socket_id:	Socket/package id
262 * @power_domain_id:	Power Domain id
263 * @logical_cpu: CPU number
264 * @clos:	Clos ID to assign to the logical CPU
265 * @max_level: Maximum performance level supported by the platform
266 * @feature_rev: The feature revision for SST-PP supported by the platform
267 * @level_mask: Mask of supported performance levels
268 * @current_level: Current performance level
269 * @feature_state: SST-BF and SST-TF (enabled/disabled) status at current level
270 * @locked: SST-PP performance level change is locked/unlocked
271 * @enabled: SST-PP feature is enabled or not
272 * @sst_tf_support: SST-TF support status at this level
273 * @sst_bf_support: SST-BF support status at this level
274 *
275 * Structure to get SST-PP details using IOCTL ISST_IF_PERF_LEVELS.
276 */
277struct isst_perf_level_info {
278	__u8 socket_id;
279	__u8 power_domain_id;
280	__u8 max_level;
281	__u8 feature_rev;
282	__u8 level_mask;
283	__u8 current_level;
284	__u8 feature_state;
285	__u8 locked;
286	__u8 enabled;
287	__u8 sst_tf_support;
288	__u8 sst_bf_support;
289};
290
291/**
292 * struct isst_perf_level_control - Structure to set SST-PP level
293 * @socket_id:	Socket/package id
294 * @power_domain_id:	Power Domain id
295 * @level:	level to set
296 *
297 * Structure used change SST-PP level using IOCTL ISST_IF_PERF_SET_LEVEL.
298 */
299struct isst_perf_level_control {
300	__u8 socket_id;
301	__u8 power_domain_id;
302	__u8 level;
303};
304
305/**
306 * struct isst_perf_feature_control - Structure to activate SST-BF/SST-TF
307 * @socket_id:	Socket/package id
308 * @power_domain_id:	Power Domain id
309 * @feature:	bit 0 = SST-BF state, bit 1 = SST-TF state
310 *
311 * Structure used to enable SST-BF/SST-TF using IOCTL ISST_IF_PERF_SET_FEATURE.
312 */
313struct isst_perf_feature_control {
314	__u8 socket_id;
315	__u8 power_domain_id;
316	__u8 feature;
317};
318
319#define TRL_MAX_BUCKETS	8
320#define TRL_MAX_LEVELS		6
321
322/**
323 * struct isst_perf_level_data_info - Structure to get SST-PP level details
324 * @socket_id:	Socket/package id
325 * @power_domain_id:	Power Domain id
326 * @level:	SST-PP level for which caller wants to get information
327 * @tdp_ratio: TDP Ratio
328 * @base_freq_mhz: Base frequency in MHz
329 * @base_freq_avx2_mhz: AVX2 Base frequency in MHz
330 * @base_freq_avx512_mhz: AVX512 base frequency in MHz
331 * @base_freq_amx_mhz: AMX base frequency in MHz
332 * @thermal_design_power_w: Thermal design (TDP) power
333 * @tjunction_max_c: Max junction temperature
334 * @max_memory_freq_mhz: Max memory frequency in MHz
335 * @cooling_type: Type of cooling is used
336 * @p0_freq_mhz: core maximum frequency
337 * @p1_freq_mhz: Core TDP frequency
338 * @pn_freq_mhz: Core maximum efficiency frequency
339 * @pm_freq_mhz: Core minimum frequency
340 * @p0_fabric_freq_mhz: Fabric (Uncore) maximum frequency
341 * @p1_fabric_freq_mhz: Fabric (Uncore) TDP frequency
342 * @pn_fabric_freq_mhz: Fabric (Uncore) minimum efficiency frequency
343 * @pm_fabric_freq_mhz: Fabric (Uncore) minimum frequency
344 * @max_buckets: Maximum trl buckets
345 * @max_trl_levels: Maximum trl levels
346 * @bucket_core_counts: Number of cores per bucket
347 * @trl_freq_mhz: maximum frequency
348 * for a bucket and trl level
349 *
350 * Structure used to get information on frequencies and TDP for a SST-PP
351 * level using ISST_IF_GET_PERF_LEVEL_INFO.
352 */
353struct isst_perf_level_data_info {
354	__u8 socket_id;
355	__u8 power_domain_id;
356	__u16 level;
357	__u16 tdp_ratio;
358	__u16 base_freq_mhz;
359	__u16 base_freq_avx2_mhz;
360	__u16 base_freq_avx512_mhz;
361	__u16 base_freq_amx_mhz;
362	__u16 thermal_design_power_w;
363	__u16 tjunction_max_c;
364	__u16 max_memory_freq_mhz;
365	__u16 cooling_type;
366	__u16 p0_freq_mhz;
367	__u16 p1_freq_mhz;
368	__u16 pn_freq_mhz;
369	__u16 pm_freq_mhz;
370	__u16 p0_fabric_freq_mhz;
371	__u16 p1_fabric_freq_mhz;
372	__u16 pn_fabric_freq_mhz;
373	__u16 pm_fabric_freq_mhz;
374	__u16 max_buckets;
375	__u16 max_trl_levels;
376	__u16 bucket_core_counts[TRL_MAX_BUCKETS];
377	__u16 trl_freq_mhz[TRL_MAX_LEVELS][TRL_MAX_BUCKETS];
378};
379
380#define MAX_FABRIC_COUNT	8
381
382/**
383 * struct isst_perf_level_fabric_info - Structure to get SST-PP fabric details
384 * @socket_id:		Socket/package id
385 * @power_domain_id:	Power Domain id
386 * @level:		SST-PP level for which caller wants to get information
387 * @max_fabrics:	Count of fabrics in resonse
388 * @p0_fabric_freq_mhz: Fabric (Uncore) maximum frequency
389 * @p1_fabric_freq_mhz: Fabric (Uncore) TDP frequency
390 * @pm_fabric_freq_mhz: Fabric (Uncore) minimum frequency
391 *
392 * Structure used to get information on frequencies for fabrics.
393 */
394struct isst_perf_level_fabric_info {
395	__u8 socket_id;
396	__u8 power_domain_id;
397	__u16 level;
398	__u16 max_fabrics;
399	__u16 p0_fabric_freq_mhz[MAX_FABRIC_COUNT];
400	__u16 p1_fabric_freq_mhz[MAX_FABRIC_COUNT];
401	__u16 pm_fabric_freq_mhz[MAX_FABRIC_COUNT];
402};
403
404/**
405 * struct isst_perf_level_cpu_mask - Structure to get SST-PP level CPU mask
406 * @socket_id:	Socket/package id
407 * @power_domain_id:	Power Domain id
408 * @level:	SST-PP level for which caller wants to get information
409 * @punit_cpu_map: Set to 1 if the CPU number is punit numbering not
410 *		   Linux CPU number. If 0 CPU buffer is copied to user space
411 *		   supplied cpu_buffer of size cpu_buffer_size. Punit
412 *		   cpu mask is copied to "mask" field.
413 * @mask:	cpu mask for this PP level (punit CPU numbering)
414 * @cpu_buffer_size: size of cpu_buffer also used to return the copied CPU
415 *		buffer size.
416 * @cpu_buffer:	Buffer to copy CPU mask when punit_cpu_map is 0
417 *
418 * Structure used to get cpumask for a SST-PP level using
419 * IOCTL ISST_IF_GET_PERF_LEVEL_CPU_MASK. Also used to get CPU mask for
420 * IOCTL ISST_IF_GET_BASE_FREQ_CPU_MASK for SST-BF.
421 */
422struct isst_perf_level_cpu_mask {
423	__u8 socket_id;
424	__u8 power_domain_id;
425	__u8 level;
426	__u8 punit_cpu_map;
427	__u64 mask;
428	__u16 cpu_buffer_size;
429	__s8 cpu_buffer[1];
430};
431
432/**
433 * struct isst_base_freq_info - Structure to get SST-BF frequencies
434 * @socket_id:	Socket/package id
435 * @power_domain_id:	Power Domain id
436 * @level:	SST-PP level for which caller wants to get information
437 * @high_base_freq_mhz: High priority CPU base frequency
438 * @low_base_freq_mhz: Low priority CPU base frequency
439 * @tjunction_max_c: Max junction temperature
440 * @thermal_design_power_w: Thermal design power in watts
441 *
442 * Structure used to get SST-BF information using
443 * IOCTL ISST_IF_GET_BASE_FREQ_INFO.
444 */
445struct isst_base_freq_info {
446	__u8 socket_id;
447	__u8 power_domain_id;
448	__u16 level;
449	__u16 high_base_freq_mhz;
450	__u16 low_base_freq_mhz;
451	__u16 tjunction_max_c;
452	__u16 thermal_design_power_w;
453};
454
455/**
456 * struct isst_turbo_freq_info - Structure to get SST-TF frequencies
457 * @socket_id:	Socket/package id
458 * @power_domain_id:	Power Domain id
459 * @level:	SST-PP level for which caller wants to get information
460 * @max_clip_freqs: Maximum number of low priority core clipping frequencies
461 * @max_buckets: Maximum trl buckets
462 * @max_trl_levels: Maximum trl levels
463 * @lp_clip_freq_mhz: Clip frequencies per trl level
464 * @bucket_core_counts: Maximum number of cores for a bucket
465 * @trl_freq_mhz: Frequencies per trl level for each bucket
466 *
467 * Structure used to get SST-TF information using
468 * IOCTL ISST_IF_GET_TURBO_FREQ_INFO.
469 */
470struct isst_turbo_freq_info {
471	__u8 socket_id;
472	__u8 power_domain_id;
473	__u16 level;
474	__u16 max_clip_freqs;
475	__u16 max_buckets;
476	__u16 max_trl_levels;
477	__u16 lp_clip_freq_mhz[TRL_MAX_LEVELS];
478	__u16 bucket_core_counts[TRL_MAX_BUCKETS];
479	__u16 trl_freq_mhz[TRL_MAX_LEVELS][TRL_MAX_BUCKETS];
480};
481
482#define ISST_IF_MAGIC			0xFE
483#define ISST_IF_GET_PLATFORM_INFO	_IOR(ISST_IF_MAGIC, 0, struct isst_if_platform_info *)
484#define ISST_IF_GET_PHY_ID		_IOWR(ISST_IF_MAGIC, 1, struct isst_if_cpu_map *)
485#define ISST_IF_IO_CMD		_IOW(ISST_IF_MAGIC, 2, struct isst_if_io_regs *)
486#define ISST_IF_MBOX_COMMAND	_IOWR(ISST_IF_MAGIC, 3, struct isst_if_mbox_cmds *)
487#define ISST_IF_MSR_COMMAND	_IOWR(ISST_IF_MAGIC, 4, struct isst_if_msr_cmds *)
488
489#define ISST_IF_COUNT_TPMI_INSTANCES	_IOR(ISST_IF_MAGIC, 5, struct isst_tpmi_instance_count *)
490#define ISST_IF_CORE_POWER_STATE _IOWR(ISST_IF_MAGIC, 6, struct isst_core_power *)
491#define ISST_IF_CLOS_PARAM	_IOWR(ISST_IF_MAGIC, 7, struct isst_clos_param *)
492#define ISST_IF_CLOS_ASSOC	_IOWR(ISST_IF_MAGIC, 8, struct isst_if_clos_assoc_cmds *)
493
494#define ISST_IF_PERF_LEVELS	_IOWR(ISST_IF_MAGIC, 9, struct isst_perf_level_info *)
495#define ISST_IF_PERF_SET_LEVEL	_IOW(ISST_IF_MAGIC, 10, struct isst_perf_level_control *)
496#define ISST_IF_PERF_SET_FEATURE _IOW(ISST_IF_MAGIC, 11, struct isst_perf_feature_control *)
497#define ISST_IF_GET_PERF_LEVEL_INFO	_IOR(ISST_IF_MAGIC, 12, struct isst_perf_level_data_info *)
498#define ISST_IF_GET_PERF_LEVEL_CPU_MASK	_IOR(ISST_IF_MAGIC, 13, struct isst_perf_level_cpu_mask *)
499#define ISST_IF_GET_BASE_FREQ_INFO	_IOR(ISST_IF_MAGIC, 14, struct isst_base_freq_info *)
500#define ISST_IF_GET_BASE_FREQ_CPU_MASK	_IOR(ISST_IF_MAGIC, 15, struct isst_perf_level_cpu_mask *)
501#define ISST_IF_GET_TURBO_FREQ_INFO	_IOR(ISST_IF_MAGIC, 16, struct isst_turbo_freq_info *)
502#define ISST_IF_GET_PERF_LEVEL_FABRIC_INFO _IOR(ISST_IF_MAGIC, 17,\
503						struct isst_perf_level_fabric_info *)
504
505#endif
~/ Read-only file preview.