Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2954145yba; Mon, 6 May 2019 14:29:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqz//Fu3LkZIS/hX1fOEio5NTY6EN1q85jb6959Yk1o0oK2P1qZxKc7M/M7jppqS6t4h48i8 X-Received: by 2002:a62:6807:: with SMTP id d7mr35840226pfc.75.1557178161466; Mon, 06 May 2019 14:29:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557178161; cv=none; d=google.com; s=arc-20160816; b=WScCkoZ9UikNewwmFR78UMI/ty3Pelx5mufuA+X7TcWnwczi5qkZH8XZ/ZFe6tU8VW 33eSvReLrNM9RqQ5e2qBvSDCfMI6jtJr8qAKECgi4Xb859rJ8eUt8X4zoe+O5QtSzuVq qdsAsZU3chJpAg5XSsp7E7oD3tvm6viD5mEaGajYwQ5H4R/YXyrGpYez5KRlY2tIgwXZ Chu9Xc+TtWcExcEKMBQREJJUilzIkU149tHDfqECeaOk54SMLMUAy2WyFpUWj+6XR6ik unCwyEXRoqKy1bY/NyVyyY41nessTWTj752IV4cS68qXZJuomCxZChqAm3LxFpLeCxak apyQ== 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=EqYgwV/DljsSwmFELEFQhJ3qI+LrWWEch0hPKLG0mz8=; b=aat+DU/0rh6htkmKYv1U5HDzGtzOmNILuH9L13XTxnVZY9zeimrrFz1Ufc9BxYVypM CnV9RGU+NUk38YSbokuW3K/dmLGkgG5l+RFQQgjhdO8cg5W4Zv+T9hMLpJsu5yEsK5bi 7q9uVVtRqtM6AJw5BIXoRJ3x9hDP2Z806QpPKzQsEXduUzPYqjnydOgZ24+bmASSQFcp Na6uPnOeWh8/ECD9v+gtrLqefaZ3pE9pP+2Bo3+BFXUrJemEXHRE+faNwpwm+9GjYJj3 5kIIKAcbr8THdxG8dZGHBBXIArYePr3lsaRmDD2Ofsb+9B+acmc4ozCFMdGvKUBvJBw6 izXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=at+zyniC; 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 f193si2758996pfc.134.2019.05.06.14.29.06; Mon, 06 May 2019 14:29:21 -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=at+zyniC; 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 S1726609AbfEFV0o (ORCPT + 99 others); Mon, 6 May 2019 17:26:44 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:35059 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726944AbfEFV0k (ORCPT ); Mon, 6 May 2019 17:26:40 -0400 Received: by mail-it1-f195.google.com with SMTP id l140so22355119itb.0 for ; Mon, 06 May 2019 14:26:39 -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=EqYgwV/DljsSwmFELEFQhJ3qI+LrWWEch0hPKLG0mz8=; b=at+zyniC8e9Sj0M+k1eETZBS47E5W5QsPJIrVM+hdV+9bsbeG6PrXTT4kEbZXIStgS vbkgz0AeiB2lSKHZJybJxuE/Zmhjkr2SlIXIi2jgiZUzQKpj6fjpAhIPEnti4gwFEih+ IiEZNwGBbkvkJyW9KTQc066ZujAmj1N0qb+sz0TBdQLKsFMTbayFMqST5TN60vmjZon+ aGiIEO361TQi57+IrLml4q4AnadMZzC8CVX2VNy7QrsVkfvPk6lxZIRRqiAbTCn6JAwI 7l9qma6uI9FPKkI6s460d09FFhcC/O9ZimXyf9w9aApVEhcZyTeUSGnl/GUntf7FRVpg aMdg== 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=EqYgwV/DljsSwmFELEFQhJ3qI+LrWWEch0hPKLG0mz8=; b=BudhNwFaZpojwLk54g1iWGEkaT97wI2PDkFRARkisyp8v3/qDNPNbCSJeJf1kcB0AG k+/sgZO3Wo75So/gIpk/olNaNWzFr1kDTldoz0JHbmRo3+144PK4QAAa4M58nmqjUODb WoXR3AuCPxDZpd72Z3K1P8JXeUVG1ry4bdWPGDeIkp4ZYxbjFCRUirMu9Dso5el8YYe0 NbZ+SjFprJ11rfxuZQVib1nYOQhv2oGS7uFQ46hTeenyd0z6F+u8t6SrsOi9bWVvDRKn t0bJWbYr62ltYl+hAberumX4k64fr+t2Z7bQkZVZgLCJJHVxAvb7/WbttlGwNlSKQJj4 XnTw== X-Gm-Message-State: APjAAAW3wBEPDV82GvIcFG8lUDKvxVuvCVatiRQBIiBdfPka6IfBMC7b 24yQpV38vL8I74ybJAmNX6w= X-Received: by 2002:a24:dcc5:: with SMTP id q188mr3440418itg.64.1557177999141; Mon, 06 May 2019 14:26:39 -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 v25sm4268009ioh.81.2019.05.06.14.26.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 14:26:38 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Zhang Rui , Len Brown Subject: [PATCH 11/22] thermal/x86_pkg_temp_thermal: Support multi-die/package Date: Mon, 6 May 2019 17:26:06 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1557177585.git.len.brown@intel.com> References: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1557177585.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 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 Signed-off-by: Len Brown --- drivers/thermal/intel/x86_pkg_temp_thermal.c | 8 ++++---- 1 file changed, 4 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..405b3858900a 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); @@ -515,7 +515,7 @@ static int __init pkg_temp_thermal_init(void) if (!x86_match_cpu(pkg_temp_thermal_ids)) return -ENODEV; - max_packages = topology_max_packages(); + max_packages = topology_max_packages() * topology_max_die_per_package(); packages = kcalloc(max_packages, sizeof(struct pkg_device *), GFP_KERNEL); if (!packages) -- 2.18.0-rc0