2019-06-30 10:14:08 -07:00
// SPDX-License-Identifier: GPL-2.0
/*
* Intel dynamic_speed_select - - Enumerate and control features
* Copyright ( c ) 2019 Intel Corporation .
*/
# include "isst.h"
2019-09-05 08:03:09 -04:00
static void printcpulist ( int str_len , char * str , int mask_size ,
cpu_set_t * cpu_mask )
{
int i , first , curr_index , index ;
if ( ! CPU_COUNT_S ( mask_size , cpu_mask ) ) {
snprintf ( str , str_len , " none " ) ;
return ;
}
curr_index = 0 ;
first = 1 ;
for ( i = 0 ; i < get_topo_max_cpus ( ) ; + + i ) {
if ( ! CPU_ISSET_S ( i , mask_size , cpu_mask ) )
continue ;
if ( ! first ) {
index = snprintf ( & str [ curr_index ] ,
str_len - curr_index , " , " ) ;
curr_index + = index ;
}
index = snprintf ( & str [ curr_index ] , str_len - curr_index , " %d " ,
i ) ;
curr_index + = index ;
first = 0 ;
}
}
2019-06-30 10:14:08 -07:00
static void printcpumask ( int str_len , char * str , int mask_size ,
cpu_set_t * cpu_mask )
{
int i , max_cpus = get_topo_max_cpus ( ) ;
unsigned int * mask ;
int size , index , curr_index ;
size = max_cpus / ( sizeof ( unsigned int ) * 8 ) ;
if ( max_cpus % ( sizeof ( unsigned int ) * 8 ) )
size + + ;
mask = calloc ( size , sizeof ( unsigned int ) ) ;
if ( ! mask )
return ;
for ( i = 0 ; i < max_cpus ; + + i ) {
int mask_index , bit_index ;
if ( ! CPU_ISSET_S ( i , mask_size , cpu_mask ) )
continue ;
mask_index = i / ( sizeof ( unsigned int ) * 8 ) ;
bit_index = i % ( sizeof ( unsigned int ) * 8 ) ;
mask [ mask_index ] | = BIT ( bit_index ) ;
}
curr_index = 0 ;
for ( i = size - 1 ; i > = 0 ; - - i ) {
index = snprintf ( & str [ curr_index ] , str_len - curr_index , " %08x " ,
mask [ i ] ) ;
curr_index + = index ;
if ( i ) {
strncat ( & str [ curr_index ] , " , " , str_len - curr_index ) ;
curr_index + + ;
}
}
free ( mask ) ;
}
static void format_and_print_txt ( FILE * outf , int level , char * header ,
char * value )
{
char * spaces = " " ;
static char delimiters [ 256 ] ;
int i , j = 0 ;
if ( ! level )
return ;
if ( level = = 1 ) {
strcpy ( delimiters , " " ) ;
} else {
for ( i = 0 ; i < level - 1 ; + + i )
j + = snprintf ( & delimiters [ j ] , sizeof ( delimiters ) - j ,
" %s " , spaces ) ;
}
if ( header & & value ) {
fprintf ( outf , " %s " , delimiters ) ;
fprintf ( outf , " %s:%s \n " , header , value ) ;
} else if ( header ) {
fprintf ( outf , " %s " , delimiters ) ;
fprintf ( outf , " %s \n " , header ) ;
}
}
static int last_level ;
static void format_and_print ( FILE * outf , int level , char * header , char * value )
{
char * spaces = " " ;
static char delimiters [ 256 ] ;
int i ;
if ( ! out_format_is_json ( ) ) {
format_and_print_txt ( outf , level , header , value ) ;
return ;
}
if ( level = = 0 ) {
if ( header )
fprintf ( outf , " { " ) ;
else
fprintf ( outf , " \n } \n " ) ;
} else {
int j = 0 ;
for ( i = 0 ; i < level ; + + i )
j + = snprintf ( & delimiters [ j ] , sizeof ( delimiters ) - j ,
" %s " , spaces ) ;
if ( last_level = = level )
fprintf ( outf , " , \n " ) ;
if ( value ) {
if ( last_level ! = level )
fprintf ( outf , " \n " ) ;
fprintf ( outf , " %s \" %s \" : " , delimiters , header ) ;
fprintf ( outf , " \" %s \" " , value ) ;
} else {
for ( i = last_level - 1 ; i > = level ; - - i ) {
int k = 0 ;
for ( j = i ; j > 0 ; - - j )
k + = snprintf ( & delimiters [ k ] ,
sizeof ( delimiters ) - k ,
" %s " , spaces ) ;
if ( i = = level & & header )
fprintf ( outf , " \n %s}, " , delimiters ) ;
else
fprintf ( outf , " \n %s} " , delimiters ) ;
}
if ( abs ( last_level - level ) < 3 )
fprintf ( outf , " \n " ) ;
if ( header )
fprintf ( outf , " %s \" %s \" : { " , delimiters ,
header ) ;
}
}
last_level = level ;
}
2019-09-05 08:03:03 -04:00
static void print_package_info ( int cpu , FILE * outf )
2019-06-30 10:14:08 -07:00
{
char header [ 256 ] ;
snprintf ( header , sizeof ( header ) , " package-%d " ,
get_physical_package_id ( cpu ) ) ;
format_and_print ( outf , 1 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " die-%d " , get_physical_die_id ( cpu ) ) ;
format_and_print ( outf , 2 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " cpu-%d " , cpu ) ;
format_and_print ( outf , 3 , header , NULL ) ;
}
static void _isst_pbf_display_information ( int cpu , FILE * outf , int level ,
struct isst_pbf_info * pbf_info ,
int disp_level )
{
char header [ 256 ] ;
char value [ 256 ] ;
2020-01-30 21:45:18 -08:00
snprintf ( header , sizeof ( header ) , " speed-select-base-freq-properties " ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , disp_level , header , NULL ) ;
2019-09-05 08:03:07 -04:00
snprintf ( header , sizeof ( header ) , " high-priority-base-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
pbf_info - > p1_high * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , disp_level + 1 , header , value ) ;
snprintf ( header , sizeof ( header ) , " high-priority-cpu-mask " ) ;
printcpumask ( sizeof ( value ) , value , pbf_info - > core_cpumask_size ,
pbf_info - > core_cpumask ) ;
format_and_print ( outf , disp_level + 1 , header , value ) ;
2019-09-05 08:03:09 -04:00
snprintf ( header , sizeof ( header ) , " high-priority-cpu-list " ) ;
printcpulist ( sizeof ( value ) , value ,
pbf_info - > core_cpumask_size ,
pbf_info - > core_cpumask ) ;
format_and_print ( outf , disp_level + 1 , header , value ) ;
2019-09-05 08:03:07 -04:00
snprintf ( header , sizeof ( header ) , " low-priority-base-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
pbf_info - > p1_low * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , disp_level + 1 , header , value ) ;
tools/power/x86/intel-speed-select: Implement 'perf-profile info' on CascadeLake-N
Add functionality for "perf-profile info" on CascadeLake-N.
Sample output:
intel-speed-select perf-profile info
Intel(R) Speed Select Technology
Executing on CPU model:85[0x55]
package-0
die-0
cpu-0
perf-profile-level-0
cpu-count:20
enable-cpu-mask:00000000,000fffff
enable-cpu-list:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
thermal-design-power-ratio:23
base-frequency(MHz):2300
speed-select-turbo-freq:unsupported
speed-select-base-freq:enabled
speed-select-base-freq
high-priority-base-frequency(MHz):2700000
high-priority-cpu-mask:00000000,0000e8c0
high-priority-cpu-list:6,7,11,13,14,15
low-priority-base-frequency(MHz):2100000
package-1
die-0
cpu-20
perf-profile-level-0
cpu-count:20
enable-cpu-mask:000000ff,fff00000
enable-cpu-list:20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39
thermal-design-power-ratio:23
base-frequency(MHz):2300
speed-select-turbo-freq:unsupported
speed-select-base-freq:enabled
speed-select-base-freq
high-priority-base-frequency(MHz):2700000
high-priority-cpu-mask:0000000e,8c000000
high-priority-cpu-list:26,27,31,33,34,35
low-priority-base-frequency(MHz):2100000
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-10-10 13:29:44 -07:00
if ( is_clx_n_platform ( ) )
return ;
2019-06-30 10:14:08 -07:00
snprintf ( header , sizeof ( header ) , " tjunction-temperature(C) " ) ;
snprintf ( value , sizeof ( value ) , " %d " , pbf_info - > t_prochot ) ;
format_and_print ( outf , disp_level + 1 , header , value ) ;
snprintf ( header , sizeof ( header ) , " thermal-design-power(W) " ) ;
snprintf ( value , sizeof ( value ) , " %d " , pbf_info - > tdp ) ;
format_and_print ( outf , disp_level + 1 , header , value ) ;
}
static void _isst_fact_display_information ( int cpu , FILE * outf , int level ,
int fact_bucket , int fact_avx ,
struct isst_fact_info * fact_info ,
int base_level )
{
struct isst_fact_bucket_info * bucket_info = fact_info - > bucket_info ;
char header [ 256 ] ;
char value [ 256 ] ;
int j ;
2020-01-30 21:45:18 -08:00
snprintf ( header , sizeof ( header ) , " speed-select-turbo-freq-properties " ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , base_level , header , NULL ) ;
for ( j = 0 ; j < ISST_FACT_MAX_BUCKETS ; + + j ) {
if ( fact_bucket ! = 0xff & & fact_bucket ! = j )
continue ;
if ( ! bucket_info [ j ] . high_priority_cores_count )
break ;
snprintf ( header , sizeof ( header ) , " bucket-%d " , j ) ;
format_and_print ( outf , base_level + 1 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " high-priority-cores-count " ) ;
snprintf ( value , sizeof ( value ) , " %d " ,
bucket_info [ j ] . high_priority_cores_count ) ;
format_and_print ( outf , base_level + 2 , header , value ) ;
if ( fact_avx & 0x01 ) {
snprintf ( header , sizeof ( header ) ,
2019-09-05 08:03:07 -04:00
" high-priority-max-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
bucket_info [ j ] . sse_trl * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 2 , header , value ) ;
}
if ( fact_avx & 0x02 ) {
snprintf ( header , sizeof ( header ) ,
2019-09-05 08:03:07 -04:00
" high-priority-max-avx2-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
bucket_info [ j ] . avx_trl * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 2 , header , value ) ;
}
if ( fact_avx & 0x04 ) {
snprintf ( header , sizeof ( header ) ,
2019-09-05 08:03:07 -04:00
" high-priority-max-avx512-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
bucket_info [ j ] . avx512_trl *
DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 2 , header , value ) ;
}
}
snprintf ( header , sizeof ( header ) ,
" speed-select-turbo-freq-clip-frequencies " ) ;
format_and_print ( outf , base_level + 1 , header , NULL ) ;
2019-09-05 08:03:07 -04:00
snprintf ( header , sizeof ( header ) , " low-priority-max-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
fact_info - > lp_clipping_ratio_license_sse *
DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 2 , header , value ) ;
snprintf ( header , sizeof ( header ) ,
2019-09-05 08:03:07 -04:00
" low-priority-max-avx2-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
fact_info - > lp_clipping_ratio_license_avx2 *
DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 2 , header , value ) ;
snprintf ( header , sizeof ( header ) ,
2019-09-05 08:03:07 -04:00
" low-priority-max-avx512-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
fact_info - > lp_clipping_ratio_license_avx512 *
DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 2 , header , value ) ;
}
2019-09-17 17:52:37 -07:00
void isst_ctdp_display_core_info ( int cpu , FILE * outf , char * prefix ,
unsigned int val )
{
char header [ 256 ] ;
char value [ 256 ] ;
snprintf ( header , sizeof ( header ) , " package-%d " ,
get_physical_package_id ( cpu ) ) ;
format_and_print ( outf , 1 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " die-%d " , get_physical_die_id ( cpu ) ) ;
format_and_print ( outf , 2 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " cpu-%d " , cpu ) ;
format_and_print ( outf , 3 , header , NULL ) ;
snprintf ( value , sizeof ( value ) , " %u " , val ) ;
format_and_print ( outf , 4 , prefix , value ) ;
format_and_print ( outf , 1 , NULL , NULL ) ;
}
2019-06-30 10:14:08 -07:00
void isst_ctdp_display_information ( int cpu , FILE * outf , int tdp_level ,
struct isst_pkg_ctdp * pkg_dev )
{
char header [ 256 ] ;
char value [ 256 ] ;
int i , base_level = 1 ;
2019-11-15 12:35:22 -08:00
if ( pkg_dev - > processed )
print_package_info ( cpu , outf ) ;
2019-06-30 10:14:08 -07:00
for ( i = 0 ; i < = pkg_dev - > levels ; + + i ) {
struct isst_pkg_ctdp_level_info * ctdp_level ;
int j ;
ctdp_level = & pkg_dev - > ctdp_level [ i ] ;
if ( ! ctdp_level - > processed )
continue ;
snprintf ( header , sizeof ( header ) , " perf-profile-level-%d " ,
ctdp_level - > level ) ;
format_and_print ( outf , base_level + 3 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " cpu-count " ) ;
j = get_cpu_count ( get_physical_die_id ( cpu ) ,
get_physical_die_id ( cpu ) ) ;
snprintf ( value , sizeof ( value ) , " %d " , j ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
2019-11-04 03:02:44 -08:00
if ( ctdp_level - > core_cpumask_size ) {
snprintf ( header , sizeof ( header ) , " enable-cpu-mask " ) ;
printcpumask ( sizeof ( value ) , value ,
ctdp_level - > core_cpumask_size ,
ctdp_level - > core_cpumask ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
2019-06-30 10:14:08 -07:00
2019-11-04 03:02:44 -08:00
snprintf ( header , sizeof ( header ) , " enable-cpu-list " ) ;
printcpulist ( sizeof ( value ) , value ,
ctdp_level - > core_cpumask_size ,
ctdp_level - > core_cpumask ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
}
2019-09-05 08:03:09 -04:00
2019-06-30 10:14:08 -07:00
snprintf ( header , sizeof ( header ) , " thermal-design-power-ratio " ) ;
snprintf ( value , sizeof ( value ) , " %d " , ctdp_level - > tdp_ratio ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
2019-09-05 08:03:07 -04:00
snprintf ( header , sizeof ( header ) , " base-frequency(MHz) " ) ;
2019-11-04 03:02:37 -08:00
if ( ! ctdp_level - > sse_p1 )
ctdp_level - > sse_p1 = ctdp_level - > tdp_ratio ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
2019-11-04 03:02:37 -08:00
ctdp_level - > sse_p1 * DISP_FREQ_MULTIPLIER ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , base_level + 4 , header , value ) ;
2019-11-04 03:02:37 -08:00
if ( ctdp_level - > avx2_p1 ) {
snprintf ( header , sizeof ( header ) , " base-frequency-avx2(MHz) " ) ;
snprintf ( value , sizeof ( value ) , " %d " ,
ctdp_level - > avx2_p1 * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
}
if ( ctdp_level - > avx512_p1 ) {
snprintf ( header , sizeof ( header ) , " base-frequency-avx512(MHz) " ) ;
snprintf ( value , sizeof ( value ) , " %d " ,
ctdp_level - > avx512_p1 * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
}
if ( ctdp_level - > uncore_p1 ) {
snprintf ( header , sizeof ( header ) , " uncore-frequency-min(MHz) " ) ;
snprintf ( value , sizeof ( value ) , " %d " ,
ctdp_level - > uncore_p1 * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
}
if ( ctdp_level - > uncore_p0 ) {
snprintf ( header , sizeof ( header ) , " uncore-frequency-max(MHz) " ) ;
snprintf ( value , sizeof ( value ) , " %d " ,
ctdp_level - > uncore_p0 * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
}
if ( ctdp_level - > mem_freq ) {
snprintf ( header , sizeof ( header ) , " mem-frequency(MHz) " ) ;
snprintf ( value , sizeof ( value ) , " %d " ,
ctdp_level - > mem_freq * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
}
2019-06-30 10:14:08 -07:00
snprintf ( header , sizeof ( header ) ,
2019-09-05 08:03:06 -04:00
" speed-select-turbo-freq " ) ;
if ( ctdp_level - > fact_support ) {
if ( ctdp_level - > fact_enabled )
snprintf ( value , sizeof ( value ) , " enabled " ) ;
else
snprintf ( value , sizeof ( value ) , " disabled " ) ;
} else
snprintf ( value , sizeof ( value ) , " unsupported " ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , base_level + 4 , header , value ) ;
snprintf ( header , sizeof ( header ) ,
2019-09-05 08:03:06 -04:00
" speed-select-base-freq " ) ;
if ( ctdp_level - > pbf_support ) {
if ( ctdp_level - > pbf_enabled )
snprintf ( value , sizeof ( value ) , " enabled " ) ;
2020-01-14 11:22:14 -08:00
else
snprintf ( value , sizeof ( value ) , " disabled " ) ;
} else
snprintf ( value , sizeof ( value ) , " unsupported " ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
snprintf ( header , sizeof ( header ) ,
" speed-select-core-power " ) ;
if ( ctdp_level - > sst_cp_support ) {
if ( ctdp_level - > sst_cp_enabled )
snprintf ( value , sizeof ( value ) , " enabled " ) ;
2019-09-05 08:03:06 -04:00
else
snprintf ( value , sizeof ( value ) , " disabled " ) ;
} else
snprintf ( value , sizeof ( value ) , " unsupported " ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , base_level + 4 , header , value ) ;
tools/power/x86/intel-speed-select: Implement 'perf-profile info' on CascadeLake-N
Add functionality for "perf-profile info" on CascadeLake-N.
Sample output:
intel-speed-select perf-profile info
Intel(R) Speed Select Technology
Executing on CPU model:85[0x55]
package-0
die-0
cpu-0
perf-profile-level-0
cpu-count:20
enable-cpu-mask:00000000,000fffff
enable-cpu-list:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
thermal-design-power-ratio:23
base-frequency(MHz):2300
speed-select-turbo-freq:unsupported
speed-select-base-freq:enabled
speed-select-base-freq
high-priority-base-frequency(MHz):2700000
high-priority-cpu-mask:00000000,0000e8c0
high-priority-cpu-list:6,7,11,13,14,15
low-priority-base-frequency(MHz):2100000
package-1
die-0
cpu-20
perf-profile-level-0
cpu-count:20
enable-cpu-mask:000000ff,fff00000
enable-cpu-list:20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39
thermal-design-power-ratio:23
base-frequency(MHz):2300
speed-select-turbo-freq:unsupported
speed-select-base-freq:enabled
speed-select-base-freq
high-priority-base-frequency(MHz):2700000
high-priority-cpu-mask:0000000e,8c000000
high-priority-cpu-list:26,27,31,33,34,35
low-priority-base-frequency(MHz):2100000
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-10-10 13:29:44 -07:00
if ( is_clx_n_platform ( ) ) {
if ( ctdp_level - > pbf_support )
_isst_pbf_display_information ( cpu , outf ,
tdp_level ,
& ctdp_level - > pbf_info ,
base_level + 4 ) ;
continue ;
}
2019-11-04 03:02:44 -08:00
if ( ctdp_level - > pkg_tdp ) {
snprintf ( header , sizeof ( header ) , " thermal-design-power(W) " ) ;
snprintf ( value , sizeof ( value ) , " %d " , ctdp_level - > pkg_tdp ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
}
2019-06-30 10:14:08 -07:00
2019-11-04 03:02:44 -08:00
if ( ctdp_level - > t_proc_hot ) {
snprintf ( header , sizeof ( header ) , " tjunction-max(C) " ) ;
snprintf ( value , sizeof ( value ) , " %d " , ctdp_level - > t_proc_hot ) ;
format_and_print ( outf , base_level + 4 , header , value ) ;
}
2019-06-30 10:14:08 -07:00
snprintf ( header , sizeof ( header ) , " turbo-ratio-limits-sse " ) ;
format_and_print ( outf , base_level + 4 , header , NULL ) ;
for ( j = 0 ; j < 8 ; + + j ) {
snprintf ( header , sizeof ( header ) , " bucket-%d " , j ) ;
format_and_print ( outf , base_level + 5 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " core-count " ) ;
2019-09-08 07:42:25 -07:00
snprintf ( value , sizeof ( value ) , " %llu " , ( ctdp_level - > buckets_info > > ( j * 8 ) ) & 0xff ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , base_level + 6 , header , value ) ;
2019-09-05 08:03:08 -04:00
snprintf ( header , sizeof ( header ) ,
" max-turbo-frequency(MHz) " ) ;
2019-06-30 10:14:08 -07:00
snprintf ( value , sizeof ( value ) , " %d " ,
2019-09-05 08:03:08 -04:00
ctdp_level - > trl_sse_active_cores [ j ] *
DISP_FREQ_MULTIPLIER ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , base_level + 6 , header , value ) ;
}
2019-11-04 03:02:44 -08:00
if ( ctdp_level - > trl_avx_active_cores [ 0 ] ) {
snprintf ( header , sizeof ( header ) , " turbo-ratio-limits-avx2 " ) ;
format_and_print ( outf , base_level + 4 , header , NULL ) ;
for ( j = 0 ; j < 8 ; + + j ) {
snprintf ( header , sizeof ( header ) , " bucket-%d " , j ) ;
format_and_print ( outf , base_level + 5 , header , NULL ) ;
2019-06-30 10:14:08 -07:00
2019-11-04 03:02:44 -08:00
snprintf ( header , sizeof ( header ) , " core-count " ) ;
snprintf ( value , sizeof ( value ) , " %llu " , ( ctdp_level - > buckets_info > > ( j * 8 ) ) & 0xff ) ;
format_and_print ( outf , base_level + 6 , header , value ) ;
snprintf ( header , sizeof ( header ) , " max-turbo-frequency(MHz) " ) ;
snprintf ( value , sizeof ( value ) , " %d " , ctdp_level - > trl_avx_active_cores [ j ] * DISP_FREQ_MULTIPLIER ) ;
format_and_print ( outf , base_level + 6 , header , value ) ;
}
2019-06-30 10:14:08 -07:00
}
2019-11-04 03:02:44 -08:00
if ( ctdp_level - > trl_avx_512_active_cores [ 0 ] ) {
snprintf ( header , sizeof ( header ) , " turbo-ratio-limits-avx512 " ) ;
format_and_print ( outf , base_level + 4 , header , NULL ) ;
for ( j = 0 ; j < 8 ; + + j ) {
snprintf ( header , sizeof ( header ) , " bucket-%d " , j ) ;
format_and_print ( outf , base_level + 5 , header , NULL ) ;
2019-06-30 10:14:08 -07:00
2019-11-04 03:02:44 -08:00
snprintf ( header , sizeof ( header ) , " core-count " ) ;
snprintf ( value , sizeof ( value ) , " %llu " , ( ctdp_level - > buckets_info > > ( j * 8 ) ) & 0xff ) ;
format_and_print ( outf , base_level + 6 , header , value ) ;
2019-06-30 10:14:08 -07:00
2019-11-04 03:02:44 -08:00
snprintf ( header , sizeof ( header ) , " max-turbo-frequency(MHz) " ) ;
snprintf ( value , sizeof ( value ) , " %d " , ctdp_level - > trl_avx_512_active_cores [ j ] * DISP_FREQ_MULTIPLIER ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , base_level + 6 , header , value ) ;
2019-11-04 03:02:44 -08:00
}
2019-06-30 10:14:08 -07:00
}
2019-11-04 03:02:44 -08:00
2019-06-30 10:14:08 -07:00
if ( ctdp_level - > pbf_support )
_isst_pbf_display_information ( cpu , outf , i ,
& ctdp_level - > pbf_info ,
base_level + 4 ) ;
if ( ctdp_level - > fact_support )
_isst_fact_display_information ( cpu , outf , i , 0xff , 0xff ,
& ctdp_level - > fact_info ,
base_level + 4 ) ;
}
format_and_print ( outf , 1 , NULL , NULL ) ;
}
void isst_ctdp_display_information_start ( FILE * outf )
{
last_level = 0 ;
format_and_print ( outf , 0 , " start " , NULL ) ;
}
void isst_ctdp_display_information_end ( FILE * outf )
{
format_and_print ( outf , 0 , NULL , NULL ) ;
}
void isst_pbf_display_information ( int cpu , FILE * outf , int level ,
struct isst_pbf_info * pbf_info )
{
2019-09-05 08:03:03 -04:00
print_package_info ( cpu , outf ) ;
2019-06-30 10:14:08 -07:00
_isst_pbf_display_information ( cpu , outf , level , pbf_info , 4 ) ;
format_and_print ( outf , 1 , NULL , NULL ) ;
}
void isst_fact_display_information ( int cpu , FILE * outf , int level ,
int fact_bucket , int fact_avx ,
struct isst_fact_info * fact_info )
{
2019-09-05 08:03:03 -04:00
print_package_info ( cpu , outf ) ;
2019-06-30 10:14:08 -07:00
_isst_fact_display_information ( cpu , outf , level , fact_bucket , fact_avx ,
fact_info , 4 ) ;
format_and_print ( outf , 1 , NULL , NULL ) ;
}
void isst_clos_display_information ( int cpu , FILE * outf , int clos ,
struct isst_clos_config * clos_config )
{
char header [ 256 ] ;
char value [ 256 ] ;
snprintf ( header , sizeof ( header ) , " package-%d " ,
get_physical_package_id ( cpu ) ) ;
format_and_print ( outf , 1 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " die-%d " , get_physical_die_id ( cpu ) ) ;
format_and_print ( outf , 2 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " cpu-%d " , cpu ) ;
format_and_print ( outf , 3 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " core-power " ) ;
format_and_print ( outf , 4 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " clos " ) ;
snprintf ( value , sizeof ( value ) , " %d " , clos ) ;
format_and_print ( outf , 5 , header , value ) ;
snprintf ( header , sizeof ( header ) , " epp " ) ;
snprintf ( value , sizeof ( value ) , " %d " , clos_config - > epp ) ;
format_and_print ( outf , 5 , header , value ) ;
snprintf ( header , sizeof ( header ) , " clos-proportional-priority " ) ;
snprintf ( value , sizeof ( value ) , " %d " , clos_config - > clos_prop_prio ) ;
format_and_print ( outf , 5 , header , value ) ;
snprintf ( header , sizeof ( header ) , " clos-min " ) ;
2019-11-04 03:02:42 -08:00
snprintf ( value , sizeof ( value ) , " %d MHz " , clos_config - > clos_min * DISP_FREQ_MULTIPLIER ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , 5 , header , value ) ;
snprintf ( header , sizeof ( header ) , " clos-max " ) ;
2019-11-04 03:02:42 -08:00
snprintf ( value , sizeof ( value ) , " %d MHz " , clos_config - > clos_max * DISP_FREQ_MULTIPLIER ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , 5 , header , value ) ;
snprintf ( header , sizeof ( header ) , " clos-desired " ) ;
2019-11-04 03:02:42 -08:00
snprintf ( value , sizeof ( value ) , " %d MHz " , clos_config - > clos_desired * DISP_FREQ_MULTIPLIER ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , 5 , header , value ) ;
format_and_print ( outf , 1 , NULL , NULL ) ;
}
2019-09-14 12:45:47 -07:00
void isst_clos_display_clos_information ( int cpu , FILE * outf ,
int clos_enable , int type )
{
char header [ 256 ] ;
char value [ 256 ] ;
snprintf ( header , sizeof ( header ) , " package-%d " ,
get_physical_package_id ( cpu ) ) ;
format_and_print ( outf , 1 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " die-%d " , get_physical_die_id ( cpu ) ) ;
format_and_print ( outf , 2 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " cpu-%d " , cpu ) ;
format_and_print ( outf , 3 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " core-power " ) ;
format_and_print ( outf , 4 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " enable-status " ) ;
snprintf ( value , sizeof ( value ) , " %d " , clos_enable ) ;
format_and_print ( outf , 5 , header , value ) ;
snprintf ( header , sizeof ( header ) , " priority-type " ) ;
snprintf ( value , sizeof ( value ) , " %d " , type ) ;
format_and_print ( outf , 5 , header , value ) ;
format_and_print ( outf , 1 , NULL , NULL ) ;
}
2019-09-14 12:45:45 -07:00
void isst_clos_display_assoc_information ( int cpu , FILE * outf , int clos )
{
char header [ 256 ] ;
char value [ 256 ] ;
snprintf ( header , sizeof ( header ) , " package-%d " ,
get_physical_package_id ( cpu ) ) ;
format_and_print ( outf , 1 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " die-%d " , get_physical_die_id ( cpu ) ) ;
format_and_print ( outf , 2 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " cpu-%d " , cpu ) ;
format_and_print ( outf , 3 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " get-assoc " ) ;
format_and_print ( outf , 4 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " clos " ) ;
snprintf ( value , sizeof ( value ) , " %d " , clos ) ;
format_and_print ( outf , 5 , header , value ) ;
format_and_print ( outf , 1 , NULL , NULL ) ;
}
2019-06-30 10:14:08 -07:00
void isst_display_result ( int cpu , FILE * outf , char * feature , char * cmd ,
int result )
{
char header [ 256 ] ;
char value [ 256 ] ;
2020-01-14 11:22:15 -08:00
if ( cpu > = 0 ) {
snprintf ( header , sizeof ( header ) , " package-%d " ,
get_physical_package_id ( cpu ) ) ;
format_and_print ( outf , 1 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " die-%d " , get_physical_die_id ( cpu ) ) ;
format_and_print ( outf , 2 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " cpu-%d " , cpu ) ;
format_and_print ( outf , 3 , header , NULL ) ;
}
2019-06-30 10:14:08 -07:00
snprintf ( header , sizeof ( header ) , " %s " , feature ) ;
format_and_print ( outf , 4 , header , NULL ) ;
snprintf ( header , sizeof ( header ) , " %s " , cmd ) ;
2019-09-05 08:03:10 -04:00
if ( ! result )
snprintf ( value , sizeof ( value ) , " success " ) ;
else
snprintf ( value , sizeof ( value ) , " failed(error %d) " , result ) ;
2019-06-30 10:14:08 -07:00
format_and_print ( outf , 5 , header , value ) ;
format_and_print ( outf , 1 , NULL , NULL ) ;
}