Skip to content

Commit cfcd82e

Browse files
zhang-ruiKAGA-KOKO
authored andcommitted
hwmon/coretemp: Support multi-die/package
Package temperature sensors are actually implemented in hardware per-die. Update coretemp to be "die-aware", so it can expose mulitple sensors per package, instead of just one. No change to single-die/package systems. 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: Guenter Roeck <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/ec2868f35113a01ff72d9041e0b97fc6a1c7df84.1557769318.git.len.brown@intel.com
1 parent 9ea7612 commit cfcd82e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/hwmon/coretemp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static int chk_ucode_version(unsigned int cpu)
435435

436436
static struct platform_device *coretemp_get_pdev(unsigned int cpu)
437437
{
438-
int pkgid = topology_logical_package_id(cpu);
438+
int pkgid = topology_logical_die_id(cpu);
439439

440440
if (pkgid >= 0 && pkgid < max_packages)
441441
return pkg_devices[pkgid];
@@ -579,7 +579,7 @@ static struct platform_driver coretemp_driver = {
579579

580580
static struct platform_device *coretemp_device_add(unsigned int cpu)
581581
{
582-
int err, pkgid = topology_logical_package_id(cpu);
582+
int err, pkgid = topology_logical_die_id(cpu);
583583
struct platform_device *pdev;
584584

585585
if (pkgid < 0)
@@ -703,7 +703,7 @@ static int coretemp_cpu_offline(unsigned int cpu)
703703
* the rest.
704704
*/
705705
if (cpumask_empty(&pd->cpumask)) {
706-
pkg_devices[topology_logical_package_id(cpu)] = NULL;
706+
pkg_devices[topology_logical_die_id(cpu)] = NULL;
707707
platform_device_unregister(pdev);
708708
return 0;
709709
}
@@ -741,7 +741,7 @@ static int __init coretemp_init(void)
741741
if (!x86_match_cpu(coretemp_ids))
742742
return -ENODEV;
743743

744-
max_packages = topology_max_packages();
744+
max_packages = topology_max_packages() * topology_max_die_per_package();
745745
pkg_devices = kcalloc(max_packages, sizeof(struct platform_device *),
746746
GFP_KERNEL);
747747
if (!pkg_devices)

0 commit comments

Comments
 (0)