From nobody Wed Oct 1 22:26:34 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 28C2E2F360E; Fri, 26 Sep 2025 10:32:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758882741; cv=none; b=dpgdtmBcgCEMdVh2/ylm0ASyZl9QtuyCaWQ9f9ITcEBR62LlIYvzzv7vHjFCka4jyV2RXU38pqGpFcobo2DNbRT6SZCfhbwgbSf93rm2+lqvA+k1azVxf7jm21hp+er8EvbSLjibmqYc2IQlbEqwjiu5jJS/vWW2u+lRM3K+nUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758882741; c=relaxed/simple; bh=bYOt0EaE2kZMgpOBN8Es91AY0CjNsHiL7YOz/ra0dqM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uEIDVw8q0QnJXvB5caAmB/9yB62NQDkAGuA4m95bccusLvkLTVB38Q5dq+PBvNj91sGUiYBtY/21xyhvKaImDLov9rLMKHHDHmggM5MqyIisTM+BtQ3rdzofy+5cingi7Wczi0K5XzLPsPRCss5KyDxpv0KBPm8KWAS3tp8LAPg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JVn17gb2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JVn17gb2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E666C4CEF4; Fri, 26 Sep 2025 10:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758882740; bh=bYOt0EaE2kZMgpOBN8Es91AY0CjNsHiL7YOz/ra0dqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JVn17gb27ClkBFh9M4w1KMvj2eouQu3AsJGiD8SJVY2GdfHJ6hj/lWXUi9CJRnBu6 ZwcBSK60cqaYVmrKzDWieLNT+i7re/ZJ/6QJTgNRFUe3ZQmpXOUpf9A7qmWAw6zgaE bWMYATF3l4WiipzwhWpiJZwRpuFSJv3FmTrG150Vif4AiCsm2Dl9U9BACv+tvavr4d rRDCROTv0Y4BsJGW2+EAHh35Ar6Y4HFsKVmPPQ1iyaosLCpfNYIVZGO4VpIG6Txhl1 MJZwlManWBWBIyclwtk5dkQTgFB6EoB/3v1YR+I6l1JbCa3KtxfS0z/L9XcvZQzYrn 0oIhGAuCUiNow== From: "Rafael J. Wysocki" To: Linux PM Cc: Shawn Guo , Qais Yousef , LKML , Viresh Kumar , Pierre Gondois , Mario Limonciello , Linux ACPI , Jie Zhan Subject: [PATCH v3 2/4] cpufreq: CPPC: Avoid using CPUFREQ_ETERNAL as transition delay Date: Fri, 26 Sep 2025 12:19:41 +0200 Message-ID: <3406003.44csPzL39Z@rafael.j.wysocki> Organization: Linux Kernel Development In-Reply-To: <5069803.31r3eYUQgx@rafael.j.wysocki> References: <5069803.31r3eYUQgx@rafael.j.wysocki> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki If cppc_get_transition_latency() returns CPUFREQ_ETERNAL to indicate a failure to retrieve the transition latency value from the platform firmware, the CPPC cpufreq driver will use that value (converted to microseconds) as the policy transition delay, but it is way too large for any practical use. Address this by making the driver use the cpufreq's default transition latency value (in microseconds) as the transition delay if CPUFREQ_ETERNAL is returned by cppc_get_transition_latency(). Fixes: d4f3388afd48 ("cpufreq / CPPC: Set platform specific transition_dela= y_us") Cc: 5.19+ # 5.19 Signed-off-by: Rafael J. Wysocki Reviewed-by: Mario Limonciello (AMD) Reviewed-by: Jie Zhan --- v1 -> v3: * Change the name of the new function (Jie Zhan) * Add a tag from Mario Limonciello --- drivers/cpufreq/cppc_cpufreq.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -308,6 +308,16 @@ static int cppc_verify_policy(struct cpu return 0; } =20 +static unsigned int __cppc_cpufreq_get_transition_delay_us(unsigned int cp= u) +{ + unsigned int transition_latency_ns =3D cppc_get_transition_latency(cpu); + + if (transition_latency_ns =3D=3D CPUFREQ_ETERNAL) + return CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS / NSEC_PER_USEC; + + return transition_latency_ns / NSEC_PER_USEC; +} + /* * The PCC subspace describes the rate at which platform can accept comman= ds * on the shared PCC channel (including READs which do not count towards f= req @@ -330,12 +340,12 @@ static unsigned int cppc_cpufreq_get_tra return 10000; } } - return cppc_get_transition_latency(cpu) / NSEC_PER_USEC; + return __cppc_cpufreq_get_transition_delay_us(cpu); } #else static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu) { - return cppc_get_transition_latency(cpu) / NSEC_PER_USEC; + return __cppc_cpufreq_get_transition_delay_us(cpu); } #endif