From nobody Fri Feb 6 16:23:19 2026 X-Original-To: dev-commits-src-main@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 4f6zsg3g9Dz6RPgC for ; Fri, 06 Feb 2026 16:23:19 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f6zsg2rslz42nv for ; Fri, 06 Feb 2026 16:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770394999; 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=G1w5qx63vAr0jOvhcTsRx29C7EDlWNkAQkVY4daMdDI=; b=r8ZAAWHFgChieamV4npPcK/6RbciKi3tK4SdYJLvZ4oUbzAXKLwKcZLe5AyG88wiGVCmkg KG2QAKe6bCTCXpI5+KysrdaFDIjHFxw47w/1LRjsAWz/8IwkPzkHYV7nf9zrMqBeCMkz19 L1NEbuFtUVhkS1VGYRbRoU0FplBIHzRRs6dT0oXKP+3sluOeRnvYkDssnedGWFtF/9QE6l SN6zZp/OpOh9paTM+C2yGBETd40hlieatrzyOBgaEWsCyYu58A02Sm6Iq/oLmlglxNTq1I E1Q8tHrBKC7LilE1gx74GYO1vMSON6U9Iin4ckwTX1u4Zd49B6xuAdGuuyYJqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770394999; a=rsa-sha256; cv=none; b=E3/UBERuBzLTshYTJjnO46kPl4W1hv1HjGa3nHDC7xQZUZY4tJ8yGJ7LAu7iLyHkUsEo/q PhQJ58yyliMx1BuKkj9GvvgWO7oiL7Dv10zJoQtqD6foXFy//WSfpub7Sts8ijCmF8pTfZ qc5N2VSOXMxsLSFKw2XheBuVjuCzFG2sYKIPloHomRdZ6WCuAo+scb8M4t9CQnZnyDwwrJ suMF7hKl42XCLCNl8xaVwc/oIRTO18yJMqwrizbEyr46ojCqyBinbi5ccG0A7zUyax7MoN 7VPwOchSL5DONz73StSN0ryWO4lfNDtf/tZ3mfDURRjLBmamyLTn8uHXduLgxg== 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=1770394999; 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=G1w5qx63vAr0jOvhcTsRx29C7EDlWNkAQkVY4daMdDI=; b=e/A/Z1jxL+kVTSGzmyT7ioA2pW4P+LzcnOtbKFOuTNhWmnHosSLUolYNvUbDZLALrq4f7R qo2GCqTTJwnLy8PZZSgNtsg7hTUiIMaDBEJBMMiIPzQw6FuzDCzIZJnuAy8mkKuYZbmOTx taQmW+AqeNPOostGyT7hONTo+w/YIaT4buX2+9+8tRMAWKe3wpyOfuCFDNjaTgL45IQE/s PuRx7vMkq1YEESD2ioa9DCq34Lts/RpHQ1wI6UBNylXmeroxu5TbW1ARUgUqRt+M0USj4N QMAuATu0qc4d+4gvKd5+HxcIEQFND/j6E0nS3BG9Rcssr8/nKHQUY3lLoQcIkw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f6zsg2LYSz7fc for ; Fri, 06 Feb 2026 16:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1d172 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 06 Feb 2026 16:23:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 804329587508 - main - hwpstate{_amd,intel}(4): Move common knobs to a separate file List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 8043295875083b57a6b7b2dc6826fde4cf4e1ba1 Auto-Submitted: auto-generated Date: Fri, 06 Feb 2026 16:23:19 +0000 Message-Id: <69861577.1d172.fd5fa27@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=8043295875083b57a6b7b2dc6826fde4cf4e1ba1 commit 8043295875083b57a6b7b2dc6826fde4cf4e1ba1 Author: Olivier Certner AuthorDate: 2026-02-06 10:58:07 +0000 Commit: Olivier Certner 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 +#include + #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 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) {