Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3091901imj; Mon, 18 Feb 2019 19:41:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IaureNI+di7eJOZXCqPAF/g/RjESw4+owTjbILwUloTaxGN54/DpcKKjMmFbqQVaRdGSOt1 X-Received: by 2002:a17:902:850a:: with SMTP id bj10mr6314297plb.91.1550547687749; Mon, 18 Feb 2019 19:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550547687; cv=none; d=google.com; s=arc-20160816; b=hJgcj+laovKjFfWQMCYg3SoLNjM1XDG8SUvIayAIHIZli6hrmnh06Uv/U3s9UXj33O Uf7Qj4tvYV3XqK49SNpdWregRBUpPPEk7NSfpQgegZBSLusL0tFyeVVQyJScdtqv/PIK PcnV45iohINIY5ZLDCP1HcyXa8wth1eIGizKc2meruaX/I4cPeWaqryPUP2+AZFjWudR aZiCUqbF6pchmJUAb2Iyn2yUEH3LK5r36Ld6+G0cLgijREvU8H6a3br2FN3pHCmQCiyt 2rapN+cI5xaorNpRome3/AeeqKI3ODoqfyF55Ea1XQJwnNKo99IBN09xu4nGS3dYD/2O JySw== 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=kJ9FUW3IcKMyRTcPH2qDXeCEf5isDA9+ZO46r25o66g=; b=MyOMunRKBXB07DhNh+CiUE/LofsPX+LFB9mIm4DOIx0yoO5Gy0Iwj7YdoE4dndC/KP r9DvSL23w3LlKU1n2PY66iYXRmLuZEVv/Sa41eckKTpcjN7Xv7FGf4034YcjTtlBjYnx H+iKiyjKT+SQ1lcycPIgzlHKWUTZDFYpsHnXlAOotHl7qStpUEV8yU9NtaFWL/fNH2Ka Mqiua5FsK/jOnJ2h6LNH6u0+ZaBrTVmzKTGN231yvxF26Wvg5lmw8L8dQKVfLEJOfECk 43gQmrPLdqPuYYx+Z3RXnA3zo1UtqkUv7zs0oKWmm4ej/Vn7Rfgj7DJYIuIlyZw8i4pl NhVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ABO7z+hS; 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 z186si1773968pgd.477.2019.02.18.19.41.13; Mon, 18 Feb 2019 19:41:27 -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=ABO7z+hS; 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 S1726693AbfBSDki (ORCPT + 99 others); Mon, 18 Feb 2019 22:40:38 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:43566 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726407AbfBSDkg (ORCPT ); Mon, 18 Feb 2019 22:40:36 -0500 Received: by mail-qt1-f195.google.com with SMTP id y4so21607291qtc.10 for ; Mon, 18 Feb 2019 19:40:35 -0800 (PST) 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=kJ9FUW3IcKMyRTcPH2qDXeCEf5isDA9+ZO46r25o66g=; b=ABO7z+hS7AVcQLFxvPRfBiuCEGf9SfNSJllHmvn7HkgdxweRJ7lrSj84yvEv0Rkzd5 QXdz3KGF5+3IC4PbuKUvwnyO+xuyW9rsfKwA4NhBF52ic4iMtZ7upHFY1rmykx6XmyJP g99TqKZ3TVZvvIvPxTr7qpFwumjlEKghe9mFZKjXf9lR5MoOwSbFkoE7jo/zwQ0JhAOS o5p/Xf+a8oxkq/ONTjQNY/qQsCYplyE4G8rA19qNkOskGmSb0oSoE5pu+6H1cMIpMO4m FHIcXC4Au0IxadjNzDW/NTD3xSd7bo+RgvXXLIbZHp70/mtcYmAC9ikr2nbe6sAOHLmB KMPA== 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=kJ9FUW3IcKMyRTcPH2qDXeCEf5isDA9+ZO46r25o66g=; b=Xn3ygNNBI6IMgTr6mdUa4I9qT5knCDqmQD3diMvHgZBrVuBt6l0sMce8DDtPlUi0A4 7mncGxtVQKrOEzTuVi6+2UT2xgu566VUCd/fGEs8MwmBxEpaeoLTtuNC1pYDNJg6fNAO t9ZA3p4J89XVo5RhfLRCMP8CuJhOhC7JRsCnISaIcoDs+fs66y6UWoURbsGt2QGnaMEm DrmM5TA+vy9yl0UOfhAocgwsva2okw8BeCu6IbaCFbwcFk5x62++lJuOy/oSJo5Fl6UM khBfAoGWKkext5mb+/AsEQr5KlFOq9EFYmHFPtXjVHWiqqd7JeX6t4oHPCWlem8N8u3D Midw== X-Gm-Message-State: AHQUAuarC+28hKSedZo7W/UBGaKV/3JGbLAYIt3OER96hk/V9jkg1ntg FCdnU+dH4r/+sIZECl2xBviwSlwG X-Received: by 2002:a0c:a326:: with SMTP id u35mr20173663qvu.190.1550547634877; Mon, 18 Feb 2019 19:40:34 -0800 (PST) Received: from kbl.fios-router.home (pool-96-233-42-17.bstnma.fios.verizon.net. [96.233.42.17]) by smtp.gmail.com with ESMTPSA id u5sm7327680qtg.37.2019.02.18.19.40.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Feb 2019 19:40:34 -0800 (PST) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Zhang Rui , Len Brown Subject: [PATCH 10/11] thermal/x86_pkg_temp_thermal: Support multi-die/package Date: Mon, 18 Feb 2019 22:40:12 -0500 Message-Id: <1e81b76b84c572a7bfe9468d33c6fdcfbf7cf513.1550545163.git.len.brown@intel.com> X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <635b2bf8b1151a191cd9299276b75791a818c0c2.1550545163.git.len.brown@intel.com> References: <635b2bf8b1151a191cd9299276b75791a818c0c2.1550545163.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_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..a2eb9136105e 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_unique_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_unique_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_unique_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