From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>,
Qais Yousef <qyousef@layalina.io>,
LKML <linux-kernel@vger.kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Prashanth Prakash <pprakash@codeaurora.org>,
Pierre Gondois <pierre.gondois@arm.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Linux ACPI <linux-acpi@vger.kernel.org>
Subject: [PATCH v1 3/4] ACPI: CPPC: Replace CPUFREQ_ETERNAL with CPPC-specific symbol
Date: Thu, 25 Sep 2025 17:46:27 +0200 [thread overview]
Message-ID: <3925838.kQq0lBPeGt@rafael.j.wysocki> (raw)
In-Reply-To: <8605612.T7Z3S40VBb@rafael.j.wysocki>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Instead of using CPUFREQ_ETERNAL for signaling error conditions in
cppc_get_transition_latency(), introduce CPPC_NO_DATA specifically
for this purpose and update all of the callers of this function to
use it.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/cppc_acpi.c | 6 +++---
drivers/cpufreq/amd-pstate.c | 4 ++--
drivers/cpufreq/cppc_cpufreq.c | 2 +-
include/acpi/cppc_acpi.h | 4 +++-
include/linux/cpufreq.h | 3 ---
5 files changed, 9 insertions(+), 10 deletions(-)
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -1897,16 +1897,16 @@ unsigned int cppc_get_transition_latency
cpc_desc = per_cpu(cpc_desc_ptr, cpu_num);
if (!cpc_desc)
- return CPUFREQ_ETERNAL;
+ return CPPC_NO_DATA;
desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF];
if (CPC_IN_SYSTEM_MEMORY(desired_reg) || CPC_IN_SYSTEM_IO(desired_reg))
return 0;
else if (!CPC_IN_PCC(desired_reg))
- return CPUFREQ_ETERNAL;
+ return CPPC_NO_DATA;
if (pcc_ss_id < 0)
- return CPUFREQ_ETERNAL;
+ return CPPC_NO_DATA;
pcc_ss_data = pcc_data[pcc_ss_id];
if (pcc_ss_data->pcc_mpar)
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -875,7 +875,7 @@ static u32 amd_pstate_get_transition_del
u32 transition_delay_ns;
transition_delay_ns = cppc_get_transition_latency(cpu);
- if (transition_delay_ns == CPUFREQ_ETERNAL) {
+ if (transition_delay_ns == CPPC_NO_DATA) {
if (cpu_feature_enabled(X86_FEATURE_AMD_FAST_CPPC))
return AMD_PSTATE_FAST_CPPC_TRANSITION_DELAY;
else
@@ -894,7 +894,7 @@ static u32 amd_pstate_get_transition_lat
u32 transition_latency;
transition_latency = cppc_get_transition_latency(cpu);
- if (transition_latency == CPUFREQ_ETERNAL)
+ if (transition_latency == CPPC_NO_DATA)
return AMD_PSTATE_TRANSITION_LATENCY;
return transition_latency;
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -312,7 +312,7 @@ static unsigned int get_transition_laten
{
unsigned int transition_latency_ns = cppc_get_transition_latency(cpu);
- if (transition_latency_ns == CPUFREQ_ETERNAL)
+ if (transition_latency_ns == CPPC_NO_DATA)
return CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS / NSEC_PER_USEC;
return transition_latency_ns / NSEC_PER_USEC;
--- a/include/acpi/cppc_acpi.h
+++ b/include/acpi/cppc_acpi.h
@@ -41,6 +41,8 @@
#define CPPC_ENERGY_PERF_MAX (0xFF)
+#define CPPC_NO_DATA (unsigned int)(-1)
+
/* Each register has the folowing format. */
struct cpc_reg {
u8 descriptor;
@@ -218,7 +220,7 @@ static inline bool cppc_allow_fast_switc
}
static inline unsigned int cppc_get_transition_latency(int cpu)
{
- return CPUFREQ_ETERNAL;
+ return CPPC_NO_DATA;
}
static inline bool cpc_ffh_supported(void)
{
next prev parent reply other threads:[~2025-09-25 15:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 15:42 [PATCH v1 0/4] cpufreq: Fixes and cleanups related to CPUFREQ_ETERNAL Rafael J. Wysocki
2025-09-25 15:44 ` [PATCH v1 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency Rafael J. Wysocki
2025-09-25 16:37 ` Mario Limonciello
2025-09-26 9:46 ` Jie Zhan
2025-09-25 15:44 ` [PATCH v1 2/4] cpufreq: CPPC: Avoid using CPUFREQ_ETERNAL as transition delay Rafael J. Wysocki
2025-09-25 16:36 ` Mario Limonciello
2025-09-26 9:41 ` Jie Zhan
2025-09-25 15:46 ` Rafael J. Wysocki [this message]
2025-09-25 16:35 ` [PATCH v1 3/4] ACPI: CPPC: Replace CPUFREQ_ETERNAL with CPPC-specific symbol Mario Limonciello
2025-09-25 16:57 ` Rafael J. Wysocki
2025-09-25 17:23 ` [PATCH v2 3/4] ACPI: CPPC: Do not use CPUFREQ_ETERNAL as an error value Rafael J. Wysocki
2025-09-25 18:33 ` Mario Limonciello (AMD) (kernel.org)
2025-09-26 9:30 ` Jie Zhan
2025-09-26 10:22 ` Rafael J. Wysocki
2025-09-25 15:47 ` [PATCH v1 4/4] cpufreq: Drop unused symbol CPUFREQ_ETERNAL Rafael J. Wysocki
2025-09-25 16:36 ` Mario Limonciello (AMD) (kernel.org)
2025-09-26 9:47 ` Jie Zhan
2025-09-29 7:28 ` [PATCH v1 0/4] cpufreq: Fixes and cleanups related to CPUFREQ_ETERNAL Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3925838.kQq0lBPeGt@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=pierre.gondois@arm.com \
--cc=pprakash@codeaurora.org \
--cc=qyousef@layalina.io \
--cc=shawnguo@kernel.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox