From nobody Thu Oct 2 00:49:30 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 62B23301016; Thu, 25 Sep 2025 15:48:12 +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=1758815292; cv=none; b=l3KejHQJYrK8Q+R1A7K/ExxCWo106iGJQ0lhk3aE/htNi1Vz+c5iyDd6c+phHc+rFOfhZzaf4dFJD9cqlrZHoTGxmhr2EpT/TtIDcVteHtZksjU0cM98xtz/0ZBKS1voU8sIvb3ZeXFL4u6v2RoVheUT/XDwLyJOAGK3b4eVK9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758815292; c=relaxed/simple; bh=vBFv7RjtkXs9t+ZLyfmGh+3RLZDX3C9qbZiRXK6lV18=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sGpq90dHeZONrZJF6YwjFNOSHhM/h8Ngdy1en8ZijGIasYh77ME/YDxSWNuQAp0ik+F/Sl6amHrXiCynZzdieCC9sCE9/bHTmv1k+ovvT/oHqxiJDjut1hrjjTSTpJ8oFRgG2hfyyWCDRpZaOdO5dr5kzuk72L9u8g//PyFRw8k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SeiAN6Aj; 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="SeiAN6Aj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A75BAC4CEF5; Thu, 25 Sep 2025 15:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758815291; bh=vBFv7RjtkXs9t+ZLyfmGh+3RLZDX3C9qbZiRXK6lV18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SeiAN6Aj8MqC2Wi3MGIEtoV2+7kCWGrU51qGHUcVNJT5EGhhqb1Av1mxZn9eVwomY 9MDa7OWqEVLz0uPEb/zLIkaknCUsspKyXAsrqBtC3/Aa2/xlpIJVqVUn3rgSK+Fdux NovjldSsBEIKZlKG9X+Pa6fHizy/i/7MavEfB0JfjQPGtrg0Z7Md6jYTyiAxPosFeb TeznGBHuxt6IULm1bjND2HfK1GxquCMaCe1q9Tyi26B8ImgP02qm7RVmx8Z7Q+H4Wv kmHYEYw2f0KMleISY/+aLCVyjBg+eBdwxwpVRd/TbK9hkU6YCflOf/MTOmnrMFgUBy 5vEtx8DBugAOQ== From: "Rafael J. Wysocki" To: Linux PM Cc: Shawn Guo , Qais Yousef , LKML , Viresh Kumar , Prashanth Prakash , Pierre Gondois , Mario Limonciello , Linux ACPI Subject: [PATCH v1 2/4] cpufreq: CPPC: Avoid using CPUFREQ_ETERNAL as transition delay Date: Thu, 25 Sep 2025 17:44:47 +0200 Message-ID: <22867781.EfDdHjke4D@rafael.j.wysocki> Organization: Linux Kernel Development In-Reply-To: <8605612.T7Z3S40VBb@rafael.j.wysocki> References: <8605612.T7Z3S40VBb@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) > --- --- 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 get_transition_latency_from_cppc(unsigned int cpu) +{ + 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 get_transition_latency_from_cppc(cpu); } #else static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu) { - return cppc_get_transition_latency(cpu) / NSEC_PER_USEC; + return get_transition_latency_from_cppc(cpu); } #endif