[RFC PATCH 0/3] rust: WMI abstractions

Gladyshev Ilya posted 3 patches 1 month, 3 weeks ago
There is a newer version of this series
drivers/platform/x86/Makefile        |   1 +
drivers/platform/x86/redmi_wmi_rs.rs |  60 ++++++
rust/bindings/bindings_helper.h      |   1 +
rust/kernel/acpi.rs                  | 103 +++++++++++
rust/kernel/lib.rs                   |   2 +
rust/kernel/wmi.rs                   | 267 +++++++++++++++++++++++++++
6 files changed, 434 insertions(+)
create mode 100644 drivers/platform/x86/redmi_wmi_rs.rs
create mode 100644 rust/kernel/wmi.rs
[RFC PATCH 0/3] rust: WMI abstractions
Posted by Gladyshev Ilya 1 month, 3 weeks ago
Overview
========
This patchset was developed some time ago out of pure curiosity
about the R4L project, but I believe it may still be useful, so
I decided to resume and post this work.
The goal of my curiosity is to develop a simple WMI driver in Rust
for unsupported laptop (I have some laying around) or, as a last
resort, submit a rewrite of redmi-wmi as a sample driver -- if that
would be acceptable.

I know that there is an undergoing API change in the WMI subsystem[1],
however it doesn't change the abstracted surface a lot.

This patchset consists of 3 patches:
1. Wrapper around ACPI objects (this may be unneeded after [1])
2. WMI abstractions
3. Sample driver for demonstration purposes only

Why RFC?
========
1. No real users for now
2. I have a feeling that I am doing something very wrong

[1]: https://lore.kernel.org/platform-driver-x86/20251220204622.3541-1-W_Armin@gmx.de/

Gladyshev Ilya (3):
  rust: implement wrapper for acpi_object
  rust: introduce WMI abstractions
  rust: sample driver for WMI demonstrations

 drivers/platform/x86/Makefile        |   1 +
 drivers/platform/x86/redmi_wmi_rs.rs |  60 ++++++
 rust/bindings/bindings_helper.h      |   1 +
 rust/kernel/acpi.rs                  | 103 +++++++++++
 rust/kernel/lib.rs                   |   2 +
 rust/kernel/wmi.rs                   | 267 +++++++++++++++++++++++++++
 6 files changed, 434 insertions(+)
 create mode 100644 drivers/platform/x86/redmi_wmi_rs.rs
 create mode 100644 rust/kernel/wmi.rs


base-commit: 9094662f6707d1d4b53d18baba459604e8bb0783
-- 
2.51.1.dirty
Re: [RFC PATCH 0/3] rust: WMI abstractions
Posted by Danilo Krummrich 1 month, 2 weeks ago
On Sun Dec 21, 2025 at 7:22 PM CET, Gladyshev Ilya wrote:
> Overview
> ========
> This patchset was developed some time ago out of pure curiosity
> about the R4L project, but I believe it may still be useful, so
> I decided to resume and post this work.
> The goal of my curiosity is to develop a simple WMI driver in Rust
> for unsupported laptop (I have some laying around) or, as a last
> resort, submit a rewrite of redmi-wmi as a sample driver -- if that
> would be acceptable.

It depends on the subsystem maintainer, please also see [1].

[1] https://rust-for-linux.com/rust-reference-drivers

> Why RFC?
> ========
> 1. No real users for now

Above it does sound like you are working on a new WMI driver as well?
Re: [RFC PATCH 0/3] rust: WMI abstractions
Posted by Gladyshev Ilya 1 month, 2 weeks ago
On 12/22/25 14:52, Danilo Krummrich wrote:
> On Sun Dec 21, 2025 at 7:22 PM CET, Gladyshev Ilya wrote:
>> Overview
>> ========
>> This patchset was developed some time ago out of pure curiosity
>> about the R4L project, but I believe it may still be useful, so
>> I decided to resume and post this work.
>> The goal of my curiosity is to develop a simple WMI driver in Rust
>> for unsupported laptop (I have some laying around) or, as a last
>> resort, submit a rewrite of redmi-wmi as a sample driver -- if that
>> would be acceptable.
> 
> It depends on the subsystem maintainer, please also see [1].
> 
> [1] https://rust-for-linux.com/rust-reference-drivers

Yes, I Cc'ed platform-drivers and WMI maintainer in a hope to gather 
their opinions.

>> Why RFC?
>> ========
>> 1. No real users for now
> 
> Above it does sound like you are working on a new WMI driver as well?
Well, I am planning to, but I can't guarantee any success at this point) 
So "no real users" is honest answer for now

But in a case if a) WMI subsystem is OK with reference drivers, and b) I 
fail to write a new driver, I will submit redmi-wmi-rs as a reference 
driver (since I can test it on my hardware).
Re: [RFC PATCH 0/3] rust: WMI abstractions
Posted by Armin Wolf 1 month, 2 weeks ago
Am 22.12.25 um 22:30 schrieb Gladyshev Ilya:

> On 12/22/25 14:52, Danilo Krummrich wrote:
>> On Sun Dec 21, 2025 at 7:22 PM CET, Gladyshev Ilya wrote:
>>> Overview
>>> ========
>>> This patchset was developed some time ago out of pure curiosity
>>> about the R4L project, but I believe it may still be useful, so
>>> I decided to resume and post this work.
>>> The goal of my curiosity is to develop a simple WMI driver in Rust
>>> for unsupported laptop (I have some laying around) or, as a last
>>> resort, submit a rewrite of redmi-wmi as a sample driver -- if that
>>> would be acceptable.
>>
>> It depends on the subsystem maintainer, please also see [1].
>>
>> [1] https://rust-for-linux.com/rust-reference-drivers
>
> Yes, I Cc'ed platform-drivers and WMI maintainer in a hope to gather 
> their opinions.
>
I am OK with you using the redmi-wmi driver as a reference driver. TBH i am very interested in having rust
abstractions for the WMI subsystem, however i currently have no clue about the rust programing language itself :(
I plan to complete a rust tutorial in the future, but till then i can give you only limited feedback.

>>> Why RFC?
>>> ========
>>> 1. No real users for now
>>
>> Above it does sound like you are working on a new WMI driver as well?
> Well, I am planning to, but I can't guarantee any success at this 
> point) So "no real users" is honest answer for now
>
> But in a case if a) WMI subsystem is OK with reference drivers, and b) 
> I fail to write a new driver, I will submit redmi-wmi-rs as a 
> reference driver (since I can test it on my hardware).

Fine with me.

Thanks,
Armin Wolf