[RFC PATCH v2 0/2] platform/x86: huawei-wmi: native Turbo profiles with capability detection
From: Fuwei Xie
Date: Wed Nov 18 2026 - 16:48:51 EST
Hi Hans, Ilpo, and Eren,
This is RFC v2. Thank you for the comments on v1.
1. What this series does
It exposes the firmware's own Turbo mode through platform_profile, so
the desktop power mode control can switch it.
The driver only maps states and refreshes what it reports. It does not
write RAPL limits, does not force a fixed wattage, and does not add a
background daemon.
2. What changed since v1
2.1 Capability detection instead of an allowlist.
v1 only worked on the exact model and BIOS I happened to own. The
driver now checks, inside the Huawei WMI method device, that both
GTUB and STUB exist and that a query returns a known state (0 or 1).
The probe never changes the mode. If the check fails, no profile
device is created and the rest of the driver keeps working as before.
2.2 Short firmware replies are accepted.
Some of the existing features receive short WMI packages. The
transaction now accepts a package that is short but still contains a
complete result, and requires GTUB/STUB to be ACPI methods before the
Turbo query is attempted.
2.3 Event handling follows Eren's observations.
Eren reported firmware that returns status zero while refusing a
request, that turns Turbo off on unplug without sending 0x2a0, and
that sends two 0x2a1 events for one set. The read-back after a set,
the power-supply notifier and the deferred refresh already cover all
three cases.
3. What the two patches do
Patch 1 keeps the two-call WMI handshake under the driver mutex, frees
each reply before a retry, checks the payload shape and rejects replies
that are too short to be complete.
Patch 2 adds the Turbo get/set helpers, registers platform_profile with
balanced and performance, and refreshes the reported state on WMI
events, power-supply changes and resume.
4. What I tested
4.1 Switching, on two systems.
Ubuntu 26.04 (7.0.0-43) and Ubuntu 26.10 (7.3.0-10), NbF-XX BIOS
3.07, Intel i5-1240P. The earlier runs used MOK-signed modules with
Secure Boot enabled. The final v2 revision was re-tested on 26.10
with Secure Boot disabled, after the module's MOK signature had been
verified.
On both systems: native switching, all three desktop modes, Fn+P in
both directions, unplug and replug, battery power-saver, and one
suspend/resume cycle passed. Each run restored the original module,
the daemon and the original mode.
4.2 Load, three desktop modes, 60 seconds each.
Last-window package power:
Ubuntu 26.04: 10.21 / 20.21 / 28.02 W
Ubuntu 26.10: 9.94 / 19.97 / 25.20 W
(power-saver / balanced / performance)
Power-saver produced only 8 and 9 late samples, below my own
10-sample bar, so those two numbers are descriptive only. This
machine exposes no fan RPM sensor, so fan behaviour is not measured.
4.3 The 25.20 W figure depends on thermald, not on this driver.
Ubuntu's thermald 2.5.12-1 holds PL1 at a ceiling the firmware
declares. With thermald_next (8eeddcff786b, which includes
f9411e884698 "cdev_rapl: put PL1 at the PL1MAX ceiling when the
device is not throttling") the same mode returned about 28 W on the
same laptop. So the ceiling I measure is set outside this driver.
That fix is currently in the thermald_next development branch only;
it is not in a released thermald package yet, so reproducing the
28 W result currently needs that branch built locally.
4.4 Build and host tests.
Both commits build as modules with W=1 against Ubuntu 7.0.0-43 and
7.3.0-10 headers. 47 host-side cases passed with ASan and UBSan,
covering missing methods, wrong ACPI object types, short replies,
retries, silent refusal, and read-only probing.
5. What I did not test
- any other model, BIOS version or firmware revision
- machines without GTUB/STUB; the series should leave those untouched,
but I could not verify it
- long runs, repeated suspend cycles, or concurrent stress
- fan RPM
6. Separate change: PPD state cache
With only balanced and performance exposed by the firmware,
power-profiles-daemon 0.30 maps power-saver to balanced but remembers
the desktop mode that was asked for. A later balanced notification can
then reset the desktop selection.
I reproduced this in isolated PPD integration tests without the Huawei
module, and caching the mapped platform mode fixes it. All 129
integration tests passed on both systems. That change belongs to PPD
and is not part of these kernel patches. Power-saver used firmware
balanced and CPU EPP power in the hardware tests.
7. About Eren's test
Eren reported that v1 plus a CREM-WXX9 / BIOS 2.32 DMI entry works on
his Ryzen 7 5800H MateBook 16, with tuned-ppd, Fn+P and AC transitions.
That report is why I moved from an allowlist to capability detection.
That result is not carried into v2 as a Tested-by, because the probe
changed. A retest of this version on CREM-WXX9 would be welcome.
8. Questions
1. Is a capability gate on GTUB/STUB acceptable, or would you prefer a
DMI quirk list in addition?
2. Should 0x2a6 stay in the refresh path, even though its meaning is
only known on one firmware? I do not assign it a general meaning.
3. Would you like these two patches split differently, for example the
transport fix sent on its own first?
9. AI assistance
OpenAI Codex helped with firmware analysis, the code changes, test
tooling and wording, in a debugging session that I directed. I set the
scope and ran the hardware tests; the observations above are mine.
Thanks,
Fuwei
Fuwei Xie (2):
platform/x86: huawei-wmi: serialize WMI retries and validate responses
platform/x86: huawei-wmi: expose native Turbo mode as platform_profile
drivers/platform/x86/Kconfig | 1 +
drivers/platform/x86/huawei-wmi.c | 328 ++++++++++++++++++++++++++++++--------
2 files changed, 261 insertions(+), 68 deletions(-)
base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
--
2.53.0