Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3749935imj; Tue, 19 Feb 2019 08:48:05 -0800 (PST) X-Google-Smtp-Source: AHgI3Iax7t1MYjEuojVT7LdvNKWGyD4pS9Ozzx/iU0+O2U1NwL4qXSL+B9xcsQ8sOINwODjlyey2 X-Received: by 2002:a62:b511:: with SMTP id y17mr30473001pfe.199.1550594885496; Tue, 19 Feb 2019 08:48:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550594885; cv=none; d=google.com; s=arc-20160816; b=0Ceokv4NhQIDIOIK2/F8vnt8z6VZCqB+GIBuRs0vWY+6Q4WrG17j7q9oSTpsUVF1g6 3Gi7viDYUcKGtWLUtAOHpK/YsmX0J9cJnXYmNa+Oim9dfrpqkknbuy8RhgTwqDinV0l6 7Jm3xg06Swxo+Edi4wCQTC3Kvzq4uf0aT0C1vBSgBJb4pNJ1Ei1YzWXr4d5KS1YD4y0V HeGp7IwHltKyGEUcLY9vSyFgL4FmLChNNQFcpOsaRYcS0fa0BO8H+p4YLZDpbniz6dO+ iKcBUz4m+izPGDJ0JNNByr2NQ520K8smvhpxw9SrfWBlTcBr066q2leqMYEKSsRz3KuQ Giog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=1Qu2t5Kd9pgLrX06LIAt+b3Zb2/etIust7WpLoqpeB4=; b=aLx28SFYMkgrlTdlUCPjEdG+9lSXMtkL1hO3Op9MaesgL/JIEVOhqUjIy/2auRLmOG W2ofb3GmxCFlPnMt8EbCNSt0Tfx6zPyuICYmRLP6J4QqL282DtitJ8Pq/N6aTkEHX3kA vtFEGZeUEX3j2IWD56nI5MeqrrY3jfEUe0MgXIeNDm5DN0U5XFkK8Hrk6oC5jj2QTzl9 X1avX7M5KCz2W80aVK+jEwRyGi5nksL6HDRn3AWo3C5TrqPkvvHYVkr9kdZ96DABadCh cPhyTQy9y4jqUVA84MYP4cwHpN0rIsWq+7GfkxJEj4Nae7XpKouFrwldNVhu8DjoI+OC FN4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VnnyoTWW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11si15005546pgv.595.2019.02.19.08.47.50; Tue, 19 Feb 2019 08:48:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VnnyoTWW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729095AbfBSQqQ (ORCPT + 99 others); Tue, 19 Feb 2019 11:46:16 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43429 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfBSQqP (ORCPT ); Tue, 19 Feb 2019 11:46:15 -0500 Received: by mail-pf1-f196.google.com with SMTP id q17so10481406pfh.10; Tue, 19 Feb 2019 08:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1Qu2t5Kd9pgLrX06LIAt+b3Zb2/etIust7WpLoqpeB4=; b=VnnyoTWWXidBBt1pIhmQhNUC9SzzTpvgaTLeao1BXgcGOWzsewI9x5wHlWUVy7SBSI rR7evGhQDQCRcWt+HoBI+Dccj3VLpVqJJf5GbhEDGdj4+284Z4Su9n9ms2B73HEPJNdf hiORm99BPGhH9qVdCeKQm1cIrN0dO30q/DXNJiqacLLgmCY2+cFxR6LHAR+H0rfaghWq EdhkmviPFG72waxZmMQ7ON6eManhKvNwBttKW9zif2vzPrX9hGa0G+gUPaimEUVt6jZn IKm6HCP23jHSCRDoUqf6WwovJzELuHIYDNzC+4cW6ch+SgpHRtbi4OAFK2tG3P+gX803 eBzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1Qu2t5Kd9pgLrX06LIAt+b3Zb2/etIust7WpLoqpeB4=; b=hPd3IgNrSiqZaK81Gxb6mEywcp/jT7LUZ5xri9/fMAP+K3DbPwcdsnac+lCfT413aC dLRkvseLVPAgBIDfyyf3WTbwO5NHjlJQYnwVLBHGfRbetPG/IhZct90sVOqCC2DtvH+e lB20ARGZoiGha7Q4oklAYKWmaUNa6bhonLpzXWcg9SthPVOlhPulB8H4j7FGpn6bbmsH ZkQxfFLufMwyeyLiEv5qnrIbnDZau1oXfkqyzn1QMxYERH7pe0+yD3l1p3aNlAfkYKAF gId4P9vfugn9+7sDDJSakvUxYlWUMotEuevm21tF3K142BMTC2anMYiOoEPoWTbRt3jz KZxQ== X-Gm-Message-State: AHQUAua1SShOVtFMard4o+7Nx4ZuFA3XFVPkqf2LOhklq2RyOIvpcDeg hdaQio4dpG5rfFv/BiEt6pNzDNDc X-Received: by 2002:a63:7403:: with SMTP id p3mr1737158pgc.343.1550594774669; Tue, 19 Feb 2019 08:46:14 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id q5sm23049732pga.71.2019.02.19.08.46.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 08:46:14 -0800 (PST) Subject: Re: [PATCH 11/11] hwmon/coretemp: Support multi-die/package To: Len Brown , x86@kernel.org Cc: linux-kernel@vger.kernel.org, Zhang Rui , Len Brown , linux-pm@vger.kernel.org, linux-hwmon@vger.kernel.org References: <635b2bf8b1151a191cd9299276b75791a818c0c2.1550545163.git.len.brown@intel.com> <8ce75b95ef6105ebe5fb8c9e43b33f06516e3c16.1550545163.git.len.brown@intel.com> From: Guenter Roeck Message-ID: <2e9ca4e1-d9ff-8f0c-c3c3-80f8b19bb7ee@roeck-us.net> Date: Tue, 19 Feb 2019 08:46:12 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <8ce75b95ef6105ebe5fb8c9e43b33f06516e3c16.1550545163.git.len.brown@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/18/19 7:40 PM, Len Brown wrote: > From: Zhang Rui > > This patch introduces coretemp driver support > for new dual-die/package systems. > > On the new dual-die/package systems, the package temperature MSRs becomes > die-scope. Thus instead of one hwmon device per physical package, now > there should be one hwmon device for each die on these systems. > > On the hardwares that do not have multi-die support, > topology_unique_die_id() equals topology_physical_package_id(), thus the > only difference is that physical package id is used as the coretemp > platform device id, instead of logical package id on these systems. > > Signed-off-by: Zhang Rui > Signed-off-by: Len Brown > Cc: linux-pm@vger.kernel.org > Cc: linux-hwmon@vger.kernel.org > Signed-off-by: Len Brown Acked-by: Guenter Roeck > --- > 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..a0b6b2247c3a 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_unique_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_unique_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_unique_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() * c->x86_max_dies; > pkg_devices = kcalloc(max_packages, sizeof(struct platform_device *), > GFP_KERNEL); > if (!pkg_devices) >