From: Denis Benato <denis.benato@linux.dev>
To: "bartu alev" <bartualev@gmail.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
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 00:53:34 +0100 [thread overview]
Message-ID: <def9fb29-3212-4d1f-8041-4bbb1c18e89e@linux.dev> (raw)
In-Reply-To: <228df241-da5e-49cb-b29f-6b9158557f55@gmail.com>
On 11/16/26 23:00, bartu alev wrote:
> 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).
Not good.
> - 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().
Yeah this much is clear, as I said we are lucky asus isn't using the
most significant bit on wmi dev id we support.
> 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.
Yes, it's absolutely reasonable. If the return either doesn't have the
presence bit set or is 0xFFF..... it is to be counted as "not implemented".
And also yes, we should respect ABIs whenever possible...
However... now that I think about it asus_wmi_evaluate_method_buf() can
be used on setters and those don't have the presence bit, do we have that
covered?
> Thanks,
> Bartu
next prev parent reply other threads:[~2026-11-16 23:53 UTC|newest]
Thread overview: 9+ 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
2026-11-16 23:53 ` Denis Benato [this message]
2026-11-17 0:07 ` bartu alev
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=def9fb29-3212-4d1f-8041-4bbb1c18e89e@linux.dev \
--to=denis.benato@linux.dev \
--cc=bartualev@gmail.com \
--cc=benato.denis96@gmail.com \
--cc=corentin.chary@gmail.com \
--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 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®