From nobody Wed Jun 17 07:20:39 2026 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 8CE66367F40; Mon, 27 Apr 2026 03:55:30 +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=1777262130; cv=none; b=jGcI35vUp4XK0SGMRw3cjddhYGs2nCvmp1+Gc7H+J/IbUW6WZ2lygs+z49dmRRHN6mjACDi9wk1/R4nqvHufbgUFhHjEAY590WmqsH7RanlKgz2+TtXEtnrMMzt+bFQ0QzL+MsYX1S0gw3dj7ZdbC96ettMWuB/a6JVXoD+TPyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777262130; c=relaxed/simple; bh=6Rkyno1by9lAbZqswNfXc0W22A/O1bQRDxeFYUL7/WA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bZoua6GVL+q3mPDqh11JenJJuwKV2Kyzgr+BN3ag2Sq75dNYqE+dVjxaTBIwmEwkqVYB7qqn2SBcAJTXqcWSTMLv75wxEzEPn5Pcr8pwZeOrh/ekjlWJOzoOwL1/JzBOkPyCtttErNd73dBDv4ZAlKwRPSHI0hQlMIl0aYar8ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k346bmfD; 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="k346bmfD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DC1BC2BCB9; Mon, 27 Apr 2026 03:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777262130; bh=6Rkyno1by9lAbZqswNfXc0W22A/O1bQRDxeFYUL7/WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k346bmfD2g927mDoLm09XHxrn843Mn0u4Bw3nDgetrQ1GdTSPYz2nOvHFKwnB0pPh YaTW9l1/5pgqzGNWjhUzAx43cOAZErMjIZtL68Uj5m4bEIdccN7R+EVxLLfK4c3aN/ aes6BRhQGDbVf96uT1/H1GYxBNJfIgn0KxJ1aTqfepEw11BHZ97X4y18y2S2nXx9V3 4C4w4qsR3Ox+QLFgQgx3dL9DxfVZBixhqztkiuPS/JYsDRSMjjUIW5rbfkxB/Nk4UQ TQOHcsYJ8d4bwJwg3XfOYYiEzGSkdTk4w5F856WqjfSTTJvezZFXUk2nZBBPQDJGRj NG8tZh5MW1ZOw== From: "Mario Limonciello (AMD)" To: =?UTF-8?q?Rafael=20J=20=2E=20Wysocki=20=E2=8F=8E?= Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, K Prateek Nayak , x86@kernel.org, Mario Limonciello , stable@vger.kernel.org, Kim Phillips Subject: [PATCH 1/6] Revert "ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn" Date: Sun, 26 Apr 2026 22:55:15 -0500 Message-ID: <20260427035520.1427080-2-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260427035520.1427080-1-superm1@kernel.org> References: <20260427035520.1427080-1-superm1@kernel.org> 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" Some older systems don't support CPPC in the firmware and this just makes noise for them when booting. Drop back to debug. This reverts commit 21fb59ab4b9767085f4fe1edbdbe3177fbb9ec97. Cc: stable@vger.kernel.org Fixes: 21fb59ab4b976 ("ACPI: CPPC: Adjust debug messages in amd_set_max_fre= q_ratio() to warn") Reported-by: Kim Phillips Tested-by: Kim Phillips Signed-off-by: Mario Limonciello (AMD) --- arch/x86/kernel/acpi/cppc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index d7c8ef1e354d3..be4c5e9e5ff6f 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -88,19 +88,19 @@ static void amd_set_max_freq_ratio(void) =20 rc =3D cppc_get_perf_caps(0, &perf_caps); if (rc) { - pr_warn("Could not retrieve perf counters (%d)\n", rc); + pr_debug("Could not retrieve perf counters (%d)\n", rc); return; } =20 rc =3D amd_get_boost_ratio_numerator(0, &numerator); if (rc) { - pr_warn("Could not retrieve highest performance (%d)\n", rc); + pr_debug("Could not retrieve highest performance (%d)\n", rc); return; } nominal_perf =3D perf_caps.nominal_perf; =20 if (!nominal_perf) { - pr_warn("Could not retrieve nominal performance\n"); + pr_debug("Could not retrieve nominal performance\n"); return; } =20 --=20 2.43.0 From nobody Wed Jun 17 07:20:39 2026 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 9680E3644C3; Mon, 27 Apr 2026 03:55:31 +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=1777262131; cv=none; b=n7zmMh4q0YVdLBmB1Rlk8UzHm/l/tOIm00UVFC8c2F63lscfqpck078WqrH/gGfkhXd9xncUa+eB/gIXAf1mLSY8Ypg4cQB7/p3GvOdZkyYdQ4mYXtgvasi7/oL9Kr0YdEEqE9PsK02S35wlPNX5Yiabn45DDkGhDLfNpBt5kcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777262131; c=relaxed/simple; bh=4YMMBXWmIwJmYIH24b1eS5YbU5mq7WwaS0/4ExDHXj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dH953d3uytai5q3iKlYNrvnZSawHaUrF4DYJ/Y7eYf74+oNlXN9HPbJGnV4qXyYxSaQ/RGRPoY38IXUMWYoT9w19kXwCkUr+1SznC01mF4IuPKmlFrgF5jgnBWBkQm3zdB57ar9YnbDZnDghFi7xh609dtWtHL9i9pnmRHaH8D4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JCr6p/I5; 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="JCr6p/I5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C0EBC2BCC4; Mon, 27 Apr 2026 03:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777262131; bh=4YMMBXWmIwJmYIH24b1eS5YbU5mq7WwaS0/4ExDHXj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JCr6p/I5C00mbsECYQNGTJC1uR9jqYw5ZVU1AxJEkioOtKUi5nDwv8rbRgMnO95UJ cvt/q1MyGgrNF1VkH28VMoL0yUE6G3dqUyTywyefe6Pif8idO3t6XBEOM9xwufBbO7 mDItLXSMle1r3iPo4n8WtqkZrMkHnUN16ap5R4LmBgx4hEPx+EK/sCU/CpS0uP36Sk j4wioYn15fRAuWYIdjTHHSDAod4ezU20wZ2vqnRUhjd0dX4SGhlR6S2pzQrrTpecBR m7Y2fg4PhhmTmLd6EEvnjca/w18a+ZSFW5wzhM5nYCRa6GIsdZBUj+eBaNocTB8IF6 gqK2j8qvL7zcA== From: "Mario Limonciello (AMD)" To: =?UTF-8?q?Rafael=20J=20=2E=20Wysocki=20=E2=8F=8E?= Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, K Prateek Nayak , x86@kernel.org, Mario Limonciello Subject: [PATCH 2/6] ACPI: Add CPPC v4 definitions Date: Sun, 26 Apr 2026 22:55:16 -0500 Message-ID: <20260427035520.1427080-3-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260427035520.1427080-1-superm1@kernel.org> References: <20260427035520.1427080-1-superm1@kernel.org> 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" 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_Contro= l.html#cpc-continuous-performance-control Signed-off-by: Mario Limonciello (AMD) --- 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 =3D=3D CPPC_V2_REV && num_ent !=3D CPPC_V2_NUM_ENT) || (cpc_rev =3D=3D CPPC_V3_REV && num_ent !=3D CPPC_V3_NUM_ENT) || - (cpc_rev > CPPC_V3_REV && num_ent <=3D CPPC_V3_NUM_ENT)) { + (cpc_rev =3D=3D CPPC_V4_REV && num_ent !=3D CPPC_V4_NUM_ENT) || + (cpc_rev > CPPC_V4_REV && num_ent <=3D 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 =3D CPPC_V3_NUM_ENT; - cpc_rev =3D CPPC_V3_REV; + if (cpc_rev > CPPC_V4_REV) { + num_ent =3D CPPC_V4_NUM_ENT; + cpc_rev =3D CPPC_V4_REV; } =20 cpc_ptr->num_entries =3D num_ent; @@ -845,6 +846,13 @@ int acpi_cppc_processor_probe(struct acpi_processor *p= r) =20 cpc_ptr->cpc_regs[i-2].type =3D ACPI_TYPE_BUFFER; memcpy(&cpc_ptr->cpc_regs[i-2].cpc_entry.reg, gas_t, sizeof(*gas_t)); + } else if (cpc_obj->type =3D=3D 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 =3D ACPI_TYPE_PACKAGE; + cpc_ptr->cpc_regs[i-2].cpc_entry.pkg_data =3D 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 #include =20 -/* 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 =20 #define PCC_CMD_COMPLETE_MASK (1 << 0) #define PCC_ERROR_MASK (1 << 2) =20 -#define MAX_CPC_REG_ENT 21 +#define MAX_CPC_REG_ENT 23 =20 /* CPPC specific PCC commands. */ #define CMD_READ 0 @@ -60,8 +62,8 @@ struct cpc_reg { =20 /* * 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; }; =20 @@ -109,6 +112,8 @@ enum cppc_regs { REFERENCE_PERF, LOWEST_FREQ, NOMINAL_FREQ, + OSPM_NOMINAL_PERF, + RESOURCE_PRIO, }; =20 /* --=20 2.43.0 From nobody Wed Jun 17 07:20:39 2026 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 5B28C3612EF; Mon, 27 Apr 2026 03:55:32 +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=1777262132; cv=none; b=Bi25OYUj76RL/ljtmy6U26QXNPR2+YTtMP0WeklOBTFuJrEwB5pBIwfAJvUyAFCh51amlikr8L1qOgePWKvvo+vguelgAEpE4s/UMcV22Mlj/qXYX6ExWGAKWScz6ax8LdoOLD7cYv0QuGiFxcJZ51N29xvcVEGaS+8M9uu4nYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777262132; c=relaxed/simple; bh=J+uIJRhW8avviHoXF6FmqKso0BFymxyRVQchCEPrNFY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IyieJTGpQ4C5xltuUwbJUfxVaV4e1cY368hpXrZKM6/VjHh18MpQmmjcoRSqtla19dvk0sJjrmZx9oelwvykn+tnTtP/02FhNdPi3R5mfjAAeZy2HQtFvAtL9BtabhZSVPY7AUpI+ptnsnD1Ra119vT27M3PpX/QlqkhTl1owEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uORQgMrV; 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="uORQgMrV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8194FC2BCB5; Mon, 27 Apr 2026 03:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777262132; bh=J+uIJRhW8avviHoXF6FmqKso0BFymxyRVQchCEPrNFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uORQgMrVILuRPaLGWUmJ0KhNRulIp0kR2FqBdD5SqQQsqDw5F3zlhNQ8ZTfX93DVF qIffCws3fdeDNV5TYb3zI/bLHI7pivaDsbkc6S6R34LGAreAt3l+jtwuoTqQiUHLP3 b//0guFi6k1QWMID4a+nm2Dt6Zs2xbk4eHlNKZtlqWURMLVGde5/4PVwd/pmLinH/i q1dj+XkqKDe2GP1jRKsawXe7t4nd1qyjq1WGQvHjMBewDYKA87sihq2EPXtOst+1S3 I2cJoT3ZThzzcrsrXAW/kZ5eksqkIgLKJjz0NVBmuftNKsK3HUGBFpLe/tr4/rR193 fRXSu/Yrn7Gwg== From: "Mario Limonciello (AMD)" To: =?UTF-8?q?Rafael=20J=20=2E=20Wysocki=20=E2=8F=8E?= Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, K Prateek Nayak , x86@kernel.org, Mario Limonciello Subject: [PATCH 3/6] ACPI: CPPC: Add support for reading HighestFreq Date: Sun, 26 Apr 2026 22:55:17 -0500 Message-ID: <20260427035520.1427080-4-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260427035520.1427080-1-superm1@kernel.org> References: <20260427035520.1427080-1-superm1@kernel.org> 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" A future revision of the ACPI specification will be including a definition for HighestFreq. Add support for reading it. Signed-off-by: Mario Limonciello (AMD) --- 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 cbfebc50b6eab..f446ef5f7305b 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -182,6 +182,7 @@ show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowe= st_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); =20 show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time); =20 @@ -222,6 +223,7 @@ static struct attribute *cppc_attrs[] =3D { &nominal_perf.attr, &nominal_freq.attr, &lowest_freq.attr, + &highest_freq.attr, NULL }; ATTRIBUTE_GROUPS(cppc); @@ -751,19 +753,20 @@ int acpi_cppc_processor_probe(struct acpi_processor *= pr) /* * Disregard _CPC if the number of entries in the return package is not * as expected, but support future revisions being proper supersets of - * the v3 and only causing more entries to be returned by _CPC. + * the v4 and only causing more entries to be returned by _CPC. */ if ((cpc_rev =3D=3D CPPC_V2_REV && num_ent !=3D CPPC_V2_NUM_ENT) || (cpc_rev =3D=3D CPPC_V3_REV && num_ent !=3D CPPC_V3_NUM_ENT) || (cpc_rev =3D=3D CPPC_V4_REV && num_ent !=3D CPPC_V4_NUM_ENT) || - (cpc_rev > CPPC_V4_REV && num_ent <=3D CPPC_V4_NUM_ENT)) { + (cpc_rev =3D=3D CPPC_V5_REV && num_ent !=3D CPPC_V5_NUM_ENT) || + (cpc_rev > CPPC_V5_REV && num_ent <=3D 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 =3D CPPC_V4_NUM_ENT; - cpc_rev =3D CPPC_V4_REV; + if (cpc_rev > CPPC_V5_REV) { + num_ent =3D CPPC_V5_NUM_ENT; + cpc_rev =3D CPPC_V5_REV; } =20 cpc_ptr->num_entries =3D num_ent; @@ -1361,9 +1364,10 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_= caps *perf_caps) struct cpc_desc *cpc_desc =3D 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 =3D NULL, *nom_freq_reg =3D NULL; + *guaranteed_reg, *low_freq_reg =3D NULL, *nom_freq_reg =3D NULL, + *highest_freq_reg =3D NULL; u64 high, low, guaranteed, nom, ref, min_nonlinear, - low_f =3D 0, nom_f =3D 0; + low_f =3D 0, nom_f =3D 0, high_f =3D 0; int pcc_ss_id =3D per_cpu(cpu_pcc_subspace_idx, cpunum); struct cppc_pcc_data *pcc_ss_data =3D NULL; int ret =3D 0, regs_in_pcc =3D 0; @@ -1380,6 +1384,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_c= aps *perf_caps) reference_reg =3D &cpc_desc->cpc_regs[REFERENCE_PERF]; low_freq_reg =3D &cpc_desc->cpc_regs[LOWEST_FREQ]; nom_freq_reg =3D &cpc_desc->cpc_regs[NOMINAL_FREQ]; + highest_freq_reg =3D &cpc_desc->cpc_regs[HIGHEST_FREQ]; guaranteed_reg =3D &cpc_desc->cpc_regs[GUARANTEED_PERF]; =20 /* Are any of the regs PCC ?*/ @@ -1387,7 +1392,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_c= aps *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; @@ -1450,7 +1455,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_c= aps *perf_caps) goto out_err; } =20 - /* Read optional lowest and nominal frequencies if present */ + /* Read optional lowest, highest and nominal frequencies if present */ if (CPC_SUPPORTED(low_freq_reg)) { ret =3D cpc_read(cpunum, low_freq_reg, &low_f); if (ret) @@ -1463,9 +1468,15 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_= caps *perf_caps) goto out_err; } =20 + if (CPC_SUPPORTED(highest_freq_reg)) { + ret =3D cpc_read(cpunum, highest_freq_reg, &high_f); + if (ret) + goto out_err; + } + perf_caps->lowest_freq =3D low_f; perf_caps->nominal_freq =3D nom_f; - + perf_caps->highest_freq =3D high_f; =20 out_err: if (regs_in_pcc) diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 38bf9013c6e2e..79f1eef957a45 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 =20 #define PCC_CMD_COMPLETE_MASK (1 << 0) #define PCC_ERROR_MASK (1 << 2) =20 -#define MAX_CPC_REG_ENT 23 +#define MAX_CPC_REG_ENT 25 =20 /* CPPC specific PCC commands. */ #define CMD_READ 0 @@ -114,6 +116,8 @@ enum cppc_regs { NOMINAL_FREQ, OSPM_NOMINAL_PERF, RESOURCE_PRIO, + HIGHEST_FREQ, + CURRENT_FREQ, }; =20 /* @@ -131,6 +135,7 @@ struct cppc_perf_caps { u32 lowest_nonlinear_perf; u32 lowest_freq; u32 nominal_freq; + u32 highest_freq; }; =20 struct cppc_perf_ctrls { --=20 2.43.0 From nobody Wed Jun 17 07:20:39 2026 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 8E61A3793A5; Mon, 27 Apr 2026 03:55:33 +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=1777262133; cv=none; b=GHP3H56lkiGCdkP/r1MAXTTAQiLU8vb3gJ/OZihcO0LUJPdb1Gu6DxtuZ9tBgIMDL5OAkYyjFW/Bfa1nTRY06e1COeKnbg6f34dpL+pMvOpmpJOucTeEl0vLBxulXMslEC52EW439DvhV5hseNTLOJPiwcGqgEL9B2HOq94cyrI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777262133; c=relaxed/simple; bh=jm9601ye/dak73z5yWA7GFyDX/m2IXHFBny0wAWJZu8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d8/wPtVA2cf9w013qJ1lSboSfOsowhw4D2gbJ5LAABzQ4aTh4r1+7U/j6tfb/Gz91R6nsoj4q8S3IfldcEM2e4z2mdLAgKBCthOWsKWEneG55Qwj+PJZDNdADbrt+2/8pyFwMub4qHKbKNKQKxuK0Ym3N3L+kOAeASX8EzCJyy4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hjRgDbDy; 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="hjRgDbDy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74FFAC2BCB8; Mon, 27 Apr 2026 03:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777262133; bh=jm9601ye/dak73z5yWA7GFyDX/m2IXHFBny0wAWJZu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hjRgDbDyMUyQnsNOmOTUuUdYHy2Zq6ur4v3WnWWgsBToPp8NqQjrOwWUm4m6b131x +PXY+8rHboFquUVmV9j6WfHKA0t3dIpwRxZuFrZeXVaLzo7jXCnv+Xm4C+22s2+cVG DLNFsWuOhNwBIOrZ/YeXsgGIqrnvRr+d++HGGg9tcv1EPCk0IT9XtXYlOjHOBBTiid Kh7FqPLKbs3UU8cDBixaU0DXYrbNbVpiD1rxsWS6gZB1DfOXYkdP95PiUz3Ro0L3FW YOInKtDgriQ8hUsuBjgActPbmA6JNqUWFXBw7Ga8XTpBralJtuhjBXtQRb0TPxIDWk pGAUrb/zsY9lw== From: "Mario Limonciello (AMD)" To: =?UTF-8?q?Rafael=20J=20=2E=20Wysocki=20=E2=8F=8E?= Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, K Prateek Nayak , x86@kernel.org, Mario Limonciello Subject: [PATCH 4/6] ACPI: CPPC: Refactor boost ratio handling Date: Sun, 26 Apr 2026 22:55:18 -0500 Message-ID: <20260427035520.1427080-5-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260427035520.1427080-1-superm1@kernel.org> References: <20260427035520.1427080-1-superm1@kernel.org> 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" Rename amd_get_boost_ratio_numerator() to amd_get_effective_highest_perf() to better reflect that it returns the effective highest performance value for a CPU, accounting for preferred cores and heterogeneous topologies. Add a new helper amd_get_boost_ratio() for doing both for boost ratio calculations and update callers to use it. This refactoring is needed because on some AMD systems (Zen6+), the boost ratio should be calculated from frequency values rather than performance values. Signed-off-by: Mario Limonciello (AMD) --- arch/x86/kernel/acpi/cppc.c | 122 ++++++++++++++++++--------------- drivers/cpufreq/acpi-cpufreq.c | 5 +- drivers/cpufreq/amd-pstate.c | 12 ++-- include/acpi/cppc_acpi.h | 9 ++- 4 files changed, 86 insertions(+), 62 deletions(-) diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index be4c5e9e5ff6f..b581447711079 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -81,31 +81,18 @@ int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 = val) =20 static void amd_set_max_freq_ratio(void) { - struct cppc_perf_caps perf_caps; - u64 numerator, nominal_perf; + u64 numerator, denominator; u64 perf_ratio; int rc; =20 - rc =3D cppc_get_perf_caps(0, &perf_caps); - if (rc) { - pr_debug("Could not retrieve perf counters (%d)\n", rc); - return; - } - - rc =3D amd_get_boost_ratio_numerator(0, &numerator); + rc =3D amd_get_boost_ratio(0, &numerator, &denominator); if (rc) { - pr_debug("Could not retrieve highest performance (%d)\n", rc); - return; - } - nominal_perf =3D perf_caps.nominal_perf; - - if (!nominal_perf) { - pr_debug("Could not retrieve nominal performance\n"); + pr_debug("Could not retrieve boost ratio (%d)\n", rc); return; } =20 /* midpoint between max_boost and max_P */ - perf_ratio =3D (div_u64(numerator * SCHED_CAPACITY_SCALE, nominal_perf) += SCHED_CAPACITY_SCALE) >> 1; + perf_ratio =3D (div_u64(numerator * SCHED_CAPACITY_SCALE, denominator) + = SCHED_CAPACITY_SCALE) >> 1; =20 freq_invariance_set_perf_ratio(perf_ratio, false); } @@ -225,21 +212,18 @@ int amd_detect_prefcore(bool *detected) EXPORT_SYMBOL_GPL(amd_detect_prefcore); =20 /** - * amd_get_boost_ratio_numerator: Get the numerator to use for boost ratio= calculation - * @cpu: CPU to get numerator for. - * @numerator: Output variable for numerator. + * amd_get_effective_highest_perf: Get the effective highest performance v= alue + * @cpu: CPU to get highest performance for. * - * Determine the numerator to use for calculating the boost ratio on - * a CPU. On systems that support preferred cores, this will be a hardcoded - * value. On other systems this will the highest performance register valu= e. + * Get the effective highest performance value for a CPU, accounting for + * preferred cores and heterogeneous topologies. On systems with preferred + * cores, this may be a hardcoded value. On heterogeneous systems, this + * may be a per-CPU value. On other systems, this is the shared highest + * performance value. * - * If booting the system with amd-pstate enabled but preferred cores disab= led then - * the correct boost numerator will be returned to match hardware capabili= ties - * even if the preferred cores scheduling hints are not enabled. - * - * Return: 0 for success, negative error code otherwise. + * Return: Effective highest performance value, or negative error code. */ -int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator) +int amd_get_effective_highest_perf(unsigned int cpu) { enum x86_topology_cpu_type core_type =3D get_topology_cpu_type(&cpu_data(= cpu)); bool prefcore; @@ -247,14 +231,12 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u= 64 *numerator) u32 tmp; =20 ret =3D amd_detect_prefcore(&prefcore); - if (ret) + if (ret < 0) return ret; =20 /* without preferred cores, return the highest perf register value */ - if (!prefcore) { - *numerator =3D boost_numerator; - return 0; - } + if (!prefcore) + return boost_numerator; =20 /* * For AMD CPUs with Family ID 19H and Model ID range 0x70 to 0x7f, @@ -264,8 +246,7 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u64= *numerator) if (cpu_feature_enabled(X86_FEATURE_ZEN4)) { switch (boot_cpu_data.x86_model) { case 0x70 ... 0x7f: - *numerator =3D CPPC_HIGHEST_PERF_PERFORMANCE; - return 0; + return CPPC_HIGHEST_PERF_PERFORMANCE; default: break; } @@ -273,26 +254,59 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u= 64 *numerator) =20 /* detect if running on heterogeneous design */ if (cpu_feature_enabled(X86_FEATURE_AMD_HTR_CORES)) { - switch (core_type) { - case TOPO_CPU_TYPE_UNKNOWN: - pr_warn("Undefined core type found for cpu %d\n", cpu); - break; - case TOPO_CPU_TYPE_PERFORMANCE: - /* use the max scale for performance cores */ - *numerator =3D CPPC_HIGHEST_PERF_PERFORMANCE; - return 0; - case TOPO_CPU_TYPE_EFFICIENCY: - /* use the highest perf value for efficiency cores */ - ret =3D amd_get_highest_perf(cpu, &tmp); - if (ret) - return ret; - *numerator =3D tmp; - return 0; - } + if (cpu_feature_enabled(X86_FEATURE_ZEN5) && + core_type =3D=3D TOPO_CPU_TYPE_PERFORMANCE) + return CPPC_HIGHEST_PERF_PERFORMANCE; + + /* Zen 5 efficiency, and Zen 6+ */ + ret =3D amd_get_highest_perf(cpu, &tmp); + if (ret < 0) + return ret; + + return tmp; + } + + return CPPC_HIGHEST_PERF_PREFCORE; +} +EXPORT_SYMBOL_GPL(amd_get_effective_highest_perf); + +/** + * amd_get_boost_ratio: Get numerator and denominator for boost ratio + * @cpu: CPU to get the boost ratio for. + * @numerator: Output variable for numerator. + * @denominator: Output variable for denominator. + * + * Get the numerator and denominator for calculating the boost ratio. + * + * Return: 0 for success, negative error code otherwise. + */ +int amd_get_boost_ratio(unsigned int cpu, u64 *numerator, u64 *denominator) +{ + struct cppc_perf_caps perf_caps; + int ret; + + ret =3D cppc_get_perf_caps(cpu, &perf_caps); + if (ret) + return ret; + + /* Use frequency values if available */ + if (perf_caps.highest_freq && perf_caps.nominal_freq) { + *numerator =3D perf_caps.highest_freq; + *denominator =3D perf_caps.nominal_freq; + return 0; } =20 - *numerator =3D CPPC_HIGHEST_PERF_PREFCORE; + /* Fall back to performance values */ + ret =3D amd_get_effective_highest_perf(cpu); + if (ret < 0) + return ret; + + *numerator =3D ret; + + *denominator =3D perf_caps.nominal_perf; + if (!*denominator) + return -EINVAL; =20 return 0; } -EXPORT_SYMBOL_GPL(amd_get_boost_ratio_numerator); +EXPORT_SYMBOL_GPL(amd_get_boost_ratio); diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 21639d9ac753b..a1a005b29daba 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -640,12 +640,13 @@ static u64 get_max_boost_ratio(unsigned int cpu, u64 = *nominal_freq) } =20 if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD) { - ret =3D amd_get_boost_ratio_numerator(cpu, &highest_perf); - if (ret) { + ret =3D amd_get_effective_highest_perf(cpu); + if (ret < 0) { pr_debug("CPU%d: Unable to get boost ratio numerator (%d)\n", cpu, ret); return 0; } + highest_perf =3D ret; } else { highest_perf =3D perf_caps.highest_perf; } diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 453084c67327f..f5c7cc05220c4 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -476,10 +476,12 @@ static int msr_init_perf(struct amd_cpudata *cpudata) if (ret) return ret; =20 - ret =3D amd_get_boost_ratio_numerator(cpudata->cpu, &numerator); - if (ret) + ret =3D amd_get_effective_highest_perf(cpudata->cpu); + if (ret < 0) return ret; =20 + numerator =3D ret; + ret =3D rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &cppc_req); if (ret) return ret; @@ -520,10 +522,12 @@ static int shmem_init_perf(struct amd_cpudata *cpudat= a) if (ret) return ret; =20 - ret =3D amd_get_boost_ratio_numerator(cpudata->cpu, &numerator); - if (ret) + ret =3D amd_get_effective_highest_perf(cpudata->cpu); + if (ret < 0) return ret; =20 + numerator =3D ret; + perf.highest_perf =3D numerator; perf.max_limit_perf =3D numerator; perf.min_limit_perf =3D cppc_perf.lowest_perf; diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 79f1eef957a45..c25755630f8be 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -193,7 +193,8 @@ extern int cppc_set_auto_sel(int cpu, bool enable); extern int cppc_get_perf_limited(int cpu, u64 *perf_limited); extern int cppc_set_perf_limited(int cpu, u64 bits_to_clear); extern int amd_get_highest_perf(unsigned int cpu, u32 *highest_perf); -extern int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator); +extern int amd_get_effective_highest_perf(unsigned int cpu); +extern int amd_get_boost_ratio(unsigned int cpu, u64 *numerator, u64 *deno= minator); extern int amd_detect_prefcore(bool *detected); #else /* !CONFIG_ACPI_CPPC_LIB */ static inline int cppc_get_desired_perf(int cpunum, u64 *desired_perf) @@ -300,7 +301,11 @@ static inline int amd_get_highest_perf(unsigned int cp= u, u32 *highest_perf) { return -ENODEV; } -static inline int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *num= erator) +static inline int amd_get_effective_highest_perf(unsigned int cpu) +{ + return -EOPNOTSUPP; +} +static inline int amd_get_boost_ratio(unsigned int cpu, u64 *numerator, u6= 4 *denominator) { return -EOPNOTSUPP; } --=20 2.43.0 From nobody Wed Jun 17 07:20:39 2026 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 7862E37CD2D; Mon, 27 Apr 2026 03:55:34 +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=1777262134; cv=none; b=iW/uiqDfAmOZjAWEhGPLrzBU23eUNb1QBjkCqhGLe+VpCTGfgKGqt7rVuorAELrIHNQ6unngz3s+wajzBAhQwSebhlS3WJhzvCnR4XjGYoZTEns+wn477268UhsttLVXQeb/c6s2pe9GsdkGJNu1QpM5inAbkGTaO8hPXtMP+0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777262134; c=relaxed/simple; bh=x8pB7A77clAsMKogifhO+k7BvxdrCx9He24M7s+iEEY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sdotBYMUDw/6W89wJ1DfIKkpjoADkWGNlCOJv8oDLCpeUioJVlzXidej/fjoc9ekSAJFM5tgfKrTEYjlGGmbPiQgNiugKW8meSfVFqC5ssLAyarYPtC4GPSPbXBvcJTb7Nn4uzMRJFpSgst5i+JxzEIaHbCAB+unC6WUOvZfJ+o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fq2uExeU; 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="fq2uExeU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67D06C2BCB9; Mon, 27 Apr 2026 03:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777262134; bh=x8pB7A77clAsMKogifhO+k7BvxdrCx9He24M7s+iEEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fq2uExeUp9tWY8LujK5DlwHrM2CFpzEYFS7cNyg0qFBwiX01kfU31f3Hk8b8lI+wH W5Hy7Qz+0Igl7YcwOgt7tfGZU7K4Qzv/gyuBo0O67ewineVUeq9DQbfFlSoSy3o15i Vxv7IBk2rnNqml2LZwOLLI/XIWngQ5lHTnDOHb2Pqaj7bzntq+xgdMAzdpBhdBOkqL UO0jYosL8Fr8Bd9w65pt5fvQ8oaeV+4PtlmlbAwOOcJEKcNrgOuNv3gxUZaikbxdgn 7Bxj4yGqSncJhtFxFkBP3wsOQpPXRIg/hm4lzNxrXJ2hXY/X5JNCCnv+iYoJUhceF5 MVSZHkOFFBMyw== From: "Mario Limonciello (AMD)" To: =?UTF-8?q?Rafael=20J=20=2E=20Wysocki=20=E2=8F=8E?= Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, K Prateek Nayak , x86@kernel.org, Mario Limonciello Subject: [PATCH 5/6] cpufreq/acpi-cpufreq: Use amd_get_boost_ratio() Date: Sun, 26 Apr 2026 22:55:19 -0500 Message-ID: <20260427035520.1427080-6-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260427035520.1427080-1-superm1@kernel.org> References: <20260427035520.1427080-1-superm1@kernel.org> 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" Update get_max_boost_ratio() to use the new amd_get_boost_ratio() helper function instead of calling amd_get_effective_highest_perf() directly. This ensures the boost ratio is calculated correctly on systems where frequency values should be used instead of performance values. Signed-off-by: Mario Limonciello (AMD) --- drivers/cpufreq/acpi-cpufreq.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index a1a005b29daba..6e80540311f60 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -626,7 +626,7 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c) static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq) { struct cppc_perf_caps perf_caps; - u64 highest_perf, nominal_perf; + u64 numerator, denominator; int ret; =20 if (acpi_pstate_strict) @@ -640,33 +640,31 @@ static u64 get_max_boost_ratio(unsigned int cpu, u64 = *nominal_freq) } =20 if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD) { - ret =3D amd_get_effective_highest_perf(cpu); - if (ret < 0) { - pr_debug("CPU%d: Unable to get boost ratio numerator (%d)\n", + ret =3D amd_get_boost_ratio(cpu, &numerator, &denominator); + if (ret) { + pr_debug("CPU%d: Unable to get boost ratio (%d)\n", cpu, ret); return 0; } - highest_perf =3D ret; } else { - highest_perf =3D perf_caps.highest_perf; + numerator =3D perf_caps.highest_perf; + denominator =3D perf_caps.nominal_perf; } =20 - nominal_perf =3D perf_caps.nominal_perf; - if (nominal_freq) *nominal_freq =3D perf_caps.nominal_freq * 1000; =20 - if (!highest_perf || !nominal_perf) { + if (!numerator || !denominator) { pr_debug("CPU%d: highest or nominal performance missing\n", cpu); return 0; } =20 - if (highest_perf < nominal_perf) { + if (numerator < denominator) { pr_debug("CPU%d: nominal performance above highest\n", cpu); return 0; } =20 - return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf); + return div_u64(numerator << SCHED_CAPACITY_SHIFT, denominator); } =20 #else --=20 2.43.0 From nobody Wed Jun 17 07:20:39 2026 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 591B638B7AA; Mon, 27 Apr 2026 03:55:35 +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=1777262135; cv=none; b=XglYRLL3VvjONgqyhpxaRzjplt/M53fA0P984HmM6KV0mq/y0F9h8HAKTbsrlxwwLQMp1jF+8wzsgeAb6UO4jE1rfp+fkQiu5T+U80tYbQfSLmwTHwKiBip++M4ikCml/Bxb3M3XZq4bjJT69yV5RBDWTqwLT1/f1E8k651fqis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777262135; c=relaxed/simple; bh=ehN+cCgaE0e49CTPW7ov4BElFyYzLVHX6VJe+/oACPo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZlNBfWSyF1dsOJNs/y4Plm31wnCgopFeuixbzZam4hiuQ/+ZSMrGy0EOf6noPBFYyTd8OggVlPA798OFsqXq67mbMa933ECuW9x1zjrWWKH+77czwK9vPS7MXInSL1hvvBGlJYU63r7ypflIpx8arrSXrJdA9ZlwR11RY+hunv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q5RjW3Rw; 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="q5RjW3Rw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D311C2BCC4; Mon, 27 Apr 2026 03:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777262135; bh=ehN+cCgaE0e49CTPW7ov4BElFyYzLVHX6VJe+/oACPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q5RjW3RwC3MS2t1sHAM0GHvg1mR42uK9fEoMsgJEpvi0ecphqk1FKYPsRqw8bZhB1 cxvReVhZ30037CbZiWCLpunbtX1iZIDv5I3DsRghQ6rwbHI30BJtdnUgAxc87CDtCZ X0GbNKpddxSi+TkCnPOeSn85D/JBUE+WNYs3Jfb92cfCEVBQAT0/O3KGtBUYvQkojw FNpc7cN9VT1PuqSrZRELyNEh5fOs9B+gBdU7u+I5O3bHL6XjAgIhFMdo43jtIzEGSq x9/CZkB/G7K647SbAvkXawuyeycYVbqFgXarLzEFTBdgdJsd93lEZb746O0MbEKQXS un+5zxK+upv0w== From: "Mario Limonciello (AMD)" To: =?UTF-8?q?Rafael=20J=20=2E=20Wysocki=20=E2=8F=8E?= Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, K Prateek Nayak , x86@kernel.org, Mario Limonciello Subject: [PATCH 6/6] cpufreq/amd-pstate: Get highest freq from CPPC if available Date: Sun, 26 Apr 2026 22:55:20 -0500 Message-ID: <20260427035520.1427080-7-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260427035520.1427080-1-superm1@kernel.org> References: <20260427035520.1427080-1-superm1@kernel.org> 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" If the _CPC object advertises the highest frequency for a CPU, use this instead of trying to calculate by linear interpolation. Signed-off-by: Mario Limonciello (AMD) --- drivers/cpufreq/amd-pstate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index f5c7cc05220c4..9703b54ee4820 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1026,8 +1026,12 @@ static int amd_pstate_init_freq(struct amd_cpudata *= cpudata) =20 WRITE_ONCE(cpudata->nominal_freq, nominal_freq); =20 + /* max freq came from _CPC */ + if (cppc_perf.highest_freq) + max_freq =3D cppc_perf.highest_freq * 1000; /* max_freq is calculated according to (nominal_freq * highest_perf)/nomi= nal_perf */ - max_freq =3D perf_to_freq(perf, nominal_freq, perf.highest_perf); + else + max_freq =3D perf_to_freq(perf, nominal_freq, perf.highest_perf); WRITE_ONCE(cpudata->max_freq, max_freq); =20 lowest_nonlinear_freq =3D perf_to_freq(perf, nominal_freq, perf.lowest_no= nlinear_perf); --=20 2.43.0