From nobody Thu Mar 5 14:44:08 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fRXNn1n0Yz6T83F for ; Thu, 05 Mar 2026 14:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fRXNn0lsnz3S4b for ; Thu, 05 Mar 2026 14:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772721849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ahuvju83VGa3Diu+o+o0PWpFlU+eDvK1o//RWT6KDqs=; b=CLtxasH4qYTNzWX80LIyYiwbBnAsa6XqaFmuWqAuVY95PCv36eaEkkh5rP3OLCDcR934y6 JrmbxoWn7DsiL/cg+Emaidyu/IuCfZRV2rGlwqVwSYF7n2i9AoB+Zrmpgr3VXRSfxQ6wcf bDIatCcM/5svmX+V5gKSMIoLzutDGLG0OiCBt8WjsStc0n3asUKcAJAOopqnbc1GvrckNV Eu2KMPnUT6+fBqK9oSZOUkUK1XZVP4Asm/cHHkVb9w/NLknrhxOTHa7PaFwfSGWjOcC2Hb mXPCi9KUBYeyvIqzpS11J1LL7KmBd7aT/D5XUAjKRqo1o64rSpSTp5ZE673Y5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772721849; a=rsa-sha256; cv=none; b=cqWG/N4XFMFw1ZqLVyYCjDbDG8dqZj6JUNZODx9phu3RhW/fFpp2/t3DPoLvoQrf5rVYFX QZ11VLKDhZhPOb98QS55USe8rd0VGTCzg+FuxEwiN+/hNGyNXh4Lky2OAQyiuR4E5KMkZN ODshid0NkGhS3jX3hAFQpZ73b8eK8lYXiyoOxzSKZTWAMa5xpAlNUmfsEI1tXlTYyWHyAc sRAwrtrpEwsb0j8HnXaElwqLNcszqxMEnF0Khe5tb0EjIVNauS4+t/Sk0a55gqllkboGov K5mtD67jVDtKuKcTm7cy/UpoCrLbgTnc9wKDUUcpnGh/76JpdD4YquWRWrZbLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772721849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ahuvju83VGa3Diu+o+o0PWpFlU+eDvK1o//RWT6KDqs=; b=AQ2kB16Leaey0T1A/BWCBeai9eIhYKGfe3ySmEJH/CVVyZQFxHmeeaMrwuf0GwrR0TuclO wQvntXkNOtB/5kmDCMAXfr9YDq4vYy2EKafRXb4HNZioH2zPBYIUnLEj6wQ9wVWOnVNuKd s0U1jBR61Suhn7IQqX9g6RTMNJU86DKPMzb7ENrBwANyHUybzM+VowLmJUs0KFBpRl0t/d CNulLIuaIKexHWWqhDT6j/O2TfMq/mBgD/i9r/MROV7cfWpdztMYXE/MrFCMJOAyOahi/b wf2ktID1uZQT0SIJR+zontZDqecDtduVLe9DCgs90oUuHqFoqEwkf0f0LLtD9A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fRXNn02Xwzhl0 for ; Thu, 05 Mar 2026 14:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2719e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 05 Mar 2026 14:44:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 9a0a35916ab0 - stable/15 - hwpstate{_amd,intel}(4): Move common knobs to a separate file List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 9a0a35916ab05e52fdafb47014c5fe8844a87bc9 Auto-Submitted: auto-generated Date: Thu, 05 Mar 2026 14:44:08 +0000 Message-Id: <69a996b8.2719e.79b14da5@gitrepo.freebsd.org> The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=9a0a35916ab05e52fdafb47014c5fe8844a87bc9 commit 9a0a35916ab05e52fdafb47014c5fe8844a87bc9 Author: Olivier Certner AuthorDate: 2026-02-06 10:58:07 +0000 Commit: Olivier Certner CommitDate: 2026-03-05 14:43:23 +0000 hwpstate{_amd,intel}(4): Move common knobs to a separate file Reason for doing this right now is to resolve the conflict on 'machdep.hwpstate_pkg_ctrl' between the Intel and AMD drivers, even though I expect to remove it for hwpstate_amd(4) at some point. More generally, this is going to be useful for some future code factorization. Also, the 'debug.hwpstate_verbose' knob was moved there, as we'll likely want to use it for the Intel driver as well (which is currently not the case). Note for MFC: Will be partial, since `hwpstate_amd(4)` does not support CPPC in stable/15 nor stable/14. Reviewed by: emaste Fixes: 3e6e4e4a0d42 ("hwpstate: add CPPC support for pstate driver on AMD") MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D54528 (cherry picked from commit 8043295875083b57a6b7b2dc6826fde4cf4e1ba1) --- sys/conf/files.x86 | 1 + sys/modules/cpufreq/Makefile | 3 ++- sys/x86/cpufreq/hwpstate_amd.c | 6 ++---- sys/x86/cpufreq/hwpstate_common.c | 22 ++++++++++++++++++++++ sys/x86/cpufreq/hwpstate_common.h | 13 +++++++++++++ sys/x86/cpufreq/hwpstate_intel.c | 6 +----- 6 files changed, 41 insertions(+), 10 deletions(-) diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index b1bd6f7291ca..fabcd5d9ebe5 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -342,6 +342,7 @@ x86/acpica/srat.c optional acpi x86/bios/vpd.c optional vpd x86/cpufreq/est.c optional cpufreq x86/cpufreq/hwpstate_amd.c optional cpufreq +x86/cpufreq/hwpstate_common.c optional cpufreq x86/cpufreq/hwpstate_intel.c optional cpufreq x86/cpufreq/p4tcc.c optional cpufreq x86/cpufreq/powernow.c optional cpufreq diff --git a/sys/modules/cpufreq/Makefile b/sys/modules/cpufreq/Makefile index 9a417f72fc27..23b4c97f5393 100644 --- a/sys/modules/cpufreq/Makefile +++ b/sys/modules/cpufreq/Makefile @@ -9,7 +9,8 @@ SRCS+= bus_if.h cpufreq_if.h device_if.h pci_if.h .PATH: ${SRCTOP}/sys/x86/cpufreq SRCS+= acpi_if.h opt_acpi.h -SRCS+= est.c hwpstate_amd.c p4tcc.c powernow.c hwpstate_intel.c +SRCS+= est.c p4tcc.c powernow.c +SRCS+= hwpstate_amd.c hwpstate_common.c hwpstate_intel.c .endif .if ${MACHINE} == "i386" diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c index fc948dc90a15..10fc8f935d57 100644 --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -66,6 +66,8 @@ #include +#include + #include "acpi_if.h" #include "cpufreq_if.h" @@ -126,10 +128,6 @@ static int hwpstate_get_info_from_acpi_perf(device_t dev, device_t perf_dev); static int hwpstate_get_info_from_msr(device_t dev); static int hwpstate_goto_pstate(device_t dev, int pstate_id); -static int hwpstate_verbose; -SYSCTL_INT(_debug, OID_AUTO, hwpstate_verbose, CTLFLAG_RWTUN, - &hwpstate_verbose, 0, "Debug hwpstate"); - static int hwpstate_verify; SYSCTL_INT(_debug, OID_AUTO, hwpstate_verify, CTLFLAG_RWTUN, &hwpstate_verify, 0, "Verify P-state after setting"); diff --git a/sys/x86/cpufreq/hwpstate_common.c b/sys/x86/cpufreq/hwpstate_common.c new file mode 100644 index 000000000000..60d84f9983a6 --- /dev/null +++ b/sys/x86/cpufreq/hwpstate_common.c @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2026 The FreeBSD Foundation + * + * This software was developed by Olivier Certner at Kumacom + * SARL under sponsorship from the FreeBSD Foundation. + */ + +#include + +#include + + +int hwpstate_verbose; +SYSCTL_INT(_debug, OID_AUTO, hwpstate_verbose, CTLFLAG_RWTUN, + &hwpstate_verbose, 0, "Debug hwpstate"); + +bool hwpstate_pkg_ctrl_enable = true; +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"); diff --git a/sys/x86/cpufreq/hwpstate_common.h b/sys/x86/cpufreq/hwpstate_common.h new file mode 100644 index 000000000000..953037672c0f --- /dev/null +++ b/sys/x86/cpufreq/hwpstate_common.h @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2026 The FreeBSD Foundation + * + * This software was developed by Olivier Certner at Kumacom + * SARL under sponsorship from the FreeBSD Foundation. + */ + +/* Stuff common to hwpstate_amd(4) and hwpstate_intel(4). */ + +extern int hwpstate_verbose; +extern bool hwpstate_pkg_ctrl_enable; diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c index 259aeac399c8..3d2cc0a5966b 100644 --- a/sys/x86/cpufreq/hwpstate_intel.c +++ b/sys/x86/cpufreq/hwpstate_intel.c @@ -48,6 +48,7 @@ #include +#include #include #include "acpi_if.h" @@ -108,11 +109,6 @@ static driver_t hwpstate_intel_driver = { DRIVER_MODULE(hwpstate_intel, cpu, hwpstate_intel_driver, NULL, NULL); MODULE_VERSION(hwpstate_intel, 1); -static bool hwpstate_pkg_ctrl_enable = true; -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 int intel_hwp_dump_sysctl_handler(SYSCTL_HANDLER_ARGS) {