Skip to content

Commit 724adec

Browse files
zhang-ruiKAGA-KOKO
authored andcommitted
thermal/x86_pkg_temp_thermal: Support multi-die/package
Package temperature sensors are actually implemented in hardware per-die. Thus, the new multi-die/package systems sport mulitple package thermal zones for each package. Update the x86_pkg_temp_thermal to be "multi-die-aware", so it can expose multiple zones per package, instead of just one. Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Len Brown <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/281695c854d38d3bdec803480c3049c36198ca44.1557769318.git.len.brown@intel.com
1 parent 32fb480 commit 724adec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/thermal/intel/x86_pkg_temp_thermal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int pkg_temp_debugfs_init(void)
122122
*/
123123
static struct pkg_device *pkg_temp_thermal_get_dev(unsigned int cpu)
124124
{
125-
int pkgid = topology_logical_package_id(cpu);
125+
int pkgid = topology_logical_die_id(cpu);
126126

127127
if (pkgid >= 0 && pkgid < max_packages)
128128
return packages[pkgid];
@@ -353,7 +353,7 @@ static int pkg_thermal_notify(u64 msr_val)
353353

354354
static int pkg_temp_thermal_device_add(unsigned int cpu)
355355
{
356-
int pkgid = topology_logical_package_id(cpu);
356+
int pkgid = topology_logical_die_id(cpu);
357357
u32 tj_max, eax, ebx, ecx, edx;
358358
struct pkg_device *pkgdev;
359359
int thres_count, err;
@@ -449,7 +449,7 @@ static int pkg_thermal_cpu_offline(unsigned int cpu)
449449
* worker will see the package anymore.
450450
*/
451451
if (lastcpu) {
452-
packages[topology_logical_package_id(cpu)] = NULL;
452+
packages[topology_logical_die_id(cpu)] = NULL;
453453
/* After this point nothing touches the MSR anymore. */
454454
wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT,
455455
pkgdev->msr_pkg_therm_low, pkgdev->msr_pkg_therm_high);
@@ -515,7 +515,7 @@ static int __init pkg_temp_thermal_init(void)
515515
if (!x86_match_cpu(pkg_temp_thermal_ids))
516516
return -ENODEV;
517517

518-
max_packages = topology_max_packages();
518+
max_packages = topology_max_packages() * topology_max_die_per_package();
519519
packages = kcalloc(max_packages, sizeof(struct pkg_device *),
520520
GFP_KERNEL);
521521
if (!packages)

0 commit comments

Comments
 (0)