Skip to content

Commit 44c728e

Browse files
author
CKI KWF Bot
committed
Merge: platform/x86: ISST: and tools/power/x86/intel-speed-select: updates
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1727 Description: Updates for platform/x86: ISST: and tools/power/x86/intel-speed-select JIRA: https://issues.redhat.com/browse/RHEL-110834 Build Info: 69383017 Tested: Successful test results on Intel (intel-eaglestream-emr-02) system. Signed-off-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 4fa62b4 + a708a28 commit 44c728e

File tree

7 files changed

+175
-25
lines changed

7 files changed

+175
-25
lines changed

drivers/platform/x86/intel/speed_select_if/isst_if_common.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -198,25 +198,6 @@ void isst_resume_common(void)
198198
}
199199
EXPORT_SYMBOL_GPL(isst_resume_common);
200200

201-
static void isst_restore_msr_local(int cpu)
202-
{
203-
struct isst_cmd *sst_cmd;
204-
int i;
205-
206-
mutex_lock(&isst_hash_lock);
207-
for (i = 0; i < ARRAY_SIZE(punit_msr_white_list); ++i) {
208-
if (!punit_msr_white_list[i])
209-
break;
210-
211-
hash_for_each_possible(isst_hash, sst_cmd, hnode,
212-
punit_msr_white_list[i]) {
213-
if (!sst_cmd->mbox_cmd_type && sst_cmd->cpu == cpu)
214-
wrmsrl_safe(sst_cmd->cmd, sst_cmd->data);
215-
}
216-
}
217-
mutex_unlock(&isst_hash_lock);
218-
}
219-
220201
/**
221202
* isst_if_mbox_cmd_invalid() - Check invalid mailbox commands
222203
* @cmd: Pointer to the command structure to verify.
@@ -434,8 +415,6 @@ static int isst_if_cpu_online(unsigned int cpu)
434415
set_punit_id:
435416
isst_cpu_info[cpu].punit_cpu_id = data;
436417

437-
isst_restore_msr_local(cpu);
438-
439418
return 0;
440419
}
441420

drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
/* Supported SST hardware version by this driver */
3636
#define ISST_MAJOR_VERSION 0
37-
#define ISST_MINOR_VERSION 1
37+
#define ISST_MINOR_VERSION 2
3838

