Date: Fri, 06 Feb 2026 16:23:19 +0000
From: Olivier Certner <olce@FreeBSD.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject: git: 804329587508 - main - hwpstate{_amd,intel}(4): Move common knobs to a separate file
Message-ID: <69861577.1d172.fd5fa27@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=8043295875083b57a6b7b2dc6826fde4cf4e1ba1 commit 8043295875083b57a6b7b2dc6826fde4cf4e1ba1 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2026-02-06 10:58:07 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2026-02-06 16:23:07 +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 --- sys/conf/files.x86 | 1 + sys/modules/cpufreq/Makefile | 3 ++- sys/x86/cpufreq/hwpstate_amd.c | 11 ++--------- 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(+), 15 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 d8ad090a6a58..0afc0919aa16 100644 --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -68,6 +68,8 @@ #include <dev/acpica/acpivar.h> +#include <x86/cpufreq/hwpstate_common.h> + #include "acpi_if.h" #include "cpufreq_if.h" @@ -162,10 +164,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"); @@ -176,11 +174,6 @@ SYSCTL_BOOL(_debug, OID_AUTO, hwpstate_pstate_limit, CTLFLAG_RWTUN, "If enabled (1), limit administrative control of P-states to the value in " "CurPstateLimit"); -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 bool hwpstate_amd_cppc_enable = true; SYSCTL_BOOL(_machdep, OID_AUTO, hwpstate_amd_cppc_enable, CTLFLAG_RDTUN, &hwpstate_amd_cppc_enable, 0, 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 <olce@FreeBSD.org> at Kumacom + * SARL under sponsorship from the FreeBSD Foundation. + */ + +#include <sys/sysctl.h> + +#include <x86/cpufreq/hwpstate_common.h> + + +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 <olce@FreeBSD.org> 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 <dev/acpica/acpivar.h> +#include <x86/cpufreq/hwpstate_common.h> #include <x86/cpufreq/hwpstate_intel_internal.h> #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) {home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69861577.1d172.fd5fa27>
