public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: "Rafael J . Wysocki ⏎" <rafael@kernel.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	x86@kernel.org, Mario Limonciello <superm1@kernel.org>
Subject: [PATCH 2/6] ACPI: Add CPPC v4 definitions
Date: Sun, 26 Apr 2026 22:55:16 -0500	[thread overview]
Message-ID: <20260427035520.1427080-3-superm1@kernel.org> (raw)
In-Reply-To: <20260427035520.1427080-1-superm1@kernel.org>

ACPI 6.6 introduced new optional package values for
`OSPMNominalPerformanceRegister` and
`ResourcePriorityRegisters`.

Add these into the defines.  As they're not used right now they are not
wired up to anything at this time.

Link: https://uefi.org/specs/ACPI/6.6/08_Processor_Configuration_and_Control.html#cpc-continuous-performance-control
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
 drivers/acpi/cppc_acpi.c | 16 ++++++++++++----
 include/acpi/cppc_acpi.h | 13 +++++++++----
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 2e91c5a977611..cbfebc50b6eab 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -755,14 +755,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_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)) {
 		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_V3_REV) {
-		num_ent = CPPC_V3_NUM_ENT;
-		cpc_rev = CPPC_V3_REV;
+	if (cpc_rev > CPPC_V4_REV) {
+		num_ent = CPPC_V4_NUM_ENT;
+		cpc_rev = CPPC_V4_REV;
 	}
 
 	cpc_ptr->num_entries = num_ent;
@@ -845,6 +846,13 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
 
 			cpc_ptr->cpc_regs[i-2].type = ACPI_TYPE_BUFFER;
 			memcpy(&cpc_ptr->cpc_regs[i-2].cpc_entry.reg, gas_t, sizeof(*gas_t));
+		} else if (cpc_obj->type == ACPI_TYPE_PACKAGE) {
+			/*
+			 * CPPC v4 ResourcePriorityRegisters is a Package.
+			 * Store NULL for now as it's not wired up to anything.
+			 */
+			cpc_ptr->cpc_regs[i-2].type = ACPI_TYPE_PACKAGE;
+			cpc_ptr->cpc_regs[i-2].cpc_entry.pkg_data = NULL;
 		} else {
 			pr_debug("Invalid entry type (%d) in _CPC for CPU:%d\n",
 				 i, pr->id);
diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h
index d1f02ceec4f98..38bf9013c6e2e 100644
--- a/include/acpi/cppc_acpi.h
+++ b/include/acpi/cppc_acpi.h
@@ -17,16 +17,18 @@
 #include <acpi/pcc.h>
 #include <acpi/processor.h>
 
-/* CPPCv2 and CPPCv3 support */
+/* CPPC support */
 #define CPPC_V2_REV	2
 #define CPPC_V3_REV	3
+#define CPPC_V4_REV	4
 #define CPPC_V2_NUM_ENT	21
 #define CPPC_V3_NUM_ENT	23
+#define CPPC_V4_NUM_ENT	25
 
 #define PCC_CMD_COMPLETE_MASK	(1 << 0)
 #define PCC_ERROR_MASK		(1 << 2)
 
-#define MAX_CPC_REG_ENT 21
+#define MAX_CPC_REG_ENT 23
 
 /* CPPC specific PCC commands. */
 #define	CMD_READ 0
@@ -60,8 +62,8 @@ struct cpc_reg {
 
 /*
  * Each entry in the CPC table is either
- * of type ACPI_TYPE_BUFFER or
- * ACPI_TYPE_INTEGER.
+ * of type ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER,
+ * or ACPI_TYPE_PACKAGE (for CPPC v4 ResourcePriorityRegisters).
  */
 struct cpc_register_resource {
 	acpi_object_type type;
@@ -69,6 +71,7 @@ struct cpc_register_resource {
 	union {
 		struct cpc_reg reg;
 		u64 int_value;
+		void *pkg_data;
 	} cpc_entry;
 };
 
@@ -109,6 +112,8 @@ enum cppc_regs {
 	REFERENCE_PERF,
 	LOWEST_FREQ,
 	NOMINAL_FREQ,
+	OSPM_NOMINAL_PERF,
+	RESOURCE_PRIO,
 };
 
 /*
-- 
2.43.0


  parent reply	other threads:[~2026-04-27  3:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  3:55 [PATCH 0/6] Add CPPC HighestFreq support Mario Limonciello (AMD)
2026-04-27  3:55 ` [PATCH 1/6] Revert "ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn" Mario Limonciello (AMD)
2026-04-27  3:55 ` Mario Limonciello (AMD) [this message]
2026-04-27  3:55 ` [PATCH 3/6] ACPI: CPPC: Add support for reading HighestFreq Mario Limonciello (AMD)
2026-04-27  3:55 ` [PATCH 4/6] ACPI: CPPC: Refactor boost ratio handling Mario Limonciello (AMD)
2026-04-27  3:55 ` [PATCH 5/6] cpufreq/acpi-cpufreq: Use amd_get_boost_ratio() Mario Limonciello (AMD)
2026-04-27  3:55 ` [PATCH 6/6] cpufreq/amd-pstate: Get highest freq from CPPC if available Mario Limonciello (AMD)

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=20260427035520.1427080-3-superm1@kernel.org \
    --to=superm1@kernel.org \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=x86@kernel.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