Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5723129yba; Tue, 30 Apr 2019 21:26:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwS8CcOtP7V0THPn/T39U8N+xv5Yhv5LJ104f/GvEfevVjWn2SRkj03ztTjnZDGC9dNkPXq X-Received: by 2002:a63:c10d:: with SMTP id w13mr71039675pgf.311.1556684768147; Tue, 30 Apr 2019 21:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556684768; cv=none; d=google.com; s=arc-20160816; b=FkLE0gWNeO5HRPfZXCN68A5vgzu7Le0re0PUydRYaUI+7MgpUCUY7nsWqD115gLewo uhJZ43/tQtGRYEHLH9mUId6jV8wyCTdOqyUEBMGiAEr74Ugjdf/07AZlvWW3rv7s+mKz mVw2dlUrJFGa1khl+bnVkKhZCUFrGdTWhPW7hYRWYNboS3E3Mjd5VufN0m/KP2+yU7Yu E21CBdz+FtywB532cXdB+bOCMbN4KWL0th/1gI227xKPgYZKE9RZ3nYTdkQKBKN9QryY XILd+WeLyvl1Q2ObLF/UvKUr4HMBu5rAmUXotj8HyIuQxfutgXj9kg8ks4AOBdVEL+Ya /QCw== 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=qnf7XxU3rUOgopze0ZJveOf+g8SobY9/+elXh+yfiodk29LLt6e4DoWTXhc7xfmXt+ +eVKJWoXgZGMt/K1dcvyGoJUrl1ODJ75TmXWWOPKhW6uStTae6XVJdP1LH0ngjZ2M28F WKYBGYEdbDA/UcAq13LZUiPLd/PRPw/krmf8IIrQ8VZLQpljTwi+myfCG459PgTyuCUV RTR4GCrnFUsPakAzufdKx2kTyekubQoQhPv2mCt7BFOCNKyzcKvvXQiw5AYikReJP6Zp LQC18vb7+S/zf7HXm/XEfdk487TG1S+2SeP/0fwryLGBfR2QfwX5ZpRBAj+THQjAvzYV 0q1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=UNKL7rZL; 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 v2si38787569plp.191.2019.04.30.21.25.53; Tue, 30 Apr 2019 21:26:08 -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=UNKL7rZL; 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 S1726322AbfEAEYu (ORCPT + 99 others); Wed, 1 May 2019 00:24:50 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:40839 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbfEAEYs (ORCPT ); Wed, 1 May 2019 00:24:48 -0400 Received: by mail-it1-f194.google.com with SMTP id k64so8370229itb.5 for ; Tue, 30 Apr 2019 21:24:47 -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=UNKL7rZLURJmJhc1JUtT8n2YD7NCang6ss2FL0Prx73u739wMCYSh3xbvTtRIutoXu 8Shvd93FVcyS9HGePW5a3oKM5DrOellE0kACry0GUu2jagI68LMzIMvHG/cQ5MfKqODZ O9Ms/6BjYOBsNIkD+s52Fu6NfOCUHENkFTVnwDCy3kQTS7pleKIJWRz7RpOO4WSMJm9M VtEia7SZ1tvNqsgQyHEROd2sXaxpcqQJ6qOJOguNU5erGtu7NrdIRgramXKoL9Kjmig8 R2sM5IXZDqUcubBoqEwzY4w7MHRFqI/6xLXaoEXch8+DR3ySvCLMvlP/DxsM9M6R8/yc FIaA== 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=NijaTsBvw0+ml40+hyZcYPo+VhsCVvqqm1mvsE7jhIgswrecv+LXJ9JxBNG9BaWIYR Nsjn25B0e4PL+Nq+VN0diH2WBYpf0E4MgydU0gk1OkN6O9I9F1IyUTVzpLHj9Plf+M1q jnTJEBb8swkPJVGWTjAgIpevhFyYktyhg9SjnsZNhqeBC0c3hZf/f6SZ40EUb3V9o6eO K9ZmS/Lh4eHvlOUZ6jAOzipXc0IKzQF9AJYZtJparw/0Q58yfxySNTAmS6DckrV3KXWN tZoAYyVJO0XPcLalQZg2e0Zc35Keb5a5V5rxUH8oVS0Vqi7gBO9Jlk00Cq4+sRz3yTAc bEaw== X-Gm-Message-State: APjAAAVMqirMD64NQZ3f+PFKTQePFUfjntzqML4zyeju4cC0VNE+kT/n O8izqcNhRA4czzAk/g1cL18= X-Received: by 2002:a05:660c:685:: with SMTP id n5mr6868053itk.57.1556684687274; Tue, 30 Apr 2019 21:24:47 -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 b8sm2569728itb.20.2019.04.30.21.24.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 21:24:46 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Zhang Rui , Len Brown Subject: [PATCH 11/18] thermal/x86_pkg_temp_thermal: Support multi-die/package Date: Wed, 1 May 2019 00:24:20 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1556657368.git.len.brown@intel.com> References: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1556657368.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