* [RFC PATCH v2 0/2] platform/x86: huawei-wmi: native Turbo profiles with capability detection
@ 2026-11-18 16:13 Fuwei Xie
2026-11-18 22:19 ` Eren Özen
2026-11-24 16:25 ` Zheng Shuyang
0 siblings, 2 replies; 3+ messages in thread
From: Fuwei Xie @ 2026-11-18 16:13 UTC (permalink / raw)
To: hansg, ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel, erenozen
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH v2 0/2] platform/x86: huawei-wmi: native Turbo profiles with capability detection
2026-11-18 16:13 [RFC PATCH v2 0/2] platform/x86: huawei-wmi: native Turbo profiles with capability detection Fuwei Xie
@ 2026-11-18 22:19 ` Eren Özen
2026-11-24 16:25 ` Zheng Shuyang
1 sibling, 0 replies; 3+ messages in thread
From: Eren Özen @ 2026-11-18 22:19 UTC (permalink / raw)
To: Fuwei Xie; +Cc: hansg, ilpo.jarvinen, platform-driver-x86, linux-kernel
Hi Fuwei,
I retested v2 on the same HUAWEI MateBook 16 (AMD Ryzen 7 5800H, DMI
product name "CREM-WXX9", BIOS 2.32), this time without any DMI entry.
I applied both patches unmodified on top of c339f4010dea and built the
driver as a module for a 7.2-based kernel.
- The capability check finds \GTUB and \STUB, and the profile device is
registered. Loading the module did not change the firmware mode
(checked by reading \GTUB before and after).
- platform_profile_choices is "balanced performance", and writing either
value switches the firmware mode (read back through \GTUB).
- GNOME's Power Mode menu (tuned-ppd) switches between the two.
- Fn+P updates platform_profile in both directions, and 0x2a0/0x2a1 are
not logged as "Unknown key pressed".
- When the charger is unplugged in performance mode, platform_profile
follows the firmware back to balanced.
- On battery, writing "performance" fails and the mode stays balanced.
- After plugging the charger back in, platform_profile still matches the
firmware.
- The driver logged no warnings during the test.
One small thing: after Fn+P, platform_profile changes to performance,
but GNOME's menu (Fedora's tuned-ppd) keeps showing balanced. It was the
same with v1. I haven't checked whether tuned-ppd listens for this
change.
About your first question, on this laptop the capability check is what
made the difference. v1 needed an extra DMI entry here, and v2 works
without any change.
Tested-by: Eren Özen <erenozen@protonmail.com> # MateBook 16 CREM-WXX9, BIOS 2.32
Thanks,
Eren
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH v2 0/2] platform/x86: huawei-wmi: native Turbo profiles with capability detection
2026-11-18 16:13 [RFC PATCH v2 0/2] platform/x86: huawei-wmi: native Turbo profiles with capability detection Fuwei Xie
2026-11-18 22:19 ` Eren Özen
@ 2026-11-24 16:25 ` Zheng Shuyang
1 sibling, 0 replies; 3+ messages in thread
From: Zheng Shuyang @ 2026-11-24 16:25 UTC (permalink / raw)
To: Fuwei Xie
Cc: Hans de Goede, Ilpo Järvinen, Eren Özen,
platform-driver-x86, linux-kernel
Hi Fuwei,
I tested RFC v2 on an HONOR MagicBook Pro 14 (2025, Mainland China SKU C233,
DMI: HONOR / FMB-P, Intel Core Ultra 5 225H, BIOS 1.16) running Arch Linux
(kernel 7.3.5-arch1-1, power-profiles-daemon 0.30). Both patches applied
cleanly to v7.3's drivers/platform/x86/huawei-wmi.c and built as a module
without warnings.
Test results:
- Capability detection found \GTUB and \STUB and registered platform_profile
("balanced performance") without altering the active mode (remained
performance / GTUB=1 across module load).
- Writing "balanced" / "performance" via sysfs and switching via
powerprofilesctl (balanced, performance, power-saver) updated GTUB and
flipped Intel DPTF INTC1042:00 odvp1/odvp2 as expected.
- Fn+P updated both /sys/firmware/acpi/platform_profile and
power-profiles-daemon 0.30 (powerprofilesctl get) immediately, with no
"Unknown key pressed" logs for 0x02a0/0x02a1/0x02a6. (Unlike Eren's
tuned-ppd observation, stock ppd 0.30 followed Fn+P right away.)
- Unplugging AC in performance mode dropped platform_profile, ppd, GTUB,
and ODVP back to balanced.
- s2idle suspend/resume preserved consistent profile state and switching
continued to work afterward. Existing features (battery thresholds,
fn_lock_state, micmute LED) and module unload/reload were clean.
Regarding your questions:
1. Capability gate: On this HONOR Arrow Lake unit, probing \GTUB/\STUB
worked out of the box without any DMI allowlist.
2. Keeping 0x2a6 in the refresh path: Strongly yes. On FMB-P BIOS 1.16,
0x2a6 is also emitted when a mode switch is rejected (on battery or
below 20% charge). Moreover, writing "performance" to platform_profile
on battery returned 0 in ~0.8 ms because \STUB writes CRWM=1
synchronously and the immediate \GTUB readback at 0.9 ms still sees 1;
within ~50 ms (observed at 51.8 ms) the EC asynchronously reverts CRWM
to 0 and emits 0x2a6. Having 0x2a6 trigger the deferred refresh is what
brought both platform_profile and power-profiles-daemon back to balanced.
(Note: BIOS 1.16 can also emit 0x2a5 for TBF2-restricted transitions.)
Tested-by: Zheng Shuyang <yhshzh0@gmail.com> # HONOR MagicBook Pro 14 (FMB-P), BIOS 1.16
Thanks,
Zheng Shuyang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-24 16:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 16:13 [RFC PATCH v2 0/2] platform/x86: huawei-wmi: native Turbo profiles with capability detection Fuwei Xie
2026-11-18 22:19 ` Eren Özen
2026-11-24 16:25 ` Zheng Shuyang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®