Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5542349yba; Mon, 13 May 2019 12:43:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxMHM2rbwTTuEqPSItYuoozIwvfo+uzuHP/6iIU/mt8hdx7UvcnjrVbriDCDAjMC19edSH X-Received: by 2002:a17:902:b58a:: with SMTP id a10mr3637956pls.83.1557776611009; Mon, 13 May 2019 12:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557776611; cv=none; d=google.com; s=arc-20160816; b=FLrc5by4LWSOaxuY6+fA/GjexcnSeryXOWriGYJeA39hp8ogUyALy5d6GE2rujqwnD 8KygaDI8DTycXJXGnRzm79s+OkVkMj81LdMpsxL0ZDkWEP5g0AyELDlWBaB5gAhab/TL eOTW0x1M5YHBvEU820dmQxqHdKOBkHqolLEAFvq4gtasrToT9I0iw6CZbkQfNO6eO08Q zlGEJDEmqg87x48T9fKRacF2ktrBhb+n7uSsxhZP8/VRsytYeNYc0PNC7u/ithcIHyd6 Eyb5qXjtHAkwv8ysxJnGwx4c/L+4n7QIaTeAcrNFRC4OO2OqaEH3VPPDQyl0nJ1aJPiD zXlg== 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=gDtFojjLz1ScpCd4FpcXrjud9lnprx07tdPJjyItHs17tzmRXUUnWKFar2SxTwWRJ4 mSRe3A4MXigAqKXRNSSlWyX2qd3oWgSKrQB6NbvL37GB+eQv8PXMVpiF3/7iir1W6ySu iV077aAATggfV0FefOn/pVr41u6cfkci0IrQBkNuB1577gPfYWdM8bvw9St63nxlbCKA cWzPXm752B04070Tlh2tOMmryQXwVZmPER+dOZ3xycWEt3r6/KG727IDIE9GMURwoLmT Hc97MJJMQ9aym2nzF+Y/EhzA+DZKIOvqsmWXZj/nDGvfPabRtcP1pbBKKE3lBtwaqXzz Y3sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Dro0llPK; 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 d18si17754829pgi.335.2019.05.13.12.43.14; Mon, 13 May 2019 12:43:30 -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=Dro0llPK; 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 S1732218AbfEMSAc (ORCPT + 99 others); Mon, 13 May 2019 14:00:32 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36617 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732060AbfEMR71 (ORCPT ); Mon, 13 May 2019 13:59:27 -0400 Received: by mail-pg1-f193.google.com with SMTP id a3so7156234pgb.3 for ; Mon, 13 May 2019 10:59: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=EqYgwV/DljsSwmFELEFQhJ3qI+LrWWEch0hPKLG0mz8=; b=Dro0llPK2WjF5ahCi3YbRxtCRKwEtGygtm2d5j8RNT1Jz9qF1lJ4oCnlVWD2FxAVfC q69lCANswQNOhyEEKN7jZbJoL10RM0fZPPcCn4DTRCb23pqMgU+azOEidtCLIB5d5f7L 32eB0hKhMSocJwPV7ezEFTT/umOOl5q6Q+W347OTiV4llt88pWC6hjm3dJES9zdnViwH DpfKpUQ9MF79vYw3X8HQdGd9SDzTJO6YjKzrTFzor+pDRlu6oXxExHcSqIUWdQKyOB1h eVUMe98gFA+0AYArueKxwbloCj9FdDV1EklpowvrDQHBcpa27jvK/Qy0msntff86dqqY k8hg== 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=XblWmecYAzdv23/sGoHcWYnT5Fm8eeDn8p7hLXjModge5zjcvBG9zmOmKBQQ7KnoeJ DTJmt55h+yz7tlbJe6HHmAI5Cc0vNDBnfdaeAvZgUo+83aEA88OCNpKUainV7rufSoEd tFx+3pGA4YL+eJf4yXuB6REr8SEo+yuYT4tzmftv3b3mJY6e3ss3LMInFNwBmFhRffjX w79n/Le5mB097f8hPYNPpHt4A7S9SqjMfJiXh3zpv9xiag1G6w7COyaHW6kgFO/Df+4s 2Au+P4Zimm7o666HX9lQKch7Z7gCoWDl5mJbCosi9TCgPHO+qZ6e8/B5fDEE5qzhi50n C/hA== X-Gm-Message-State: APjAAAW1S6KpYPzADetks+L5FpwQU8F4arhmDmEdwNrLxmC5C8Kc2dyc zJ6nYBn5ylQ6EiLa5/gDqKU= X-Received: by 2002:a62:e043:: with SMTP id f64mr35868389pfh.76.1557770367117; Mon, 13 May 2019 10:59:27 -0700 (PDT) Received: from localhost.localdomain ([96.79.124.202]) by smtp.gmail.com with ESMTPSA id s12sm9536266pfd.152.2019.05.13.10.59.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 10:59:26 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Zhang Rui , Len Brown Subject: [PATCH 08/19] thermal/x86_pkg_temp_thermal: Support multi-die/package Date: Mon, 13 May 2019 13:58:52 -0400 Message-Id: <281695c854d38d3bdec803480c3049c36198ca44.1557769318.git.len.brown@intel.com> X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <7b23d2d26d717b8e14ba137c94b70943f1ae4b5c.1557769318.git.len.brown@intel.com> References: <7b23d2d26d717b8e14ba137c94b70943f1ae4b5c.1557769318.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