Open-source developer Armin Wolf has been working most recently on marshalling support for the Windows Management Instrumentation (WMI) platform code within the Linux kernel. This WMI marshalling support is to better match the behavior of Microsoft Windows’ WMI ACPI driver and ultimately to allow for better compatibility with some ACPI firmware and enhancing some WMI drivers.
The WMI marshalling support is up to its second post-RFC revision for this effort to better match the handling of Windows’ WMI ACPI driver. Wolf explained in this weekend’s v2 patch series about the work:
“The Windows WMI-ACPI driver likely uses wmilib to interact with the WMI service in userspace. Said library uses plain byte buffers for exchanging data, so the WMI-ACPI driver has to convert between those byte buffers and ACPI objects returned by the ACPI firmware.
The format of the byte buffer is publicly documented, and after some reverse [engineering] of the WMI-ACPI driver using a set of custom ACPI tables, the following conversion rules have been discovered:
– ACPI integers are always converted into a uint32
– ACPI strings are converted into special WMI strings
– ACPI buffers are copied as-is
– ACPI packages are unpackedExtending the ACPI-WMI to perform this kind of marshalling for WMI data blocks, methods and events would give us a number of benefits:
– WMI drivers are not restricted to a fixed set of supported ACPI data types anymore, see dell-wmi-aio (integer vs buffer) and hp-wmi-sensors (string vs buffer)
– correct marshalling of WMI strings when data blocks are marked as requiring ACPI strings instead of ACPI buffers
– development of WMI drivers without having to understand ACPI
This eventually should result in better compatibility with some ACPI firmware implementations and in simpler WMI drivers.
The first patch extends the WMI driver core to perform said marshalling as well as a new API not based on ACPI objects. The next patch adds a KUnit test for testing the marshalling code. The following two patches then add a set of helper functions for dealing
with WMI string data together with another KUnit test.The remaining patches then convert some simple WMI drivers to use the new WMI API and update the driver development guide so that new WMI drivers stop using the ACPI-based API.
The series has been tested on multiple machines, with the xiaomi-wmi and intel-wmi-sbl-fw-update being tested using a set of custom ACPI tables loaded over configFS.”
By better mirroring the Microsoft Windows behavior should ultimately help out with the WMI drivers in better supporting newer hardware, particularly laptops, on Linux. The code remains under review and testing on the kernel mailing list.
