From patchwork Tue Nov 8 08:12:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 13036008 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2393DC4332F for ; Tue, 8 Nov 2022 08:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230053AbiKHIKO (ORCPT ); Tue, 8 Nov 2022 03:10:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233354AbiKHIKK (ORCPT ); Tue, 8 Nov 2022 03:10:10 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C80AA19C12 for ; Tue, 8 Nov 2022 00:10:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667895009; x=1699431009; h=from:to:cc:subject:date:message-id; bh=JP+wuSUmMKieQ+H4jMdtw/4GiZgYQVaSNROl9AV5UtQ=; b=cAyuFGKXVFB+5Zau04HqmhmDBo/rnTxxJQjS2cOFZJN5KJd3Dsi1EBOa cQbaB85rtcYjqBcmrsKq64fqYO94PouqvFa/vRWeyGa1Fwu8BWopVJedH hAftp//e7TszV59ibiCnYsuJfu9qrAkwAdpfNS2cOI4qE8sbgyotCYsoY yJnAVLs/sAT+j3A9Lx5kV/Jqwjm75erWdQCvEbt10E7dxNS/nq35CdrVf aGBjj9BhULpnVTpktNIGJrUkGgt0c0U36KJwiGpfgqf24ibLgq6fw+kL8 0OiaTayYbJK4ZWWIiGOAqkwFtycnr8ELa00a4z4/Lpfetod4VpES+E+GA g==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="372778654" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="372778654" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 00:10:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="725475870" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="725475870" Received: from power-sh.sh.intel.com ([10.239.183.122]) by FMSMGA003.fm.intel.com with ESMTP; 08 Nov 2022 00:10:06 -0800 From: Zhang Rui To: rjw@rjwysocki.net, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, srinivas.pandruvada@linux.intel.com Subject: [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit Date: Tue, 8 Nov 2022 16:12:19 +0800 Message-Id: <20221108081220.7070-1-rui.zhang@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org When MSR_IA32_TEMPERATURE_TARGET is locked, TCC Offset can not be updated even if the PROGRAMMABE Bit is set. Yield the driver on platforms with MSR_IA32_TEMPERATURE_TARGET locked. Signed-off-by: Zhang Rui --- Note that this patch is made based on this patch series https://patchwork.kernel.org/project/linux-pm/list/?series=693050 --- drivers/thermal/intel/intel_tcc_cooling.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/thermal/intel/intel_tcc_cooling.c b/drivers/thermal/intel/intel_tcc_cooling.c index ccd62358d4d0..f17fa5c81034 100644 --- a/drivers/thermal/intel/intel_tcc_cooling.c +++ b/drivers/thermal/intel/intel_tcc_cooling.c @@ -13,6 +13,7 @@ #include #define TCC_PROGRAMMABLE BIT(30) +#define TCC_LOCKED BIT(31) static struct thermal_cooling_device *tcc_cdev; @@ -80,6 +81,15 @@ static int __init tcc_cooling_init(void) if (!(val & TCC_PROGRAMMABLE)) return -ENODEV; + err = rdmsrl_safe(MSR_IA32_TEMPERATURE_TARGET, &val); + if (err) + return err; + + if (val & TCC_LOCKED) { + pr_info("TCC Offset locked\n"); + return -ENODEV; + } + pr_info("Programmable TCC Offset detected\n"); tcc_cdev = From patchwork Tue Nov 8 08:12:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 13036009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BF30C4332F for ; Tue, 8 Nov 2022 08:10:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232243AbiKHIKQ (ORCPT ); Tue, 8 Nov 2022 03:10:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229843AbiKHIKL (ORCPT ); Tue, 8 Nov 2022 03:10:11 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15CF11EAC7 for ; Tue, 8 Nov 2022 00:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667895010; x=1699431010; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=q68VRlmxVz6ergIR4MTTNT5Xi1IMLxnKBOJewHK+hYQ=; b=IGpQRq6llm81eLNYWf3uEIAWCxcRcI4Qy28CO9MQL8gp56yN6kvcMBTV DDl6VaBRgSPgb4QSQZmhVhmGWjsr50q+CP89JBrskQAioj/wC+qF4SSoB vIOzd2C7W3zQrj1Oi4dySihxo2atfuTHExMO9JPDxv0ZFYf37x8/NovoK WMfKnPYkD4+ZG53ew2ff3Uy1xPSIdkLqb6THhtgFQvk6uBfpnxPIOVuSI JWYSedDJBXz3jk6qRJEyx4qKU0Zh2MtmgpVzeihDwDUVP4uDHdEuYMAnP u79ckgkR7TK/OC282f9xbu1obvBHhs1t7EhbRdpL2wLE9EAiNopQu/jKf w==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="372778666" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="372778666" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 00:10:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="725475882" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="725475882" Received: from power-sh.sh.intel.com ([10.239.183.122]) by FMSMGA003.fm.intel.com with ESMTP; 08 Nov 2022 00:10:08 -0800 From: Zhang Rui To: rjw@rjwysocki.net, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, srinivas.pandruvada@linux.intel.com Subject: [PATCH 2/2] thermal/intel_tcc_cooling: Add TCC cooling support for RaptorLake-S Date: Tue, 8 Nov 2022 16:12:20 +0800 Message-Id: <20221108081220.7070-2-rui.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221108081220.7070-1-rui.zhang@intel.com> References: <20221108081220.7070-1-rui.zhang@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add RaptorLake to the list of processor models supported by the Intel TCC cooling driver. Signed-off-by: Zhang Rui --- drivers/thermal/intel/intel_tcc_cooling.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thermal/intel/intel_tcc_cooling.c b/drivers/thermal/intel/intel_tcc_cooling.c index f17fa5c81034..ec66d32ab24f 100644 --- a/drivers/thermal/intel/intel_tcc_cooling.c +++ b/drivers/thermal/intel/intel_tcc_cooling.c @@ -57,6 +57,7 @@ static const struct x86_cpu_id tcc_ids[] __initconst = { X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, NULL), X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, NULL), X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, NULL), + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, NULL), {} };