Skip to main content

Adjust power management settings for Ryzen CPUs on Linux and Windows

Project description

ZenMaster

PyPI Python License Platform

Overview

ZenMaster adjusts power management settings for AMD Ryzen CPUs and APUs on Linux and Windows. It uses the same CLI as RyzenAdj, so your existing commands and presets keep working, but you install it with pip and never need a compiler. Set power limits, temperature limits, VRM currents, clocks, voltages and Curve Optimizer offsets without touching the BIOS.

pip install zenmaster

Reasons to use it over RyzenAdj:

  • Installs with pip — no cmake, libpci, or building from source
  • Same --name=value syntax, so scripts and presets carry over unchanged
  • Uses PawnIO on Windows instead of WinRing0, which has known CVEs
  • --help lists only the arguments your CPU supports, not every possible option
  • --table shows a labeled sensor table; --json makes the output scriptable
  • --reapply=N keeps your settings applied so other software can't undo them
  • Works as a Python library — import zenmaster — on both Linux and Windows
  • No mandatory third-party dependencies on either platform

Compatibility

Platform Status
Linux, Python 3.10+, root Supported — ryzen_smu module or PCI direct access
Windows, Python 3.10+, Administrator Supported — PawnIO driver
Intel Not supported

[!NOTE] On Linux, PCI direct access works on most systems without any kernel module. ryzen_smu is only required when Secure Boot is enabled, because kernel lockdown blocks raw PCI access. Install ryzen_smu ≥ 0.1.7 and enroll the signing key in that case.

[!WARNING] This tool writes directly to the CPU's System Management Unit. Wrong values can cause instability, throttling, or a hard lock. Use at your own risk.


How it compares to RyzenAdj

ZenMaster keeps RyzenAdj's argument names and SMU opcode semantics, so it is a drop-in replacement for most use cases, while removing the build step and the WinRing0 driver.

RyzenAdj ZenMaster
Install Build from source (cmake, pkg-config, libpci) pip install zenmaster
Language C Pure Python 3.10+
Windows driver WinRing0 ⚠️ PawnIO ✅
--help Static — lists every argument Dynamic — only your CPU's arguments
Output Plain text Plain text or --json
PM table Raw float dump Labeled fields with units (--table)
Use as a library Link the C libryzenadj / shell out import zenmaster
Build dependencies cmake, make, libpci None
Focus "Ryzen Mobile Processors" Ryzen mobile and desktop

On WinRing0

RyzenAdj's Windows backend uses WinRing0 (OlsApi / OpenLibSys), a driver with well-documented vulnerabilities (CVE-2020-14979, CVE-2021-41285). It grants any unprivileged process full read/write access to physical memory, PCI config space, and I/O ports, and several AV vendors flag it outright.

ZenMaster uses PawnIO instead — a purpose-built, Microsoft-signed kernel driver that exposes a narrow IOCTL interface. No raw physical-memory access, no known CVEs.


Installation

Linux

pip install zenmaster

Requires root, and either the ryzen_smu kernel module or PCI direct access (used automatically when available).

Install ryzen_smu (only needed when Secure Boot is on):

git clone https://github.com/amkillam/ryzen_smu
cd ryzen_smu && make && sudo make install
sudo modprobe ryzen_smu

Apply a preset:

sudo zenmaster --stapm-limit=15000 --fast-limit=20000 --tctl-temp=90

Re-apply every 30 seconds:

sudo zenmaster --stapm-limit=15000 --reapply=30

Windows

  1. Install PawnIO and reboot.
  2. Open an Administrator terminal.
pip install zenmaster
zenmaster --stapm-limit=15000 --fast-limit=20000 --tctl-temp=90

CLI

zenmaster [OPTIONS] [TUNING ARGS...]
Option Description
--help Show the tuning arguments supported by your CPU
--info Detected CPU name, family, socket, and active backend
--table Live PM table with labeled values
--dump-table Raw PM table floats with hex offsets
--json Machine-readable JSON output
--reapply=N Re-apply settings every N seconds
--version Show the installed version and check PyPI for a newer release

Tuning arguments use the same --name=value form as RyzenAdj. Arguments that take no value (--enable-oc, --power-saving, --get-*, …) are passed as bare flags. The --get-* query commands print the value the SMU returns:

$ sudo zenmaster --get-pbo-scalar
get-pbo-scalar [RSMU 0x6D] -> OK = 42 (0x0000002A)

Check what your CPU supports:

$ zenmaster --help

ZenMaster — Ryzen Power Management Tool

Usage: zenmaster [OPTIONS] [TUNING ARGS...]

Tuning arguments for AMD Ryzen 9 7950X (Raphael, AM5_V1):

  Power limits:
    --stapm-limit=<mW>                 Sustained Power Limit — STAPM LIMIT
    --fast-limit=<mW>                  Actual Power Limit — PPT LIMIT FAST
    --slow-limit=<mW>                  Average Power Limit — PPT LIMIT SLOW
    ...

Live PM table (APU / mobile):

$ sudo zenmaster --table