3939
/*
4040
* Used to indicate if value read from MMIO needs to get multiplied
@@ -380,7 +380,7 @@ static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domai
380380
return -ENODEV;
381381
}
382382

383-
if (TPMI_MINOR_VERSION(pd_info->sst_header.interface_version) != ISST_MINOR_VERSION)
383+
if (TPMI_MINOR_VERSION(pd_info->sst_header.interface_version) > ISST_MINOR_VERSION)
384384
dev_info(dev, "SST: Ignore: Unsupported minor version:%lx\n",
385385
TPMI_MINOR_VERSION(pd_info->sst_header.interface_version));
386386

@@ -1016,6 +1016,7 @@ static int isst_if_set_perf_feature(void __user *argp)
10161016

10171017
#define SST_PP_INFO_10_OFFSET 80
10181018
#define SST_PP_INFO_11_OFFSET 88
1019+
#define SST_PP_INFO_12_OFFSET 96
10191020

10201021
#define SST_PP_P1_SSE_START 0
10211022
#define SST_PP_P1_SSE_WIDTH 8
@@ -1068,6 +1069,15 @@ static int isst_if_set_perf_feature(void __user *argp)
10681069
#define SST_PP_CORE_RATIO_PM_FABRIC_START 48
10691070
#define SST_PP_CORE_RATIO_PM_FABRIC_WIDTH 8
10701071

1072+
#define SST_PP_CORE_RATIO_P0_FABRIC_1_START 0
1073+
#define SST_PP_CORE_RATIO_P0_FABRIC_1_WIDTH 8
1074+
1075+
#define SST_PP_CORE_RATIO_P1_FABRIC_1_START 8
1076+
#define SST_PP_CORE_RATIO_P1_FABRIC_1_WIDTH 8
1077+
1078+
#define SST_PP_CORE_RATIO_PM_FABRIC_1_START 16
1079+
#define SST_PP_CORE_RATIO_PM_FABRIC_1_WIDTH 8
1080+
10711081
static int isst_if_get_perf_level_info(void __user *argp)
10721082
{
10731083
struct isst_perf_level_data_info perf_level;
@@ -1167,6 +1177,59 @@ static int isst_if_get_perf_level_info(void __user *argp)
11671177
return 0;
11681178
}
11691179

1180+
static int isst_if_get_perf_level_fabric_info(void __user *argp)
1181+
{
1182+
struct isst_perf_level_fabric_info perf_level_fabric;
1183+
struct tpmi_per_power_domain_info *power_domain_info;
1184+
int start = SST_PP_CORE_RATIO_P0_FABRIC_START;
1185+
int width = SST_PP_CORE_RATIO_P0_FABRIC_WIDTH;
1186+
int offset = SST_PP_INFO_11_OFFSET;
1187+
int i;
1188+
1189+
if (copy_from_user(&perf_level_fabric, argp, sizeof(perf_level_fabric)))
1190+
return -EFAULT;
1191+
1192+
power_domain_info = get_instance(perf_level_fabric.socket_id,
1193+
perf_level_fabric.power_domain_id);
1194+
if (!power_domain_info)
1195+
return -EINVAL;
1196+
1197+
if (perf_level_fabric.level > power_domain_info->max_level)
1198+
return -EINVAL;
1199+
1200+
if (power_domain_info->pp_header.feature_rev < 2)
1201+
return -EINVAL;
1202+
1203+
if (!(power_domain_info->pp_header.level_en_mask & BIT(perf_level_fabric.level)))
1204+
return -EINVAL;
1205+
1206+
/* For revision 2, maximum number of fabrics is 2 */
1207+
perf_level_fabric.max_fabrics = 2;
1208+
1209+
for (i = 0; i < perf_level_fabric.max_fabrics; i++) {
1210+
_read_pp_level_info("p0_fabric_freq_mhz", perf_level_fabric.p0_fabric_freq_mhz[i],
1211+
perf_level_fabric.level, offset, start, width,
1212+
SST_MUL_FACTOR_FREQ)
1213+
start += width;
1214+
1215+
_read_pp_level_info("p1_fabric_freq_mhz", perf_level_fabric.p1_fabric_freq_mhz[i],
1216+
perf_level_fabric.level, offset, start, width,
1217+
SST_MUL_FACTOR_FREQ)
1218+
start += width;
1219+
1220+
_read_pp_level_info("pm_fabric_freq_mhz", perf_level_fabric.pm_fabric_freq_mhz[i],
1221+
perf_level_fabric.level, offset, start, width,
1222+
SST_MUL_FACTOR_FREQ)
1223+
offset = SST_PP_INFO_12_OFFSET;
1224+
start = SST_PP_CORE_RATIO_P0_FABRIC_1_START;
1225+
}
1226+
1227+
if (copy_to_user(argp, &perf_level_fabric, sizeof(perf_level_fabric)))
1228+
return -EFAULT;
1229+
1230+
return 0;
1231+
}
1232+
11701233
#define SST_PP_FUSED_CORE_COUNT_START 0
11711234
#define SST_PP_FUSED_CORE_COUNT_WIDTH 8
11721235

@@ -1328,9 +1391,14 @@ static int isst_if_get_tpmi_instance_count(void __user *argp)
13281391
#define SST_TF_INFO_0_OFFSET 0
13291392
#define SST_TF_INFO_1_OFFSET 8
13301393
#define SST_TF_INFO_2_OFFSET 16
1394+
#define SST_TF_INFO_8_OFFSET 64
1395+
#define SST_TF_INFO_8_BUCKETS 3
13311396

13321397
#define SST_TF_MAX_LP_CLIP_RATIOS TRL_MAX_LEVELS
13331398

