git: ad9932995cf8 - main - hwpstate: Add CPPC enable tunable

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Thu, 22 Jan 2026 04:44:08 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=ad9932995cf8f93143ff033712016d95b5cb7a50

commit ad9932995cf8f93143ff033712016d95b5cb7a50
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2026-01-05 04:53:51 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2026-01-22 04:36:33 +0000

    hwpstate: Add CPPC enable tunable
    
    The Framework 13 runs very hot the maximum frequency is possible. By
    disabling CPPC (reverting to Cool`n'Quiet 2.0) we can use powerd to
    limit the CPU frequency to 2200, thereby reducing the CPU temperature.
    
    Some systems may run slower with CPPC enabled. See PR/292615 for that
    bug.
    
    Those experiencing either of these issues may add the following to
    their loader.conf or device.hints to disable CPPC:
    
    machdep.hwpstate_amd_cppc_enable="0"
    
    PR:                     292615
    Reviewed by:            lwhsu, olce
    Differential revision:  https://reviews.freebsd.org/D54803
---
 sys/x86/cpufreq/hwpstate_amd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c
index 5676d8ce7dae..34838753e221 100644
--- a/sys/x86/cpufreq/hwpstate_amd.c
+++ b/sys/x86/cpufreq/hwpstate_amd.c
@@ -179,6 +179,11 @@ SYSCTL_BOOL(_machdep, OID_AUTO, hwpstate_pkg_ctrl, CTLFLAG_RDTUN,
     &hwpstate_pkg_ctrl_enable, 0,
     "Set 1 (default) to enable package-level control, 0 to disable");
 
+static bool hwpstate_amd_cppc_enable = true;
+SYSCTL_BOOL(_machdep, OID_AUTO, hwpstate_amd_cppc_enable, CTLFLAG_RDTUN,
+    &hwpstate_amd_cppc_enable, 0,
+    "Set 1 (default) to enable AMD CPPC, 0 to disable");
+
 static device_method_t hwpstate_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_identify,	hwpstate_identify),
@@ -667,7 +672,8 @@ hwpstate_probe(device_t dev)
 
 	sc = device_get_softc(dev);
 
-	if (amd_extended_feature_extensions & AMDFEID_CPPC) {
+	if (hwpstate_amd_cppc_enable &&
+	   (amd_extended_feature_extensions & AMDFEID_CPPC)) {
 		sc->flags |= PSTATE_CPPC;
 		device_set_desc(dev,
 		    "AMD Collaborative Processor Performance Control (CPPC)");