tools/power/x86/intel-speed-select: Use core count for base-freq mask
Some firmware implementation gives error when a command is sent get mask for core count 32-61. So use core count to decide. But there is no function to get core count. So introduce one function to get core count. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
7af5a95bb7
commit
de7f9d3ddc
@ -338,6 +338,7 @@ void free_cpu_set(cpu_set_t *cpu_set)
|
||||
}
|
||||
|
||||
static int cpu_cnt[MAX_PACKAGE_COUNT][MAX_DIE_PER_PACKAGE];
|
||||
static long long core_mask[MAX_PACKAGE_COUNT][MAX_DIE_PER_PACKAGE];
|
||||
static void set_cpu_present_cpu_mask(void)
|
||||
{
|
||||
size_t size;
|
||||
@ -362,13 +363,33 @@ static void set_cpu_present_cpu_mask(void)
|
||||
|
||||
pkg_id = get_physical_package_id(i);
|
||||
if (pkg_id < MAX_PACKAGE_COUNT &&
|
||||
die_id < MAX_DIE_PER_PACKAGE)
|
||||
die_id < MAX_DIE_PER_PACKAGE) {
|
||||
int core_id = get_physical_core_id(i);
|
||||
|
||||
cpu_cnt[pkg_id][die_id]++;
|
||||
core_mask[pkg_id][die_id] |= (1ULL << core_id);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
}
|
||||
|
||||
int get_core_count(int pkg_id, int die_id)
|
||||
{
|
||||
int cnt = 0;
|
||||
|
||||
if (pkg_id < MAX_PACKAGE_COUNT && die_id < MAX_DIE_PER_PACKAGE) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(long long) * 8; ++i) {
|
||||
if (core_mask[pkg_id][die_id] & (1ULL << i))
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int get_cpu_count(int pkg_id, int die_id)
|
||||
{
|
||||
if (pkg_id < MAX_PACKAGE_COUNT && die_id < MAX_DIE_PER_PACKAGE)
|
||||
|
@ -335,12 +335,15 @@ int isst_set_tdp_level(int cpu, int tdp_level)
|
||||
|
||||
int isst_get_pbf_info(int cpu, int level, struct isst_pbf_info *pbf_info)
|
||||
{
|
||||
int i, ret, core_cnt, max;
|
||||
unsigned int req, resp;
|
||||
int i, ret;
|
||||
|
||||
pbf_info->core_cpumask_size = alloc_cpu_set(&pbf_info->core_cpumask);
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
core_cnt = get_core_count(get_physical_package_id(cpu), get_physical_die_id(cpu));
|
||||
max = core_cnt > 32 ? 2 : 1;
|
||||
|
||||
for (i = 0; i < max; ++i) {
|
||||
unsigned long long mask;
|
||||
int count;
|
||||
|
||||
|
@ -163,6 +163,7 @@ struct isst_pkg_ctdp {
|
||||
|
||||
extern int get_topo_max_cpus(void);
|
||||
extern int get_cpu_count(int pkg_id, int die_id);
|
||||
extern int get_core_count(int pkg_id, int die_id);
|
||||
|
||||
/* Common interfaces */
|
||||
extern void debug_printf(const char *format, ...);
|
||||
|
Loading…
Reference in New Issue
Block a user