Skip to content

Commit 71e1815

Browse files
Sumit Guptarafaeljw
authored andcommitted
ACPI: CPPC: Add support for CPPC v4
CPPC v4 (ACPI 6.6, Section 8.4.6) adds two optional entries to the _CPC package: 1. OSPM Nominal Performance (8.4.6.1.2.6): A write-only register that lets OSPM inform the platform what it considers nominal performance. The platform classifies performance above this level as boost and below as throttle for its power/thermal decisions. 2. Resource Priority (8.4.6.1.2.7): A Package of Resource Priority Register Descriptor sub-packages that allow OSPM to set relative priority among processors for shared resources (boost, throttle, L2/L3 cache, memory bandwidth). Parsing the full structure is not yet supported; such entries are marked as unsupported. Add v4 _CPC table parsing (25 entries) and update REG_OPTIONAL to mark the two new registers as optional. Signed-off-by: Sumit Gupta <sumitg@nvidia.com> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Link: https://patch.msgid.link/20260527194626.185286-2-sumitg@nvidia.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent e43ffb6 commit 71e1815

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

drivers/acpi/cppc_acpi.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);
134134
* cpc_regs[] with the corresponding index. 0 means mandatory and 1
135135
* means optional.
136136
*/
137-
#define REG_OPTIONAL (0x1FC7D0)
137+
#define REG_OPTIONAL (0x7FC7D0)
138138

139139
/*
140140
* Use the index of the register in per-cpu cpc_regs[] to check if
@@ -751,18 +751,19 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
751751
/*
752752
* Disregard _CPC if the number of entries in the return package is not
753753
* as expected, but support future revisions being proper supersets of
754-
* the v3 and only causing more entries to be returned by _CPC.
754+
* the v4 and only causing more entries to be returned by _CPC.
755755
*/
756756
if ((cpc_rev == CPPC_V2_REV && num_ent != CPPC_V2_NUM_ENT) ||
757757
(cpc_rev == CPPC_V3_REV && num_ent != CPPC_V3_NUM_ENT) ||
758-
(cpc_rev > CPPC_V3_REV && num_ent <= CPPC_V3_NUM_ENT)) {
758+
(cpc_rev == CPPC_V4_REV && num_ent != CPPC_V4_NUM_ENT) ||
759+
(cpc_rev > CPPC_V4_REV && num_ent <= CPPC_V4_NUM_ENT)) {
759760
pr_debug("Unexpected number of _CPC return package entries (%d) for CPU:%d\n",
760761
num_ent, pr->id);
761762
goto out_free;
762763
}
763-
if (cpc_rev > CPPC_V3_REV) {
764-
num_ent = CPPC_V3_NUM_ENT;
765-
cpc_rev = CPPC_V3_REV;
764+
if (cpc_rev > CPPC_V4_REV) {
765+
num_ent = CPPC_V4_NUM_ENT;
766+
cpc_rev = CPPC_V4_REV;
766767
}
767768

768769
cpc_ptr->num_entries = num_ent;
@@ -845,6 +846,16 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
845846

846847
cpc_ptr->cpc_regs[i-2].type = ACPI_TYPE_BUFFER;
847848
memcpy(&cpc_ptr->cpc_regs[i-2].cpc_entry.reg, gas_t, sizeof(*gas_t));
849+
} else if (cpc_obj->type == ACPI_TYPE_PACKAGE && (i - 2) == RESOURCE_PRIORITY) {
850+
/*
851+
* ACPI 6.6, s8.4.6.1.2.7 defines Resource Priority as a
852+
* Package of Resource Priority Register Descriptor sub-packages.
853+
* Parsing the full structure is not yet supported.
854+
* Mark the register as unsupported for now.
855+
*/
856+
pr_debug("CPU:%d Resource Priority not supported\n", pr->id);
857+
cpc_ptr->cpc_regs[i-2].type = ACPI_TYPE_INTEGER;
858+
cpc_ptr->cpc_regs[i-2].cpc_entry.int_value = 0;
848859
} else {
849860
pr_debug("Invalid entry type (%d) in _CPC for CPU:%d\n",
850861
i, pr->id);

include/acpi/cppc_acpi.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@
1717
#include <acpi/pcc.h>
1818
#include <acpi/processor.h>
1919

20-
/* CPPCv2 and CPPCv3 support */
20+
/* CPPCv2, CPPCv3 and CPPCv4 support */
2121
#define CPPC_V2_REV 2
2222
#define CPPC_V3_REV 3
23+
#define CPPC_V4_REV 4
2324
#define CPPC_V2_NUM_ENT 21
2425
#define CPPC_V3_NUM_ENT 23
26+
#define CPPC_V4_NUM_ENT 25
2527

2628
#define PCC_CMD_COMPLETE_MASK (1 << 0)
2729
#define PCC_ERROR_MASK (1 << 2)
2830

29-
#define MAX_CPC_REG_ENT 21
31+
#define MAX_CPC_REG_ENT 23
3032

3133
/* CPPC specific PCC commands. */
3234
#define CMD_READ 0
@@ -109,6 +111,8 @@ enum cppc_regs {
109111
REFERENCE_PERF,
110112
LOWEST_FREQ,
111113
NOMINAL_FREQ,
114+
OSPM_NOMINAL_PERF,
115+
RESOURCE_PRIORITY,
112116
};
113117

114118
/*

0 commit comments

Comments
 (0)