Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 13/18] hwmon/coretemp: Support multi-die/package
       [not found] <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1556657368.git.len.brown@intel.com>
@ 2019-05-01  4:24 ` Len Brown
  2019-05-04  2:58   ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Len Brown @ 2019-05-01  4:24 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Zhang Rui, Len Brown, linux-pm, linux-hwmon

From: Zhang Rui <rui.zhang@intel.com>

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 <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Cc: linux-pm@vger.kernel.org
Cc: linux-hwmon@vger.kernel.org
---
 drivers/hwmon/coretemp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 5d34f7271e67..23a2d90534c7 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -435,7 +435,7 @@ static int chk_ucode_version(unsigned int cpu)
 
 static struct platform_device *coretemp_get_pdev(unsigned int cpu)
 {
-	int pkgid = topology_logical_package_id(cpu);
+	int pkgid = topology_logical_die_id(cpu);
 
 	if (pkgid >= 0 && pkgid < max_packages)
 		return pkg_devices[pkgid];
@@ -579,7 +579,7 @@ static struct platform_driver coretemp_driver = {
 
 static struct platform_device *coretemp_device_add(unsigned int cpu)
 {
-	int err, pkgid = topology_logical_package_id(cpu);
+	int err, pkgid = topology_logical_die_id(cpu);
 	struct platform_device *pdev;
 
 	if (pkgid < 0)
@@ -703,7 +703,7 @@ static int coretemp_cpu_offline(unsigned int cpu)
 	 * the rest.
 	 */
 	if (cpumask_empty(&pd->cpumask)) {
-		pkg_devices[topology_logical_package_id(cpu)] = NULL;
+		pkg_devices[topology_logical_die_id(cpu)] = NULL;
 		platform_device_unregister(pdev);
 		return 0;
 	}
@@ -732,6 +732,7 @@ static enum cpuhp_state coretemp_hp_online;
 static int __init coretemp_init(void)
 {
 	int err;
+	struct cpuinfo_x86 *c = &cpu_data(0);
 
 	/*
 	 * CPUID.06H.EAX[0] indicates whether the CPU has thermal
@@ -741,7 +742,7 @@ static int __init coretemp_init(void)
 	if (!x86_match_cpu(coretemp_ids))
 		return -ENODEV;
 
-	max_packages = topology_max_packages();
+	max_packages = topology_max_packages() * topology_max_die_per_package();
 	pkg_devices = kcalloc(max_packages, sizeof(struct platform_device *),
 			      GFP_KERNEL);
 	if (!pkg_devices)
-- 
2.18.0-rc0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 13/18] hwmon/coretemp: Support multi-die/package
  2019-05-01  4:24 ` [PATCH 13/18] hwmon/coretemp: Support multi-die/package Len Brown
@ 2019-05-04  2:58   ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2019-05-04  2:58 UTC (permalink / raw)
  To: X86 ML; +Cc: linux-kernel, Zhang Rui, Len Brown, Linux PM list, linux-hwmon

On Wed, May 1, 2019 at 12:24 AM Len Brown <lenb@kernel.org> wrote:
>
> From: Zhang Rui <rui.zhang@intel.com>

> @@ -732,6 +732,7 @@ static enum cpuhp_state coretemp_hp_online;
>  static int __init coretemp_init(void)
>  {
>         int err;
> +       struct cpuinfo_x86 *c = &cpu_data(0);
>
>         /*
>          * CPUID.06H.EAX[0] indicates whether the CPU has thermal

FYI, the hunk above was errantly left over from v2 and included in this e-mail.

It is removed in git.
And that is the only difference between this e-mailed series and my
latest git tree.

thanks,
-Len

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1556657368.git.len.brown@intel.com>
2019-05-01  4:24 ` [PATCH 13/18] hwmon/coretemp: Support multi-die/package Len Brown
2019-05-04  2:58   ` Len Brown

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org linux-hwmon@archiver.kernel.org
	public-inbox-index linux-hwmon


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/ public-inbox