PM Table Version: 0x00450005
+-------------------------+-----------+------------------------+
| STAPM LIMIT             |    15.000 | stapm-limit            |
| STAPM VALUE             |    12.441 |                        |
| PPT LIMIT FAST          |    20.000 | fast-limit             |
| THM LIMIT CORE          |    90.000 | tctl-temp              |
| THM VALUE CORE          |    67.125 |                        |
+-------------------------+-----------+------------------------+

Library usage

ZenMaster is built to be embedded in tuning utilities, dashboards, and automation tools — including from non-Python apps via the --json CLI.

import zenmaster
from zenmaster import detect, apply, smu

print(zenmaster.__version__)

info = detect()
print(info.name, info.family)

try:
    backend = smu.init()
    print(backend)
except RuntimeError as e:
    print(f"SMU unavailable: {e}")
    raise SystemExit(1)

results, rejected = apply("--stapm-limit=15000 --tctl-temp=90", info.family)
for r in results:
    print(r["arg"], smu.status_name(r["status"]))

apply("--enable-oc", info.family)

if smu.pm_table_supported(info.family):
    data = smu.read_pm_table(info.family)
    ver  = smu.read_pm_table_version(info.family)

smu.send_mp1(info.family, 0x05, 15000)
smu.send_rsmu(info.family, 0x31, 90)

Look up supported args for a CPU (no privileges needed):

from zenmaster import runner

print(runner.get_supported_args("Renoir"))
print(runner.lookup("Renoir", "stapm-limit"))
print(runner.is_flag_arg("enable-oc"))
print(runner.is_flag_arg("stapm-limit"))

A full runnable example lives in examples/demo.py.

For integrators:

  • The package ships type hints (py.typed) — your type checker sees the full API.
  • smu.init() raises BackendUnavailable on failure; SMU calls before init raise SMUNotInitialized. Both subclass ZenMasterError, which subclasses RuntimeError, so you can catch as narrowly or broadly as you like.
  • apply() returns list[ApplyResult] — each result is a dict with the stable keys arg, value, mailbox, opcode, status, error, returned. error is None on success; returned holds the value from a get-* query.
  • SMU status codes are smu.SmuStatus (an IntEnum); smu.status_name(code) gives a label.
from zenmaster import smu, BackendUnavailable

try:
    smu.init()
except BackendUnavailable as e:
    ...  # no driver / not root / Secure Boot — message explains which

Install with dev dependencies:

pip install "zenmaster[dev]"
pytest

Updating

ZenMaster updates through pip:

pip install -U zenmaster

To check whether a newer release is on PyPI without updating:

zenmaster --version

From code, zenmaster.check_update() returns the newer version string, or None if you are current.


Supported CPUs

Covers first-gen Ryzen (Summit Ridge / Zen 1) through Ryzen 9000 and Strix Halo. Run zenmaster --info to confirm detection and socket mapping.

PM table support (--table): Raven Ridge, Picasso, Dali, Pollock, Renoir, Lucienne, Cezanne/Barcelo, Van Gogh (Steam Deck), Mendocino, Rembrandt, Phoenix Point, Hawk Point, Strix Point, Krackan Point, Strix Halo. On Linux it reads through the ryzen_smu module when loaded, otherwise over PCI direct (/dev/mem, subject to kernel CONFIG_STRICT_DEVMEM).


Requirements

Linux Windows
Python 3.10+ 3.10+
Privileges root Administrator
Driver ryzen_smu module or PCI direct PawnIO
Extra deps None None

Acknowledgments

Project Contribution
RyzenAdj Canonical argument names and SMU opcode semantics
UXTU4Linux SMU opcode tables and Linux backend reference
Universal x86 Tuning Utility Windows PawnIO path and CPU detection approach
ryzen_smu Linux kernel module for SMU access
PawnIO Modern signed Windows kernel driver

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zenmaster-0.3.0.tar.gz (57.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zenmaster-0.3.0-py3-none-any.whl (54.2 kB view details)

Uploaded Python 3

File details

Details for the file zenmaster-0.3.0.tar.gz.

File metadata

  • Download URL: zenmaster-0.3.0.tar.gz
  • Upload date:
  • Size: 57.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zenmaster-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fe0d4d64dce0f5ce18dfd8249f3ec6ae972f08f16aff56bef72b3052713cf4eb
MD5 b38bab9ddad8ab2b2147aaf07150e15e
BLAKE2b-256 8ec3fd7a12e181c121a1081c0587acbf4ecc198a87376a26322960c9787bd2f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenmaster-0.3.0.tar.gz:

Publisher: publish.yml on HorizonUnix/ZenMaster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zenmaster-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: zenmaster-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 54.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zenmaster-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be256914c0c307005f5643f26adb9c70eda2df3cd0d5cd81a28f275cedf90d79
MD5 9bc68111d9699aaa3cc6bdb1544459e4
BLAKE2b-256 2a815fe6027e91a57814dbdb294e59e181f36516ffbb557fbef266a9914a1705

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenmaster-0.3.0-py3-none-any.whl:

Publisher: publish.yml on HorizonUnix/ZenMaster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page