Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5385298yba; Tue, 30 Apr 2019 13:59:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7i/s8cmKIP/Te2K6OkPC5e7iNw3Ctd/QHKNP/Ci+8Ut2+AEavkPqzGBh6PpNHF36joR98 X-Received: by 2002:a63:c243:: with SMTP id l3mr38668085pgg.448.1556657941395; Tue, 30 Apr 2019 13:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556657941; cv=none; d=google.com; s=arc-20160816; b=rRUg7stiZfOq6qkIJu1NsrawFcPWAgLISyRbo/p2JR5Zd21D4jgAWMNvTH6TYxGH6V ETL9/9Sc867fc6m5bQjRnX22T5mdgsUfwuCmk85bNl6hwXU5g6StxBJszjEQfavQiamx W9jtkA3r1QEZNslgtBPUYrKwYyx0g+2/wLqTOcNa1sbCS/x7jC/l517wLiEc3MKw3AeO EjUaUzFN5qJIXtz2Q8AY+XDM18iPRMx/E34pBKtUK/UEqEE/64p+a4WIeQ7oeBrWLA0l Q9VOIBKwKsoFIFJDZxH2eunEgHr3qNmp3hcpaTLvsJwyJQioiGMiHMQk0beLig4H06dh ruQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=b/Kzn17Vf6dzrUo0Ue4UVG8xwRuP07tjAkgwmkdmxSM=; b=YO6N5an+CGQmPwCkYk3QT/dkF8AcCFJqUzZwWAEJpdeOByY0xXygxK7woLrCKBGChi jy5I2XjAv8porbDJgYCD8ImCYJhaVh91k59hF6+o343VcraH0MWBVz+t6wB1G3xVziSD GnybLovQrNPa4CdxsxtE/GHTXojmGOr/QT2hmsHStpqSFl+bOV2ZPxP8UkGbHtUXrrwW M8dm8pTA3eoceTVmpeRcUc1+KO0KrPgzK/iIzDb4Jg22O+8QQ4HruEX0/9j+dECVerhb Fg1tgw659DpTPRVTveaIxLNrl1LlIEIbOp11arnGfHA0ZJVJWlHlRXH/4gyVF8ICDKZ4 CawQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=l2Ngkm3u; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si38617063pfn.95.2019.04.30.13.58.46; Tue, 30 Apr 2019 13:59:01 -0700 (PDT) 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=l2Ngkm3u; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727409AbfD3U4e (ORCPT + 99 others); Tue, 30 Apr 2019 16:56:34 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:44865 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727138AbfD3U42 (ORCPT ); Tue, 30 Apr 2019 16:56:28 -0400 Received: by mail-io1-f66.google.com with SMTP id r71so13416946iod.11 for ; Tue, 30 Apr 2019 13:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :reply-to:organization; bh=b/Kzn17Vf6dzrUo0Ue4UVG8xwRuP07tjAkgwmkdmxSM=; b=l2Ngkm3udG5DyEeOtAZ6oGOA4KVZFxOuU8B0Eh/mhP/bJhBtNOJ3THAVMUUOf2adi6 twyrG8mco4dS9wuz/9nT/P5/Axw/6yzp90UW052mZYeGiDVTybOex8vALV93D8ezIys5 NhJ6JQGiYyw+SklgO2z+4+4MCMJ9akazv3+X9gh4BuRMbfGIvnC6PRyxv0wAPuqC7gzr Mj3Nb1haakcj6ZSmSh+WgfED0+Vwi5suzzrRVyhjMYe9r8rAE/mg6sp4Qq0N6zlWKIgG TUGE5E/wStrgmQ266qa/ony2I83HWhu1g56K71ikeIg3WBRsJzdq+16snOwQgmAX6Yhy 1NMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:reply-to:organization; bh=b/Kzn17Vf6dzrUo0Ue4UVG8xwRuP07tjAkgwmkdmxSM=; b=ObuCxE/uEWpr3ItdIvK0AIwoDmFFEGaPtc2n7m6OsxlMCeuaYdiQcNubXeGdN+cj8R MWm79Na1c902pKhDrjGj05aLW4gTkedpNoLzjCo+x4bgT47RWzms0E9QwKUyQM/ixdlc Pxcb++JHbH3SvATTYUiOBGyurdes7Wno2j26CErVK32HJuqH6rC4yTJZsV3pZVh+rbSc C3Xs9Y4viQjgei60QC5l9LpVISHVrjazgYvsoRKMGvGnW9CFcCXX8fyPyovQmoZEeWDL CjrAPmJ2lm/nxPCu9BtoqXML6NYBN0VFXADG9V97wGmNZhTjuRHhMxerGg9LU6F/YWve 2qgQ== X-Gm-Message-State: APjAAAXDbmLkWju86zFtONneP63p/O9Ekvliz7+w2me+Iu9x996LjuEK 2m5mxd6elOLQcP2emrCULUX9wZXS X-Received: by 2002:a5e:8f09:: with SMTP id c9mr5900530iok.62.1556657787203; Tue, 30 Apr 2019 13:56:27 -0700 (PDT) Received: from nuc8.lan (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id s7sm9799349ioo.17.2019.04.30.13.56.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 13:56:26 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Zhang Rui , Len Brown Subject: [PATCH 10/14] thermal/x86_pkg_temp_thermal: Support multi-die/package Date: Tue, 30 Apr 2019 16:55:55 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <75386dff62ee869eb7357dff1e60dfd9b3e68023.1553624867.git.len.brown@intel.com> References: <75386dff62ee869eb7357dff1e60dfd9b3e68023.1553624867.git.len.brown@intel.com> Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Rui On the new dual-die/package systems, the package temperature MSR becomes die-scope. Thus instead of one thermal zone device per physical package, now there should be one thermal_zone for each die on these systems. This patch introduces x86_pkg_temp_thermal support for new dual-die/package systems. On the hardwares that do not have multi-die, topology_logical_die_id() equals topology_physical_package_id(), thus there is no functional change. Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- drivers/thermal/intel/x86_pkg_temp_thermal.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c index 1ef937d799e4..1b03ab3ee20c 100644 --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c @@ -122,7 +122,7 @@ static int pkg_temp_debugfs_init(void) */ static struct pkg_device *pkg_temp_thermal_get_dev(unsigned int cpu) { - int pkgid = topology_logical_package_id(cpu); + int pkgid = topology_logical_die_id(cpu); if (pkgid >= 0 && pkgid < max_packages) return packages[pkgid]; @@ -353,7 +353,7 @@ static int pkg_thermal_notify(u64 msr_val) static int pkg_temp_thermal_device_add(unsigned int cpu) { - int pkgid = topology_logical_package_id(cpu); + int pkgid = topology_logical_die_id(cpu); u32 tj_max, eax, ebx, ecx, edx; struct pkg_device *pkgdev; int thres_count, err; @@ -449,7 +449,7 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) * worker will see the package anymore. */ if (lastcpu) { - packages[topology_logical_package_id(cpu)] = NULL; + packages[topology_logical_die_id(cpu)] = NULL; /* After this point nothing touches the MSR anymore. */ wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, pkgdev->msr_pkg_therm_low, pkgdev->msr_pkg_therm_high); @@ -511,11 +511,12 @@ MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids); static int __init pkg_temp_thermal_init(void) { int ret; + struct cpuinfo_x86 *c = &cpu_data(0); if (!x86_match_cpu(pkg_temp_thermal_ids)) return -ENODEV; - max_packages = topology_max_packages(); + max_packages = topology_max_packages() * c->x86_max_dies; packages = kcalloc(max_packages, sizeof(struct pkg_device *), GFP_KERNEL); if (!packages) -- 2.18.0-rc0