From: bartu alev <bartualev@gmail.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Denis Benato" <denis.benato@linux.dev>
Cc: Corentin Chary <corentin.chary@gmail.com>,
"Luke D. Jones" <luke@ljones.dev>,
Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
linux-api@vger.kernel.org,
Denis Benato <benato.denis96@gmail.com>
Subject: Re: [PATCH v4 1/2] platform/x86: asus-wmi: add TUF keyboard RGB readback support
Date: Tue, 17 Nov 2026 01:00:20 +0300 [thread overview]
Message-ID: <228df241-da5e-49cb-b29f-6b9158557f55@gmail.com> (raw)
In-Reply-To: <cc9c8655-6f7c-05f9-ad09-4ea30f1dda95@linux.intel.com>
On 11/9/26 9:02 PM, Ilpo Järvinen wrote:
> What do you (or Denis) think on sashiko's mention about
> asus_wmi_evaluate_method_buf() casting integer.value to int which might
> end up aliasing high-bit on return values with errnos?
>
> The other caller seems to also return that value directly out of _store
> function().
Hi Ilpo and Denis,
I checked the DSDTs across 102 ASUS models we have dumped as well as the
UEFI/SMM path on my FA507NV (BIOS 318) to see what firmware actually
returns on the DSTS path:
1. Across the 102 DSDTs, no static DSTS branch returns 0xFFFFFFFF or
Ones. Models without 0x0010005B either hit a DSTS tail of
0xFFFFFFFE (15), fall through to WMNB's trailing 0xFFFFFFFE (45),
or return Zero (3 older models: GL553VD, GL553VE, FX505DT).
2. On modern models (including FA507NV, FX517, GA403, GA605WI), DSTS
delegates unlisted DEVIDs via WCHK/W15H (SW SMI 0xAA, cmd 0x9603).
Disassembling the FA507NV modules (AsusSmmService ->
AsusWmiToProtocol -> QuantaDxeWrapperPkg) shows that this dynamic
chain also returns 0 (unmatched consumer / missing table entry), 1,
capability/presence bits (e.g. 0x00010000 for 0x00100056/57), MMIO
reads, or 0xFFFFFFFE -- never 0xFFFFFFFF.
(Note: on FA507NV, 0x0010005B itself is static in AML and calls
EC0.KBLS(), while 0x00100056/57 go through WCHK/W15H and return
0x00010000 on DSTS.)
However, checking those tables did uncover one real mismatch and a clean
reason to still harden asus_wmi_evaluate_method_buf():
- On models like FX505DT, DSTS(0x00100056/57) returns 0x00010000 (so
kbd_rgb_mode/kbd_rgb_state are registered), while 0x0010005B hits the
DSTS tail Return (Zero). asus_wmi_evaluate_method_buf() turns 0 into
-ENODATA, so v4's `err < 0 ? err : -ENODEV` would return -ENODATA
instead of -ENODEV as documented in the ABI patch. The same happens
if W15H hits an unmatched consumer/table miss in SMM (returns 0).
- Even though 0xFFFFFFFF didn't show up in this set, an unseen BIOS or
SMM branch returning 0xFFFFFFFF or any bit-31-set integer would still
alias a negative errno in asus_wmi_evaluate_method_buf().
To avoid disturbing older devices, would a minimal approach like this be
acceptable for v5?
1. Add a small prep patch to asus_wmi_evaluate_method_buf() using a u32
retval: keep 0xFFFFFFFE -> -ENODEV and 0 -> -ENODATA as today, also
map (u32)~0 (0xFFFFFFFF) -> -ENODEV (matching asus_wmi_get_devstate()),
and return -ENODATA for any other unexpected integer (matching the
`default:` case; the only existing caller fan_curve_get_factory_default()
already treats any non-zero return as failure).
2. In kbd_rgb_read_status(), translate -ENODATA to -ENODEV so FX505DT /
0-returning firmware matches the ABI while preserving -EIO / -ENOSPC.
Thanks,
Bartu
next prev parent reply other threads:[~2026-11-16 22:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 23:48 [PATCH v4 0/2] platform/x86: asus-wmi: TUF keyboard RGB readback Bartu Alev
2026-10-28 23:48 ` [PATCH v4 1/2] platform/x86: asus-wmi: add TUF keyboard RGB readback support Bartu Alev
2026-11-09 18:02 ` Ilpo Järvinen
2026-11-10 2:50 ` Denis Benato
2026-11-10 11:43 ` Ilpo Järvinen
2026-11-16 22:00 ` bartu alev [this message]
2026-11-16 23:53 ` Denis Benato
2026-11-17 0:07 ` bartu alev
2026-11-17 2:24 ` Denis Benato
2026-10-28 23:48 ` [PATCH v4 2/2] Documentation/ABI: asus-wmi: document TUF keyboard RGB attributes Bartu Alev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=228df241-da5e-49cb-b29f-6b9158557f55@gmail.com \
--to=bartualev@gmail.com \
--cc=benato.denis96@gmail.com \
--cc=corentin.chary@gmail.com \
--cc=denis.benato@linux.dev \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.