[PATCH v2 2/5] ACPI: CPPC: Add support for reading HighestFreq
From: Mario Limonciello
Date: Mon May 04 2026 - 19:02:51 EST
A future revision of the ACPI specification will be including
a definition for HighestFreq. Add support for reading it.
Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
v2:
* Fix optional register mask
---
drivers/acpi/cppc_acpi.c | 31 +++++++++++++++++++++----------
include/acpi/cppc_acpi.h | 7 ++++++-
2 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index fbc620adafad7..f96a83b58072b 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -134,7 +134,7 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);
* cpc_regs[] with the corresponding index. 0 means mandatory and 1
* means optional.
*/
-#define REG_OPTIONAL (0x7FC7D0)
+#define REG_OPTIONAL (0x1FFC7D0)
/*
* Use the index of the register in per-cpu cpc_regs[] to check if
@@ -186,6 +186,7 @@ show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_nonlinear_perf);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, guaranteed_perf);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_freq);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_freq);
+show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, highest_freq);
show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time);
@@ -259,6 +260,7 @@ static struct attribute *cppc_attrs[] = {
&nominal_freq.attr,
&lowest_freq.attr,
&ospm_nominal_perf.attr,
+ &highest_freq.attr,
NULL
};
ATTRIBUTE_GROUPS(cppc);
@@ -793,14 +795,15 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
if ((cpc_rev == CPPC_V2_REV && num_ent != CPPC_V2_NUM_ENT) ||
(cpc_rev == CPPC_V3_REV && num_ent != CPPC_V3_NUM_ENT) ||
(cpc_rev == CPPC_V4_REV && num_ent != CPPC_V4_NUM_ENT) ||
- (cpc_rev > CPPC_V4_REV && num_ent <= CPPC_V4_NUM_ENT)) {
+ (cpc_rev == CPPC_V5_REV && num_ent != CPPC_V5_NUM_ENT) ||
+ (cpc_rev > CPPC_V5_REV && num_ent <= CPPC_V5_NUM_ENT)) {
pr_debug("Unexpected number of _CPC return package entries (%d) for CPU:%d\n",
num_ent, pr->id);
goto out_free;
}
- if (cpc_rev > CPPC_V4_REV) {
- num_ent = CPPC_V4_NUM_ENT;
- cpc_rev = CPPC_V4_REV;
+ if (cpc_rev > CPPC_V5_REV) {
+ num_ent = CPPC_V5_NUM_ENT;
+ cpc_rev = CPPC_V5_REV;
}
cpc_ptr->num_entries = num_ent;
@@ -1402,9 +1405,10 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpunum);
struct cpc_register_resource *highest_reg, *lowest_reg,
*lowest_non_linear_reg, *nominal_reg, *reference_reg,
- *guaranteed_reg, *low_freq_reg = NULL, *nom_freq_reg = NULL;
+ *guaranteed_reg, *low_freq_reg = NULL, *nom_freq_reg = NULL,
+ *highest_freq_reg = NULL;
u64 high, low, guaranteed, nom, ref, min_nonlinear,
- low_f = 0, nom_f = 0;
+ low_f = 0, nom_f = 0, high_f = 0;
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpunum);
struct cppc_pcc_data *pcc_ss_data = NULL;
int ret = 0, regs_in_pcc = 0;
@@ -1421,6 +1425,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
reference_reg = &cpc_desc->cpc_regs[REFERENCE_PERF];
low_freq_reg = &cpc_desc->cpc_regs[LOWEST_FREQ];
nom_freq_reg = &cpc_desc->cpc_regs[NOMINAL_FREQ];
+ highest_freq_reg = &cpc_desc->cpc_regs[HIGHEST_FREQ];
guaranteed_reg = &cpc_desc->cpc_regs[GUARANTEED_PERF];
/* Are any of the regs PCC ?*/
@@ -1428,7 +1433,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
CPC_IN_PCC(lowest_non_linear_reg) || CPC_IN_PCC(nominal_reg) ||
(CPC_SUPPORTED(reference_reg) && CPC_IN_PCC(reference_reg)) ||
CPC_IN_PCC(low_freq_reg) || CPC_IN_PCC(nom_freq_reg) ||
- CPC_IN_PCC(guaranteed_reg)) {
+ CPC_IN_PCC(guaranteed_reg) || CPC_IN_PCC(highest_freq_reg)) {
if (pcc_ss_id < 0) {
pr_debug("Invalid pcc_ss_id\n");
return -ENODEV;
@@ -1491,7 +1496,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
goto out_err;
}
- /* Read optional lowest and nominal frequencies if present */
+ /* Read optional lowest, highest and nominal frequencies if present */
if (CPC_SUPPORTED(low_freq_reg)) {
ret = cpc_read(cpunum, low_freq_reg, &low_f);
if (ret)
@@ -1504,9 +1509,15 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
goto out_err;
}
+ if (CPC_SUPPORTED(highest_freq_reg)) {
+ ret = cpc_read(cpunum, highest_freq_reg, &high_f);
+ if (ret)
+ goto out_err;
+ }
+
perf_caps->lowest_freq = low_f;
perf_caps->nominal_freq = nom_f;
-
+ perf_caps->highest_freq = high_f;
out_err:
if (regs_in_pcc)
diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h
index 3771e2ed507de..053ea67f767ff 100644
--- a/include/acpi/cppc_acpi.h
+++ b/include/acpi/cppc_acpi.h
@@ -21,14 +21,16 @@
#define CPPC_V2_REV 2
#define CPPC_V3_REV 3
#define CPPC_V4_REV 4
+#define CPPC_V5_REV 5
#define CPPC_V2_NUM_ENT 21
#define CPPC_V3_NUM_ENT 23
#define CPPC_V4_NUM_ENT 25
+#define CPPC_V5_NUM_ENT 27
#define PCC_CMD_COMPLETE_MASK (1 << 0)
#define PCC_ERROR_MASK (1 << 2)
-#define MAX_CPC_REG_ENT 23
+#define MAX_CPC_REG_ENT 25
/* CPPC specific PCC commands. */
#define CMD_READ 0
@@ -114,6 +116,8 @@ enum cppc_regs {
NOMINAL_FREQ,
OSPM_NOMINAL_PERF,
RESOURCE_PRIORITY,
+ HIGHEST_FREQ,
+ CURRENT_FREQ,
};
/*
@@ -131,6 +135,7 @@ struct cppc_perf_caps {
u32 lowest_nonlinear_perf;
u32 lowest_freq;
u32 nominal_freq;
+ u32 highest_freq;
};
struct cppc_perf_ctrls {
--
2.43.0