1399+
#define SST_TF_FEATURE_REV_START 4
1400+
#define SST_TF_FEATURE_REV_WIDTH 8
1401+
13341402
#define SST_TF_LP_CLIP_RATIO_0_START 16
13351403
#define SST_TF_LP_CLIP_RATIO_0_WIDTH 8
13361404

@@ -1340,10 +1408,14 @@ static int isst_if_get_tpmi_instance_count(void __user *argp)
13401408
#define SST_TF_NUM_CORE_0_START 0
13411409
#define SST_TF_NUM_CORE_0_WIDTH 8
13421410

1411+
#define SST_TF_NUM_MOD_0_START 0
1412+
#define SST_TF_NUM_MOD_0_WIDTH 16
1413+
13431414
static int isst_if_get_turbo_freq_info(void __user *argp)
13441415
{
13451416
static struct isst_turbo_freq_info turbo_freq;
13461417
struct tpmi_per_power_domain_info *power_domain_info;
1418+
u8 feature_rev;
13471419
int i, j;
13481420

13491421
if (copy_from_user(&turbo_freq, argp, sizeof(turbo_freq)))
@@ -1360,6 +1432,10 @@ static int isst_if_get_turbo_freq_info(void __user *argp)
13601432
turbo_freq.max_trl_levels = TRL_MAX_LEVELS;
13611433
turbo_freq.max_clip_freqs = SST_TF_MAX_LP_CLIP_RATIOS;
13621434

1435+
_read_tf_level_info("feature_rev", feature_rev, turbo_freq.level,
1436+
SST_TF_INFO_0_OFFSET, SST_TF_FEATURE_REV_START,
1437+
SST_TF_FEATURE_REV_WIDTH, SST_MUL_FACTOR_NONE);
1438+
13631439
for (i = 0; i < turbo_freq.max_clip_freqs; ++i)
13641440
_read_tf_level_info("lp_clip*", turbo_freq.lp_clip_freq_mhz[i],
13651441
turbo_freq.level, SST_TF_INFO_0_OFFSET,
@@ -1376,12 +1452,32 @@ static int isst_if_get_turbo_freq_info(void __user *argp)
13761452
SST_MUL_FACTOR_FREQ)
13771453
}
13781454

1455+
if (feature_rev >= 2) {
1456+
bool has_tf_info_8 = false;
1457+
1458+
for (i = 0; i < SST_TF_INFO_8_BUCKETS; ++i) {
1459+
_read_tf_level_info("bucket_*_mod_count", turbo_freq.bucket_core_counts[i],
1460+
turbo_freq.level, SST_TF_INFO_8_OFFSET,
1461+
SST_TF_NUM_MOD_0_WIDTH * i, SST_TF_NUM_MOD_0_WIDTH,
1462+
SST_MUL_FACTOR_NONE)
1463+
1464+
if (turbo_freq.bucket_core_counts[i])
1465+
has_tf_info_8 = true;
1466+
}
1467+
1468+
if (has_tf_info_8)
1469+
goto done_core_count;
1470+
}
1471+
13791472
for (i = 0; i < TRL_MAX_BUCKETS; ++i)
13801473
_read_tf_level_info("bucket_*_core_count", turbo_freq.bucket_core_counts[i],
13811474
turbo_freq.level, SST_TF_INFO_1_OFFSET,
13821475
SST_TF_NUM_CORE_0_WIDTH * i, SST_TF_NUM_CORE_0_WIDTH,
13831476
SST_MUL_FACTOR_NONE)
13841477

1478+
1479+
done_core_count:
1480+
13851481
if (copy_to_user(argp, &turbo_freq, sizeof(turbo_freq)))
13861482
return -EFAULT;
13871483

@@ -1420,6 +1516,9 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd,
14201516
case ISST_IF_GET_PERF_LEVEL_INFO:
14211517
ret = isst_if_get_perf_level_info(argp);
14221518
break;
1519+
case ISST_IF_GET_PERF_LEVEL_FABRIC_INFO:
1520+
ret = isst_if_get_perf_level_fabric_info(argp);
1521+
break;
14231522
case ISST_IF_GET_PERF_LEVEL_CPU_MASK:
14241523
ret = isst_if_get_perf_level_mask(argp);
14251524
break;

include/uapi/linux/isst_if.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,30 @@ struct isst_perf_level_data_info {
375375
__u16 trl_freq_mhz[TRL_MAX_LEVELS][TRL_MAX_BUCKETS];
376376
};
377377

378+
#define MAX_FABRIC_COUNT 8
379+
380+
/**
381+
* struct isst_perf_level_fabric_info - Structure to get SST-PP fabric details
382+
* @socket_id: Socket/package id
383+
* @power_domain_id: Power Domain id
384+
* @level: SST-PP level for which caller wants to get information
385+
* @max_fabrics: Count of fabrics in resonse
386+
* @p0_fabric_freq_mhz: Fabric (Uncore) maximum frequency
387+
* @p1_fabric_freq_mhz: Fabric (Uncore) TDP frequency
388+
* @pm_fabric_freq_mhz: Fabric (Uncore) minimum frequency
389+
*
390+
* Structure used to get information on frequencies for fabrics.
391+
*/
392+
struct isst_perf_level_fabric_info {
393+
__u8 socket_id;
394+
__u8 power_domain_id;
395+
__u16 level;
396+
__u16 max_fabrics;
397+
__u16 p0_fabric_freq_mhz[MAX_FABRIC_COUNT];
398+
__u16 p1_fabric_freq_mhz[MAX_FABRIC_COUNT];
399+
__u16 pm_fabric_freq_mhz[MAX_FABRIC_COUNT];
400+
};
401+
378402
/**
379403
* struct isst_perf_level_cpu_mask - Structure to get SST-PP level CPU mask
380404
* @socket_id: Socket/package id
@@ -471,5 +495,7 @@ struct isst_turbo_freq_info {
471495
#define ISST_IF_GET_BASE_FREQ_INFO _IOR(ISST_IF_MAGIC, 14, struct isst_base_freq_info *)
472496
#define ISST_IF_GET_BASE_FREQ_CPU_MASK _IOR(ISST_IF_MAGIC, 15, struct isst_perf_level_cpu_mask *)
473497
#define ISST_IF_GET_TURBO_FREQ_INFO _IOR(ISST_IF_MAGIC, 16, struct isst_turbo_freq_info *)
498+
#define ISST_IF_GET_PERF_LEVEL_FABRIC_INFO _IOR(ISST_IF_MAGIC, 17,\
499+
struct isst_perf_level_fabric_info *)
474500

475501
#endif

tools/power/x86/intel-speed-select/isst-config.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct process_cmd_struct {
1616
int arg;
1717
};
1818

19-
static const char *version_str = "v1.22";
19+
static const char *version_str = "v1.23";
2020

2121
static const int supported_api_ver = 3;
2222
static struct isst_if_platform_info isst_platform_info;
@@ -26,6 +26,7 @@ static FILE *outf;
2626

2727
static int cpu_model;
2828
static int cpu_stepping;
29+
static int extended_family;
2930

3031
#define MAX_CPUS_IN_ONE_REQ 512
3132
static short max_target_cpus;
@@ -143,13 +144,22 @@ int is_icx_platform(void)
143144
return 0;
144145
}
145146

147+
static int is_dmr_plus_platform(void)
148+
{
149+
if (extended_family == 0x04)
150+
return 1;
151+
152+
return 0;
153+
}
154+
146155
static int update_cpu_model(void)
147156
{
148157
unsigned int ebx, ecx, edx;
149158
unsigned int fms, family;
150159

151160
__cpuid(1, fms, ebx, ecx, edx);
152161
family = (fms >> 8) & 0xf;
162+
extended_family = (fms >> 20) & 0x0f;
153163
cpu_model = (fms >> 4) & 0xf;
154164
if (family == 6 || family == 0xf)
155165
cpu_model += ((fms >> 16) & 0xf) << 4;
@@ -1517,7 +1527,8 @@ static void set_tdp_level_for_cpu(struct isst_id *id, void *arg1, void *arg2, vo
15171527
usleep(2000);
15181528

15191529
/* Adjusting uncore freq */
1520-
isst_adjust_uncore_freq(id, tdp_level, &ctdp_level);
1530+
if (!is_dmr_plus_platform())
1531+
isst_adjust_uncore_freq(id, tdp_level, &ctdp_level);
15211532

