From patchwork Wed Jan 31 11:37:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 194703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1824955dyb; Wed, 31 Jan 2024 03:39:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFc29zvenFnWxG3pI0dipYzGH7dBIMQOqNiDrQhtws5O9Sx2m7cYSC+a2q4Dhv9qjfXo1Bx X-Received: by 2002:a17:906:a88f:b0:a29:4267:ac9 with SMTP id ha15-20020a170906a88f00b00a2942670ac9mr883866ejb.52.1706701172544; Wed, 31 Jan 2024 03:39:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706701172; cv=pass; d=google.com; s=arc-20160816; b=tWVsJo/GSMPUfoA02kP+kwIMJhb8/MIDH8MyzMfVjleNOkJjojmLXc/99f1mK2Orj0 PIW8UvZSj2S29yyOYHYhSPmO/Bb7B/OcN6+uAsm/KKjbILEetsB6qq63I76oQ0a5L/+V x1WyN6fPPD717fEbn8T9BHEV/QI6989ODW+mUK5JfLuMb57+ZdVxUxhBPH32sXirJ0Yp LMLR3K9gMEnmoTgL0RxDP67QslQNV/q4RhfoCfn8/fSN0ztpwlgWQG3vEveVdwoXY1lG /6Z+77C295/ekpfWZIPVxJGFqtCCTIfX80pQ1rQt0uikGLrCYLr5a5yfPqvXjuMXzdKO z2Pw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cfci4fakwDjALMhDX4AobiSM7fw1s9fhbnOIAXEp3mU=; fh=201txUgYmkwg4q62p+vn0Cz2GFsbH9n+A8rcw8Ieh8Y=; b=zE1N7rn7ZKZKtNijlUXouRzKQ68dKe2g+XzxSR5J2vf2fSoM5tUJ0KLsYyfsW8t4YN woRnhwv8Wwvnwx4gizgxm5eFTBbcPareCIii5unuVe1FBfWoLOglSBXrOGt6O6rl+GsU hBrDRp6M3Zt6UtTmJEevyf+CcKCaLQ/YVi37fRDWZL1UUtvpSjZLdKekGB6RnN2kfCxF ghHS0GzSy3RregTzEiNWhi8neRo/yYUX9AVOTD9tCjUJflFJIcF3denwr29SAikuyvfM PHgztqOOrs8YnXoY5mmaapiQ0fc66zQlhfDqJexE41pHKqiBfppgXW5LXW9rX5wT05De XhKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gHWjYalG; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46367-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46367-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCU2T/OOuVvsi01SB2x76VN0CHhiRIwL/Ke+8ze1Iy0z+b7tgplAkbKnIZtEBU5MOPqrG1qsfZwnmyV9K5P/ASAViblxDQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id md7-20020a170906ae8700b00a353a6bce7csi4725886ejb.325.2024.01.31.03.39.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 03:39:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46367-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gHWjYalG; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46367-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46367-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 217B41F24D5A for ; Wed, 31 Jan 2024 11:39:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5377B7D412; Wed, 31 Jan 2024 11:37:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gHWjYalG" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0929D6D1D2; Wed, 31 Jan 2024 11:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701050; cv=none; b=K5XPhY5RrIEolWrGIExgV1U+O5MKd1X8eBPWLBq6Kfz6eD7cLF/2S/V+Y36WD5EBNKsLy/0AEtpa+DfXQKUE2DfIYOeuS1wpqkP4ZrfWJvXNv767A548zXgJ7bC4ji+HxcCkhrjZIBOCvtgKvBCBx8iMyLrIT3ebokVeMZY2uqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701050; c=relaxed/simple; bh=GvAqwQ4KOZBh0mXfOdAbuk8oUfo2FkUF0mPuB57A4+4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HAS3gtaaSCo5bfUJNiw/Mb2ZeY6KrUNaYdxL/vP4EEBXxIK/ByeOAdO40dZ0GScMvfW2EJj2OXiaPgkngrSRDn3hHjx+uxj9UbtaTwPUVBn2Odlp84pVuHItdroRmxTo654iFw2uru6XpD/y58AuzCHAUgszLEu+KCABt4zLxFo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gHWjYalG; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706701048; x=1738237048; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GvAqwQ4KOZBh0mXfOdAbuk8oUfo2FkUF0mPuB57A4+4=; b=gHWjYalGxYdoeFDEzjBJyiRO2S3fDrmTNbr9PoYEogwCfTR21QUZe23H pQ/Oorsi+Xgaj9TAjZJYwCIN8+CcP51CZlqLoj0vDPLRVf4NZcXq93TL5 y+XrNusNotfgKq2MKdAd9GVCpNvNS/HpDBeddzlsOYqmg6PY05Cl6g08L lnXQPT2fdGUDbqecj/GkU+eIg73TBlLpLWqdTs4Ji2HMRnMzBd+dKgeIq 87RLWT2gh4QEyHcAKiJeIjwNfl7+RCmFS/I1h1Xg7sXEG/8+MUqg4bi2n IXlKffMmwFw8qBDIZU7jh4L/WeKri7nblnsiFZBwiszBbgQcX1z+iYN3h w==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="3441622" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="3441622" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="788542472" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="788542472" Received: from puhongt-mobl2.ccr.corp.intel.com (HELO rzhang1-mobl7.ccr.corp.intel.com) ([10.255.29.147]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:24 -0800 From: Zhang Rui To: rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 1/6] powercap: intel_rapl: Fix a NULL pointer dereference bug Date: Wed, 31 Jan 2024 19:37:08 +0800 Message-Id: <20240131113713.74779-2-rui.zhang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131113713.74779-1-rui.zhang@intel.com> References: <20240131113713.74779-1-rui.zhang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789605888624760276 X-GMAIL-MSGID: 1789605888624760276 A NULL pointer dereference bug is triggered when probing MMIO RAPL driver on platforms with CPU ID not listed in intel_rapl_common CPU model list. This is because the intel_rapl_common module still probes on such platforms even if 'defaults_msr' is not set after commit 1488ac990ac8 ("powercap: intel_rapl: Allow probing without CPUID match"). Thus the MMIO RAPL rp->priv->defaults is NULL when registering to RAPL framework. Fix the problem by adding sanity check to ensure rp->priv->rapl_defaults is always valid. Fixes: 1488ac990ac8 ("powercap: intel_rapl: Allow probing without CPUID match") Signed-off-by: Zhang Rui Cc: --- drivers/powercap/intel_rapl_common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c index 2feed036c1cd..1a739afd47d9 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -759,6 +759,11 @@ static int rapl_config(struct rapl_package *rp) default: return -EINVAL; } + + /* defaults_msr can be NULL on unsupported platforms */ + if (!rp->priv->defaults || !rp->priv->rpi) + return -ENODEV; + return 0; } From patchwork Wed Jan 31 11:37:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 194719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1838063dyb; Wed, 31 Jan 2024 04:06:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiLlXOiWg4IRcrt24Pr/Cj/HJzbVHoj5uYqB2+80ZNm6RsBUGn0d/L74ESVUYqOvlQdkgS X-Received: by 2002:a17:902:e989:b0:1d7:215a:8061 with SMTP id f9-20020a170902e98900b001d7215a8061mr1204242plb.41.1706702774427; Wed, 31 Jan 2024 04:06:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706702774; cv=pass; d=google.com; s=arc-20160816; b=UVf0AdpMR53KrjSJ1ykb0Ly5EmpIJe7vw5rLA4pvRHjBrE7rBvxniLBM7BddUQAlJc WG5vUp1ChLnBt9PjbtVpOmE2tmOceiBNLE5oVhINQnzDjEFkcw6ncU8g6R2xoPndwoJ0 y4whO0p4CgzSsiMQ8dhFE2MSg26TXboEr7z3QWu84haEsdMJ0HObORjvU5qu4zPMVi4m N2uGqpgA8ZL+lWoJLylROkrtmeihWOovxUuo+3wYdOR8obPk9OZ3cwiqOC3rkuc1i5pc RqoAN++qcmgQk1sjyOZ4HLG6QcrwFKM5MICvoo0sqab/o3ybhPD0p4z4JohunkwPkHjm Vm5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BxY5937P3IQ5JKg6TaXUugDMcXUmJKj2l6nonBCl+Fo=; fh=amzl9pA8FAzzuaoWXj3iKKdZIckevyD1fAA98pmctfU=; b=V+3SHb1JrscJ1M8HmT/xtiVnM1UtiErsaVQ0nxGR6VzvwgTILMVmroG8vMWrA0E54p 57pkbxONTF3Rb9hlzFJ5EcDcMNuu2yt2xGZU5/F9X45CeAO+gpvoPbPvO9UepyxPqPig LF0K3afxI5IkxI8jiUYT8tZfPVoedHFnf/58AvvEXTqXqjgBELYApwv6SRu5iCx8QEwL mEf9YAyPVw3itJvGR1ndEySyGUvC9Hyj5hpA4/DyPsJBvj9rrNr2wr4CmMA01O+OHiqH OEhPFfcrCFL1RluOSkqI6Cbz8snuRJLykgbF/1G9mwNSgJbHX/lMYWozREVOcNWwJElr lA9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G5Hy3ull; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46368-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46368-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCXsi+6Bt4j7md88ozvfRZrzRIstk2jUCrfh9Jg5EFEehMo8Qd4dVIzaASbUGqY1X0Sr41DA9MtYj8m4P77Z5l8uBbeiJg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q10-20020a170902daca00b001d8f6a0fddesi2393766plx.470.2024.01.31.04.06.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 04:06:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46368-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G5Hy3ull; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46368-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46368-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B5DCCB2E7BE for ; Wed, 31 Jan 2024 11:39:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90D137F470; Wed, 31 Jan 2024 11:37:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="G5Hy3ull" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 255B47AE6E; Wed, 31 Jan 2024 11:37:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701050; cv=none; b=sr240/zfkLHC7A6pW/A0oJlwBiS8FwI88d7FmcjpjywPuBcRNKCj7iVj2lmtFMZIQT3rn1XYSBNuTxMdxmyoC9EWvjTB+R63ai+uXWIBE9EH+eVokzRLofDk/a8sOiByJ6qt65LpoG5093mFYVKrl1I1knopGVliA/CoWEeNbSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701050; c=relaxed/simple; bh=HZHQQsIcvY0GIFCdIWOohL5EGPt1hOYTvfZ+z3doboM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uGFQzgGiUGmJ9gcynjgfLa/B68m5F1IvWi5sblSj9cTZSGGO0ONA3hfzkffm2TWeSrFw7xm3+uNOrMUvgex34hd74wBno8qZDdScFFv8z9+K2RQZhYz9SEV7e+XlMaqbB2DZ4LpdPBDABOfRe3XfUc7EPjsuSyRrNoZ4OS1lm3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=G5Hy3ull; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706701049; x=1738237049; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HZHQQsIcvY0GIFCdIWOohL5EGPt1hOYTvfZ+z3doboM=; b=G5Hy3ullwjvLVHqkn1ZIEL62Oxay+osJNpS0ontYmun/JxSQ1pNjG1K6 Tsy7zlkOBLM7VV3vclssHyQlNsp1LchuLAAdgJaFnz6NaimNzbdZiBrmN 2+mVUj4fPxyVvzwf9LoyrX8wkNuP6ldCQgqOfI0c866Cy0iXIm5Kc8gnO 0H+N1pdYzkSg+7YiMp0aHM1UcVUN9EAmgbYzmrVEnqSIZz9JzEOz6OpHD 6B/OFB/OoNu3CIlZaq4X0K0hD/KX6vPnBD+cx9IXpdpfpEPboOdpZyXI9 vwLaZutcID0V7KwVjkdYTTE192CXu+z/nnVAWusT9KE4hyQnsxQ4jdJ76 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="3441625" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="3441625" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="788542479" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="788542479" Received: from puhongt-mobl2.ccr.corp.intel.com (HELO rzhang1-mobl7.ccr.corp.intel.com) ([10.255.29.147]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:25 -0800 From: Zhang Rui To: rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 2/6] powercap: intel_rapl: Fix locking for TPMI RAPL Date: Wed, 31 Jan 2024 19:37:09 +0800 Message-Id: <20240131113713.74779-3-rui.zhang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131113713.74779-1-rui.zhang@intel.com> References: <20240131113713.74779-1-rui.zhang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789607568403693046 X-GMAIL-MSGID: 1789607568403693046 RAPL framework uses CPU hotplug lock to protect rapl_packages list and rp->lead_cpu to guarantee that 1. the RAPL package device is not unprobed and freed 2. the cached rp->lead_cpu is always valid for operations like powercap sysfs accesses. Current RAPL APIs assume they are called from CPU hotplug callbacks which hold the CPU hotplug lock. But TPMI RAPL driver invokes the APIs in the driver' .probe() function without CPU hotplug lock held. Fix the problem by providing both locked and lockless version RAPL APIs. Fixes: 9eef7f9da928 ("powercap: intel_rapl: Introduce RAPL TPMI interface driver") Signed-off-by: Zhang Rui --- drivers/powercap/intel_rapl_common.c | 29 +++++++++++++++++-- drivers/powercap/intel_rapl_msr.c | 8 ++--- .../int340x_thermal/processor_thermal_rapl.c | 8 ++--- include/linux/intel_rapl.h | 6 ++++ 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c index 1a739afd47d9..9d3e102f1a76 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -5,6 +5,7 @@ */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -1504,7 +1505,7 @@ static int rapl_detect_domains(struct rapl_package *rp) } /* called from CPU hotplug notifier, hotplug lock held */ -void rapl_remove_package(struct rapl_package *rp) +void rapl_remove_package_cpuslocked(struct rapl_package *rp) { struct rapl_domain *rd, *rd_package = NULL; @@ -1533,10 +1534,18 @@ void rapl_remove_package(struct rapl_package *rp) list_del(&rp->plist); kfree(rp); } +EXPORT_SYMBOL_GPL(rapl_remove_package_cpuslocked); + +void rapl_remove_package(struct rapl_package *rp) +{ + guard(cpus_read_lock)(); + rapl_remove_package_cpuslocked(rp); +} EXPORT_SYMBOL_GPL(rapl_remove_package); /* caller to ensure CPU hotplug lock is held */ -struct rapl_package *rapl_find_package_domain(int id, struct rapl_if_priv *priv, bool id_is_cpu) +struct rapl_package *rapl_find_package_domain_cpuslocked(int id, struct rapl_if_priv *priv, + bool id_is_cpu) { struct rapl_package *rp; int uid; @@ -1554,10 +1563,17 @@ struct rapl_package *rapl_find_package_domain(int id, struct rapl_if_priv *priv, return NULL; } +EXPORT_SYMBOL_GPL(rapl_find_package_domain_cpuslocked); + +struct rapl_package *rapl_find_package_domain(int id, struct rapl_if_priv *priv, bool id_is_cpu) +{ + guard(cpus_read_lock)(); + return rapl_find_package_domain_cpuslocked(id, priv, id_is_cpu); +} EXPORT_SYMBOL_GPL(rapl_find_package_domain); /* called from CPU hotplug notifier, hotplug lock held */ -struct rapl_package *rapl_add_package(int id, struct rapl_if_priv *priv, bool id_is_cpu) +struct rapl_package *rapl_add_package_cpuslocked(int id, struct rapl_if_priv *priv, bool id_is_cpu) { struct rapl_package *rp; int ret; @@ -1603,6 +1619,13 @@ struct rapl_package *rapl_add_package(int id, struct rapl_if_priv *priv, bool id kfree(rp); return ERR_PTR(ret); } +EXPORT_SYMBOL_GPL(rapl_add_package_cpuslocked); + +struct rapl_package *rapl_add_package(int id, struct rapl_if_priv *priv, bool id_is_cpu) +{ + guard(cpus_read_lock)(); + return rapl_add_package_cpuslocked(id, priv, id_is_cpu); +} EXPORT_SYMBOL_GPL(rapl_add_package); static void power_limit_state_save(void) diff --git a/drivers/powercap/intel_rapl_msr.c b/drivers/powercap/intel_rapl_msr.c index 250bd41a588c..b4b6930cacb0 100644 --- a/drivers/powercap/intel_rapl_msr.c +++ b/drivers/powercap/intel_rapl_msr.c @@ -73,9 +73,9 @@ static int rapl_cpu_online(unsigned int cpu) { struct rapl_package *rp; - rp = rapl_find_package_domain(cpu, rapl_msr_priv, true); + rp = rapl_find_package_domain_cpuslocked(cpu, rapl_msr_priv, true); if (!rp) { - rp = rapl_add_package(cpu, rapl_msr_priv, true); + rp = rapl_add_package_cpuslocked(cpu, rapl_msr_priv, true); if (IS_ERR(rp)) return PTR_ERR(rp); } @@ -88,14 +88,14 @@ static int rapl_cpu_down_prep(unsigned int cpu) struct rapl_package *rp; int lead_cpu; - rp = rapl_find_package_domain(cpu, rapl_msr_priv, true); + rp = rapl_find_package_domain_cpuslocked(cpu, rapl_msr_priv, true); if (!rp) return 0; cpumask_clear_cpu(cpu, &rp->cpumask); lead_cpu = cpumask_first(&rp->cpumask); if (lead_cpu >= nr_cpu_ids) - rapl_remove_package(rp); + rapl_remove_package_cpuslocked(rp); else if (rp->lead_cpu == cpu) rp->lead_cpu = lead_cpu; return 0; diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c index 2f00fc3bf274..e964a9375722 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c @@ -27,9 +27,9 @@ static int rapl_mmio_cpu_online(unsigned int cpu) if (topology_physical_package_id(cpu)) return 0; - rp = rapl_find_package_domain(cpu, &rapl_mmio_priv, true); + rp = rapl_find_package_domain_cpuslocked(cpu, &rapl_mmio_priv, true); if (!rp) { - rp = rapl_add_package(cpu, &rapl_mmio_priv, true); + rp = rapl_add_package_cpuslocked(cpu, &rapl_mmio_priv, true); if (IS_ERR(rp)) return PTR_ERR(rp); } @@ -42,14 +42,14 @@ static int rapl_mmio_cpu_down_prep(unsigned int cpu) struct rapl_package *rp; int lead_cpu; - rp = rapl_find_package_domain(cpu, &rapl_mmio_priv, true); + rp = rapl_find_package_domain_cpuslocked(cpu, &rapl_mmio_priv, true); if (!rp) return 0; cpumask_clear_cpu(cpu, &rp->cpumask); lead_cpu = cpumask_first(&rp->cpumask); if (lead_cpu >= nr_cpu_ids) - rapl_remove_package(rp); + rapl_remove_package_cpuslocked(rp); else if (rp->lead_cpu == cpu) rp->lead_cpu = lead_cpu; return 0; diff --git a/include/linux/intel_rapl.h b/include/linux/intel_rapl.h index 33f21bd85dbf..f3196f82fd8a 100644 --- a/include/linux/intel_rapl.h +++ b/include/linux/intel_rapl.h @@ -178,6 +178,12 @@ struct rapl_package { struct rapl_if_priv *priv; }; +struct rapl_package *rapl_find_package_domain_cpuslocked(int id, struct rapl_if_priv *priv, + bool id_is_cpu); +struct rapl_package *rapl_add_package_cpuslocked(int id, struct rapl_if_priv *priv, + bool id_is_cpu); +void rapl_remove_package_cpuslocked(struct rapl_package *rp); + struct rapl_package *rapl_find_package_domain(int id, struct rapl_if_priv *priv, bool id_is_cpu); struct rapl_package *rapl_add_package(int id, struct rapl_if_priv *priv, bool id_is_cpu); void rapl_remove_package(struct rapl_package *rp); From patchwork Wed Jan 31 11:37:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 194713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1827879dyb; Wed, 31 Jan 2024 03:45:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRmeaK8MGie4Z4P3nlB6XGo+sH5mDRN5iywgtZUe8YXy9RyL+7dEk7xoovDAOSpxYEMRlb X-Received: by 2002:a9d:7758:0:b0:6dd:efff:d7db with SMTP id t24-20020a9d7758000000b006ddefffd7dbmr1089247otl.20.1706701557722; Wed, 31 Jan 2024 03:45:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706701557; cv=pass; d=google.com; s=arc-20160816; b=r0qfo4ASVocB1H1Nac4p0sDWTJZ1zlgic22rTq+jLJ946xZ5Oa16qIBd7WsRSJSrn/ DOtUuFQl+EC0Ux5naLwE3Q7humbQbuGf7L758qOut+z+juhiD9/9ebHQMFiopoyEm0rY gle3ACShcDW4Ri+71uyU950J0yyZohrrfT3G9TnleXvS1tm4hvypu4nn1punwaHsh4xg Lt7WCXnpN179OnAJrw6kn+Y+aUQXtpaODGPMsuYucotOGtgEutOIvFSZQox8AAJ4gKYR lDV2Zb7L+Pvv0kr0sik8kotepXikiOY15c2HLu+HzD8q72eT/8XHzwcwEHhmR1mawLUw v08Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xOR0Uzc/MaOo+91OJ+LOBe455qndQyU5Dk/RZAlzJZg=; fh=LApksBCTBlhWGfjZQ6UeNHy/jh04xXillon7KuuhImU=; b=qufsUajpAVrm4FxTHHlqixxObxzvkeODfoy5SJVNRfVHR2QKUpO3tBkuKWmj38lBtP Nb8iAkhnsgKfHV+VJdZ1REGpYAfHT/v5Iy721npNyEyOk7MBhXzt754F7vq/MikVZvWy Ba9jxAkykAUJ2QQYJ1QQzwwUyaMF2aw/Gy80q5+jvTrAzS6zPskQKcaI+JSz+yl+Bj2d YTtxhLekwmRka4b23ejQucMVd6va8Q+XhL85VzRZ7RU0pCEtyYh4oGYheuCm2mwc36tD ebCUA4/oLvPBC5BZXZw/7V+5ANIMgtqoW/8khkc6CeyLyBcIn3Su21VMffE7/kmjrHrD M5Zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IkpR5TKt; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46369-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46369-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCV9W4aCfrxShP3ojv78i/Qc1/wyMNSxIe6V5yrFKM0i35KknSsmUxlC98YkB1Vjii1cgmkN7GB2DjrN4Ebt6mfjogw4CQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id gu5-20020a056a004e4500b006ddd08fa3d2si9316895pfb.247.2024.01.31.03.45.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 03:45:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46369-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IkpR5TKt; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46369-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46369-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CF59728BD90 for ; Wed, 31 Jan 2024 11:40:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBFF07F462; Wed, 31 Jan 2024 11:37:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IkpR5TKt" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68FF07B3D1; Wed, 31 Jan 2024 11:37:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701053; cv=none; b=nyot7oZDQHgpp4KkYKH7y33uoh3HsMFwTjTTA98rVrpNqDrQPJqsMLYyyaMlozYs+MVtAnWTxtvkca/4Ji9l0gYyhvXDEswW71s01e3QjhnTNj/USzon3DAZlrfGjHc3bB0ahE3cmnn0HC+a4bHy7ANemiAhtMXnB1urSp6e6+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701053; c=relaxed/simple; bh=VbGVsMvlR6qLCq5piw4v45/5b+9I9zsshnAjLePRsqA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OYV8vcANEIixbthTTIdXXWw4B2VoLhTyUeonq06031wL4XLahv/WZwKuu+/QaGPNbOuT203ckDWNTVtcbMob2vg7Cz5hQO0FQ29HlT7Yu35fhyYXq8r1ng6AlmrmDxxdJvkOro3myqvvnYxiz01y38nmiDAMi3IER8OZ/8oizps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IkpR5TKt; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706701050; x=1738237050; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VbGVsMvlR6qLCq5piw4v45/5b+9I9zsshnAjLePRsqA=; b=IkpR5TKtYFISiqvNHGBdb8CfScpggzwA1JrXKV5e83AofD9N/+Enn76m Izd7jxwpUNnQBn+sYkRhhvXvMiqDmyWkUUiqOgFIWuc/Mpr6IeIwwjjbk vCV5/j8SPl9gf/ocNx1zbuscRBSZEi42wSFbFmngZ5xilnvP3IIgjVq9i bmwB3jKEQEbaP2DxBOFqDY8o90CXSLLYLWdOaajUVQi7mCyxqIwOu5AKc j2NR0kqooHGW8djN7IvLJITkuXcFSh24pKhG0kbhsyxpIcrFllSnMysTy fS4QVsLRFNm/Zes9PklF28qainUlVIhf9O8Q/gKZDgOLAWXUOyVH5MPD5 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="3441637" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="3441637" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="788542488" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="788542488" Received: from puhongt-mobl2.ccr.corp.intel.com (HELO rzhang1-mobl7.ccr.corp.intel.com) ([10.255.29.147]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:28 -0800 From: Zhang Rui To: rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 3/6] powercap: intel_rapl_tpmi: Fix a register bug Date: Wed, 31 Jan 2024 19:37:10 +0800 Message-Id: <20240131113713.74779-4-rui.zhang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131113713.74779-1-rui.zhang@intel.com> References: <20240131113713.74779-1-rui.zhang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789606292362473950 X-GMAIL-MSGID: 1789606292362473950 Add the missing Domain Info register. This also fixes the bogus definition of the Interrupt register. Neither of these two registers was used previously. Fixes: 9eef7f9da928 ("powercap: intel_rapl: Introduce RAPL TPMI interface driver") Signed-off-by: Zhang Rui --- drivers/powercap/intel_rapl_tpmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/powercap/intel_rapl_tpmi.c b/drivers/powercap/intel_rapl_tpmi.c index 891c90fefd8b..f1c734ac3c34 100644 --- a/drivers/powercap/intel_rapl_tpmi.c +++ b/drivers/powercap/intel_rapl_tpmi.c @@ -40,6 +40,7 @@ enum tpmi_rapl_register { TPMI_RAPL_REG_ENERGY_STATUS, TPMI_RAPL_REG_PERF_STATUS, TPMI_RAPL_REG_POWER_INFO, + TPMI_RAPL_REG_DOMAIN_INFO, TPMI_RAPL_REG_INTERRUPT, TPMI_RAPL_REG_MAX = 15, }; From patchwork Wed Jan 31 11:37:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 194714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1827940dyb; Wed, 31 Jan 2024 03:46:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1FvBVuSW4Lg3iYwr8OuTtSEuk1uRBYCifONJbe0b8Xh9UEhVbmCPDFazU2Nizu7gMzJx3 X-Received: by 2002:a17:903:246:b0:1d7:147d:6a1d with SMTP id j6-20020a170903024600b001d7147d6a1dmr1209417plh.55.1706701565089; Wed, 31 Jan 2024 03:46:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706701565; cv=pass; d=google.com; s=arc-20160816; b=VPjIzqrBqM9IynJZ6DsZz7Jy2c3qB4qpgj+jTKGKNAITq/8L8g2B6nDYfGStaNzKAB 9uGlGNy9DePr/S6nnTHZf8tgAg3LMDKG1OJcPjj2rSKU9RdSmi+8gIXTe2TNSemesQBz 6Itc94B1h7x/3VbMNRB/oyqPkdXY45k2dCMX4SGPG2J7b1p1+hZG+lrV4S3oGHHM4OoR okY5HPaUeWt07uCI/WC930S3rn06QrUBu/po5BlRTNVN+0/qY33ncf94iyrLs0KuXBOm ulANGaJozEy9Na1nVd2T/PgqyzLxuopHOYv5s8KWbLCsLiy6QiKLXOIO8TKUGpflRbFE h1aw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yJPCAMz/vMA4HmQMU0bc0iPvmSl0aRSnV4b75I8QiDo=; fh=UFrNadGS6KSrMLseDSc/ysdZ+Drkb91EZyNUrwGhaRY=; b=BDQ8eYyt6WIYsWDaX7ExTDP93LMInWbrxq+CMa2Vv/4RgKkwej8romJoHCgt4/k3D6 297J7xBIZoZBDSdFtUnbTpff01klZRRah4GnfkY3CpehU57K2271EitKpDYX4Rv6hcXI ZbrqZ/wR/NDV+EqyhKcD712ZXYa7phedkYAOPT9L0BUigv68WeSSCLycdFTCmxYv6SJf xMOZTivcsNEVMIBININC6IuEMCOpfo08eMrsNdXlVHBWL+6jZoSlH1lCCKmdBcmnURfC qkD9HFlMZiWmpGCUKlSfQ/OCGryyyjiQJrkRERdVnPq6sgywzrvFR2Kfw1lP4CngBTON NJyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NHR3II2i; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46370-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46370-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCVVowOj8HaJuK8Nx25TmEeCkkai8ourBMOCQVY+SuCSSq60d3cxBgm8O8w70MM0lBRddYzxXpPbBVmmLUzi2fE+pG0hGA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p15-20020a170902e74f00b001d7271fb159si5540212plf.105.2024.01.31.03.46.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 03:46:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46370-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NHR3II2i; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46370-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46370-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1CC0528B25F for ; Wed, 31 Jan 2024 11:40:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E918780BE9; Wed, 31 Jan 2024 11:37:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NHR3II2i" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 876A47D3F5; Wed, 31 Jan 2024 11:37:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701054; cv=none; b=oLvF6Hnrsb4RXWJgtgTAY+jjf7DrPquUa/F1W7DkxIpcr2jQ22VAbo3uP/hyl4hGEW56h1QvXbF8jNXuAPxVXeoJ7yyhEMZSJRnWpBUjFG8WEfTali0dkxm/7u2G0Pw+mrSU8iK0yIUsLy7/uhFpavAUSK9RQ5jwnpwFmFPJL9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701054; c=relaxed/simple; bh=qqS366ENXAObLZelQMQdQKQUmZl5yUdXm3AHKjxtXp8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pKXo3mT1OmHRrtzGw8iuh8L1W0x7azL/TdU++9d6+ZeDtE+BhjkVkXKb3vNSSdL9fx1hFp0Kv27nScrLjL+AepewBV8N7C7LZ6IisB5grxDvv65Zyd0yAtqOeYzV4Npu2mqsHatsqm9jtiyRpa6fyD0iTuvS/VJJ3/rTErv5iNI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NHR3II2i; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706701052; x=1738237052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qqS366ENXAObLZelQMQdQKQUmZl5yUdXm3AHKjxtXp8=; b=NHR3II2ioMEs+bVqqettnbQe1SUBQs1ykmOX3+/25PrHVgi4uX7eKwEB Myj5ylSeOXCbM7YmYyvKU9nZowHWniNPjZj9h3KLipgVSjl0LxNnLtdus rH3A3RGIIsPv4+84ZwIoMYH/7o54Z9+LQNS+ewjBHPOXIoJZXuW7K+ySs uMXW9kcUcWH+AakuNb/YV8lqyF5B+fgWQNCSuD3azTjTLEYerUc/om3tG 5r41Ryq9ahxN/EDcc3pS8nuJnmavOaN8EPCTtsjwVrfX70Hp23DWiWLYd j2dcfDvXW/Ko9U3knbBStfy8i9zbJAQ8rHt62aAC8/SRs/KsYFijyq3Vj Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="3441644" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="3441644" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="788542498" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="788542498" Received: from puhongt-mobl2.ccr.corp.intel.com (HELO rzhang1-mobl7.ccr.corp.intel.com) ([10.255.29.147]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:30 -0800 From: Zhang Rui To: rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 4/6] powercap: intel_rapl_tpmi: Fix System Domain probing Date: Wed, 31 Jan 2024 19:37:11 +0800 Message-Id: <20240131113713.74779-5-rui.zhang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131113713.74779-1-rui.zhang@intel.com> References: <20240131113713.74779-1-rui.zhang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789606300552025945 X-GMAIL-MSGID: 1789606300552025945 Only domain root packages can enumerate System (Psys) domain. Whether a package is domain root or not is described in the Bit 0 of the Domain Info register. Add support for Domain Info register and fix the System domain probing accordingly. Fixes: 9eef7f9da928 ("powercap: intel_rapl: Introduce RAPL TPMI interface driver") Signed-off-by: Zhang Rui --- drivers/powercap/intel_rapl_tpmi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/powercap/intel_rapl_tpmi.c b/drivers/powercap/intel_rapl_tpmi.c index f1c734ac3c34..f6b7f085977c 100644 --- a/drivers/powercap/intel_rapl_tpmi.c +++ b/drivers/powercap/intel_rapl_tpmi.c @@ -131,6 +131,12 @@ static void trp_release(struct tpmi_rapl_package *trp) mutex_unlock(&tpmi_rapl_lock); } +/* + * Bit 0 of TPMI_RAPL_REG_DOMAIN_INFO indicates if the current package is a domain + * root or not. Only domain root packages can enumerate System (Psys) Domain. + */ +#define TPMI_RAPL_DOMAIN_ROOT BIT(0) + static int parse_one_domain(struct tpmi_rapl_package *trp, u32 offset) { u8 tpmi_domain_version; @@ -140,6 +146,7 @@ static int parse_one_domain(struct tpmi_rapl_package *trp, u32 offset) enum rapl_domain_reg_id reg_id; int tpmi_domain_size, tpmi_domain_flags; u64 tpmi_domain_header = readq(trp->base + offset); + u64 tpmi_domain_info; /* Domain Parent bits are ignored for now */ tpmi_domain_version = tpmi_domain_header & 0xff; @@ -170,6 +177,13 @@ static int parse_one_domain(struct tpmi_rapl_package *trp, u32 offset) domain_type = RAPL_DOMAIN_PACKAGE; break; case TPMI_RAPL_DOMAIN_SYSTEM: + if (!(tpmi_domain_flags & BIT(TPMI_RAPL_REG_DOMAIN_INFO))) { + pr_warn(FW_BUG "System domain must support Domain Info register\n"); + return -ENODEV; + } + tpmi_domain_info = readq(trp->base + offset + TPMI_RAPL_REG_DOMAIN_INFO); + if (!(tpmi_domain_info & TPMI_RAPL_DOMAIN_ROOT)) + return 0; domain_type = RAPL_DOMAIN_PLATFORM; break; case TPMI_RAPL_DOMAIN_MEMORY: From patchwork Wed Jan 31 11:37:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 194720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1838248dyb; Wed, 31 Jan 2024 04:06:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0y3UA1u2Hq5/6ZDeo1p5o4NA8Jv5JSYB6AUWSiM0h2Wyc3vo0tppSouFzrbOk1gFG9N4A X-Received: by 2002:a17:902:ea11:b0:1d5:8ce6:e4b1 with SMTP id s17-20020a170902ea1100b001d58ce6e4b1mr1605073plg.43.1706702789734; Wed, 31 Jan 2024 04:06:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706702789; cv=pass; d=google.com; s=arc-20160816; b=cWggAVlo7FG2LCbc1Vyq31PHby4cl+xm25aUfKLzcy9UDvalNuwLUgaxiQNEzMiJXC atoaA6Lz21JEu0QLziExxdFpYc4O2Ee47TFseIMh2D4STYOadDj3CSY+KRFccgo4uwWg /ncDNOgEIMBob6QVSGBBSigOQRjFfYFu3+U+ti1thuVFLR+ocz7eGd/7b5eHT+irvP6r 8atVQaVsF+fIQQ0R5frg/SF9iN+FpoIqdBUgpSyjPW7yebkP++beTJvNlzLN+2eUU79k /DxdiJChjzfh2i3OuFadqy/N4kRJYM1H8X20j9YvwaTW8N/NCskNrVKgDi5T74AS/QBz Qx+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=niUHG07VD4U56pqJCwF84UwYFVXf6dNDA5Oc+cOUFOk=; fh=fgWK+xfOwQaVEY77b0Iw8iJqqkQx0GrjQbELgc3v/2w=; b=HHWnv+q2u7O5wc3cyBJzwP6Ebl+kOjs7Hh2NwLNp/04GFdOMcrKziG3L1Lh/SwIZi5 7lQFUn1qTO8QYg4yGCeByPXoBw+HczxkAyKqGWzgsodNNzUAqIH8GVtE1uOSMQ9cNaE0 dbdW8pWhFqy9uFrVhJr0oK/jrCGCO/mY/NhRgxS2/dpl9xL/dwQXmasnnfA0i5wRzj71 56ebV/CcOmvRelhqM/NcOO8tjbR65IhtsIDSlaMaEB9tskeC+dqeXADIecYitXu/VF3t 7Imblcbha0D5O2A6l3qv1UU8wpnqkQb0w4mL8/bhnP9/wjW3776cGIWgXAmmp1Jm490u 7rEQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BqKh7eAg; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46371-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46371-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCVjcH3SOVo9wethdumtCGF9q2/i/hcpNMo/XYIBqlZFH3ob31GxFC/HcTe2dW0euT4rV7HuoNsMh3Vjlzr5Uk7jb+VPrg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s1-20020a170902c64100b001d90a16c013si3054544pls.616.2024.01.31.04.06.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 04:06:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46371-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BqKh7eAg; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46371-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46371-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E7EE4B3209C for ; Wed, 31 Jan 2024 11:40:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A4A680C03; Wed, 31 Jan 2024 11:37:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BqKh7eAg" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 283B57F464; Wed, 31 Jan 2024 11:37:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701055; cv=none; b=gxAH70iaxXVGjmdgl+yiygK/ZpKarFj9PT3kIP40UvFdfSMoCRYwYzKdtM7RVB35L6FP8rYr0O75HA+JatIB3L4oJFpVuKtpIcKBsYshlatI0zNQamg7LoJiB6aMTdPWI3g6UpZVDRALIvV7I4i0aCkzfkuPcXLsMavooD8oQEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701055; c=relaxed/simple; bh=+7P8ooaYXamG1JjYcGUuE0lFs56ZdtWnnIGwXoN49QA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Dkzeb/y/iIcv7uWtvF5AoIYlaFq0PlFAk6ehnKLoJx0FNgFexrdJXBdbQioBOt0XVX8TunIEw8195v6LpFX9SotaeBO2EziE24H/SCbNzdBF5QBuybi9rf4FvdcsSVnq8sF/mtNqPYFeqbFgeN17M9M20XFBqVOXXFTU3ETz3I8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BqKh7eAg; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706701054; x=1738237054; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+7P8ooaYXamG1JjYcGUuE0lFs56ZdtWnnIGwXoN49QA=; b=BqKh7eAgCgZr7AvFXy2F0bLxMXltNFq/VlgKaSNQB8q28FP9AanHvufJ EdNDmn0FBrjPKJHxMk+7XySGDLM2x2cgVho6SKrvoDauu2jk5PLCfDb2P 9pzfYtP6CDf79a1mQR/dNIhitLamdtmRxmnsx/qwZhICg6i5JYWJheU6W VFQpXwUcV/bpmgH+V9Nth6jEMD5m4Lao/NqHRWi+yx73+6CmkyNUYNDww OeBJDLRxJOKCl4SDRB0If6i5NfxTqNpwVGr5k8ClOZnfSLwSyjnXtu/kc 5DIFtcwFjE1suPi+GyupzufSWoAVYqpSJBFndsq1WHaAZYX4d8bgTFLfV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="3441658" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="3441658" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="788542507" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="788542507" Received: from puhongt-mobl2.ccr.corp.intel.com (HELO rzhang1-mobl7.ccr.corp.intel.com) ([10.255.29.147]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:32 -0800 From: Zhang Rui To: rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 5/6] powercap: intel_rapl: Add support for LNL-M paltform Date: Wed, 31 Jan 2024 19:37:12 +0800 Message-Id: <20240131113713.74779-6-rui.zhang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131113713.74779-1-rui.zhang@intel.com> References: <20240131113713.74779-1-rui.zhang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789607584707329877 X-GMAIL-MSGID: 1789607584707329877 Add support for LNL-M platform. Signed-off-by: Zhang Rui --- drivers/powercap/intel_rapl_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c index 9d3e102f1a76..a3094cb9f296 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -1262,6 +1262,7 @@ static const struct x86_cpu_id rapl_ids[] __initconst = { X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server), X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &rapl_defaults_spr_server), + X86_MATCH_INTEL_FAM6_MODEL(LUNARLAKE_M, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt), From patchwork Wed Jan 31 11:37:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 194721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1838735dyb; Wed, 31 Jan 2024 04:07:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYDGR6ShlNYa4uS/RHGeeyRv1dRqgA3mODWiBfk4m0SfQflxsD/+cdScAlbWQ8UrXQ1mTk X-Received: by 2002:a17:90b:38c7:b0:294:2c87:279b with SMTP id nn7-20020a17090b38c700b002942c87279bmr1099768pjb.49.1706702835647; Wed, 31 Jan 2024 04:07:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706702835; cv=pass; d=google.com; s=arc-20160816; b=pBEvlKjs4But5kUfzX8Zd5vNDmy9a9rDbw82sFRvwpqHw+sHB2Glua8fGWS25A5mhN 5Yh2ytWFzSzWcbz4ZA4vdYq9Jtv84tQh7BTghLtaQQ7Jw0OyS/coLY94PFREaQ9egH+L gn0uBTSA3VD4VDekGTdm+ZYffgciYzcNA6UtpF43TJfrhhCk0SlweHYnn06i+CjceB+T zhYAX7Oart2KatNQwuJ6/9qCFtKk7Pn/1YZlq0F9h/ymNIiqYI5U1HP+abBoXf8xXkTa iunNFW8/SRLsTFo4p06xrBKK5pX7T5Tif6xVotSHfCYl6+AA6jqaxt94zmLrmtJezYRR Lo+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UGcZWJJLd0qjta+SfyGLaUVe/FwcajkxfTkTNmE/xjk=; fh=4n6zx/066rNkFp03OD4iobceKWXI27vSS/YnD5J8Es0=; b=Mwc4FwIBTJ8s05lQ/cIQYRnSPZolg5XzyQaSFMU95FN4kC7QfG/Z3E+cgvJf5hqura 83RdHdZLaK/u+JC7LXRJQ/8mEZ3RZrakHLIU+i3bmV714ezowe8+ZBVIrdX9aSeTKgfH FqMKfAzmoYZz9I01qiFlMkoNtiXjJ2qW4bEyDph48POfKNiQBoVMzxVvIgi3mlCFkvdY wv3Jmlnu7ShVbsuwh3e+FmQNL6Ptw6Rp3YX2Y1bjcE5QpC+OXY46PCBlQbmtknSyhe8D EiayEWP6FDWqCws8UJx7inc/v5hU0Ji6zAc/kkfa4ZT0Rx8FTBMNwa1lke+UNpS+wjIU OH4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PWoGmA+u; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46372-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46372-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCVrM0ye75qBkCJoCP9B0vmXN3/KoceKIHikliVtf1aEN3qU8zzFUUk/fTTokJytNTNYs50/BdHvBgtMoF3QFH6QI+/BCg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s1-20020a170902c64100b001d90a16c013si3054544pls.616.2024.01.31.04.07.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 04:07:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46372-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PWoGmA+u; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46372-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46372-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 22960B3234C for ; Wed, 31 Jan 2024 11:40:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9177080C16; Wed, 31 Jan 2024 11:37:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PWoGmA+u" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 417887F7F4; Wed, 31 Jan 2024 11:37:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701057; cv=none; b=YDr8efGtvyAzhdUwv41nyZLFb2Xig41tbWXNUsCkBJ1zwxq04P/HHSkoOvX0ALJpUCdFOZ6tKN0r6E8WygmrfWJEW7V0Cj2zYxi0hq/2j9G89m08TR4Vi5hIJnLOc6xndxd7C38ARG0z5fNCDrdMhDYTTSDCI2z6l8ihRn3Okps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701057; c=relaxed/simple; bh=3wEv6gpWu5XkRdhubo8bpcen3Ln1BI1Vmy7qOX9Tb8Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=blvgaMhaNLdJgYKyK9nZr/PZ/oXcN0TJbday+RGxNU8aiH2QoWHu+1ZfbnSN34kgJjuQQtu6VXs1OH/n7l20Wx+7C8h7JMUOpp4q9K4eMsOs1GF01hF5j7cgJKlxCaaA4HAYpZEG83NJTUcvHxiTKxCsEMEmSfTIgk8t0uzP9Z4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PWoGmA+u; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706701056; x=1738237056; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3wEv6gpWu5XkRdhubo8bpcen3Ln1BI1Vmy7qOX9Tb8Q=; b=PWoGmA+uYHsazKEu4TwaRCI+xJ3HS5Y/eAs/3UF3uayNScJRzp2jTy9f Il+IkcpG+ZXSjS1SDM5x0BZDk8SdysfHkhx9kNXL3lO3RAqbQsVth5ET+ wzrOtZCWBiIK9kX8BnTEjHL59dnGKzQjTddUFREKRKUgOhnSza3KYN9H+ L9a3rxo2KZEpNc0/WgKRBB+ATdOI8Vhi/vcF3X0sLvuw+HPiTltGfKJXQ bQUNCR4rfYSpEDXU3o14jgpDnHct/o/7Fdy4vUa4JcMW9DRy9DNAqJsHJ IzTzZf++X55bwzWv5hzEDMLYDYE7O13v/2Z7FMs2JYfoI+VnV4FNwhor/ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="3441668" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="3441668" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="788542511" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="788542511" Received: from puhongt-mobl2.ccr.corp.intel.com (HELO rzhang1-mobl7.ccr.corp.intel.com) ([10.255.29.147]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:37:34 -0800 From: Zhang Rui To: rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 6/6] powercap: intel_rapl: add support for Arrow Lake Date: Wed, 31 Jan 2024 19:37:13 +0800 Message-Id: <20240131113713.74779-7-rui.zhang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131113713.74779-1-rui.zhang@intel.com> References: <20240131113713.74779-1-rui.zhang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789607632295792286 X-GMAIL-MSGID: 1789607632295792286 From: Sumeet Pawnikar Add support for LNL-M platform. Signed-off-by: Sumeet Pawnikar --- drivers/powercap/intel_rapl_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c index a3094cb9f296..aa627a6b12a4 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -1263,6 +1263,7 @@ static const struct x86_cpu_id rapl_ids[] __initconst = { X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server), X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &rapl_defaults_spr_server), X86_MATCH_INTEL_FAM6_MODEL(LUNARLAKE_M, &rapl_defaults_core), + X86_MATCH_INTEL_FAM6_MODEL(ARROWLAKE, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt),