HomeFreeBSD

hwpstate: add CPPC support for pstate driver on AMD

Description

hwpstate: add CPPC support for pstate driver on AMD

Implement CPPC interface for AMD Pstate Driver.
This feature is only enabled when the CPUID shows it support CPPC.

The CPPC is implemneted by the following steps:

  1. Write MSR to enable it.
  2. Read capability registert which indicates binary value of levels

about lowest, best energy efficient, guarantee, and max performance.

  1. Write request register with epp in energy balanced mode. And let

CPU and firmware to enter autonomous mode.

Also, create a sysctl handler to allow userspace to change epp value.
In intel's hwpstate, The epp value can be in package level and core level.
However, in AMD's one, there is only core level. Thus, to sync with the
intel's code, we implement package level control in software and provide
another sysctl (machdep.hwpstate_pkg_ctrl) to control it.

Reviewed by: olce, khng
Approved by: lwhsu (mentor)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49587

Details

Provenance
aokblastAuthored on Jul 8 2025, 11:45 AM
Reviewer
olce
Differential Revision
D49587: hwpstate: add CPPC support for pstate driver on AMD
Parents
rG62a7fdc13ab4: bsd.sys.mk: suppress another gcc warning for libc++
Branches
Unknown
Tags
Unknown