15221533
fprintf(stderr, "Option is set to online/offline\n");
15231534
ctdp_level.core_cpumask_size =

tools/power/x86/intel-speed-select/isst-core-tpmi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ static int tpmi_get_ctdp_control(struct isst_id *id, int config_index,
227227
static int tpmi_get_tdp_info(struct isst_id *id, int config_index,
228228
struct isst_pkg_ctdp_level_info *ctdp_level)
229229
{
230+
struct isst_perf_level_fabric_info fabric_info;
230231
struct isst_perf_level_data_info info;
231232
int ret;
232233

@@ -253,6 +254,17 @@ static int tpmi_get_tdp_info(struct isst_id *id, int config_index,
253254
ctdp_level->uncore_p1 = info.p1_fabric_freq_mhz;
254255
ctdp_level->uncore_pm = info.pm_fabric_freq_mhz;
255256

257+
fabric_info.socket_id = id->pkg;
258+
fabric_info.power_domain_id = id->punit;
259+
fabric_info.level = config_index;
260+
261+
ret = tpmi_process_ioctl(ISST_IF_GET_PERF_LEVEL_FABRIC_INFO, &fabric_info);
262+
if (ret != -1) {
263+
ctdp_level->uncore1_p0 = fabric_info.p0_fabric_freq_mhz[1];
264+
ctdp_level->uncore1_p1 = fabric_info.p1_fabric_freq_mhz[1];
265+
ctdp_level->uncore1_pm = fabric_info.pm_fabric_freq_mhz[1];
266+
}
267+
256268
debug_printf
257269
("cpu:%d ctdp:%d CONFIG_TDP_GET_TDP_INFO tdp_ratio:%d pkg_tdp:%d ctdp_level->t_proc_hot:%d\n",
258270
id->cpu, config_index, ctdp_level->tdp_ratio, ctdp_level->pkg_tdp,

tools/power/x86/intel-speed-select/isst-display.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,26 @@ void isst_ctdp_display_information(struct isst_id *id, FILE *outf, int tdp_level
460460
format_and_print(outf, level + 2, header, value);
461461
}
462462

463+
if (ctdp_level->uncore1_p1) {
464+
snprintf(header, sizeof(header), "uncore-1-frequency-base(MHz)");
465+
snprintf(value, sizeof(value), "%d",
466+
ctdp_level->uncore1_p1 * isst_get_disp_freq_multiplier());
467+
format_and_print(outf, level + 2, header, value);
468+
}
469+
if (ctdp_level->uncore1_pm) {
470+
snprintf(header, sizeof(header), "uncore-1-frequency-min(MHz)");
471+
snprintf(value, sizeof(value), "%d",
472+
ctdp_level->uncore1_pm * isst_get_disp_freq_multiplier());
473+
format_and_print(outf, level + 2, header, value);
474+
}
475+
476+
if (ctdp_level->uncore1_p0) {
477+
snprintf(header, sizeof(header), "uncore-1-frequency-max(MHz)");
478+
snprintf(value, sizeof(value), "%d",
479+
ctdp_level->uncore1_p0 * isst_get_disp_freq_multiplier());
480+
format_and_print(outf, level + 2, header, value);
481+
}
482+
463483
if (ctdp_level->mem_freq) {
464484
snprintf(header, sizeof(header), "max-mem-frequency(MHz)");
465485
snprintf(value, sizeof(value), "%d",

tools/power/x86/intel-speed-select/isst.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ struct isst_pkg_ctdp_level_info {
147147
int uncore_p0;
148148
int uncore_p1;
149149
int uncore_pm;
150+
int uncore1_p0;
151+
int uncore1_p1;
152+
int uncore1_pm;
150153
int sse_p1;
151154
int avx2_p1;
152155
int avx512_p1;

0 commit comments

Comments
 (0)