platform/x86: wmi: Prepare for future changes
Subsystems (4)
Armin Wolf
maintainercover platform/x86: wmi: Prepare for future changes
After over a year of reverse engineering, i am finally ready to introduce support for WMI-ACPI marshalling inside the WMI driver core. Since the resulting patch series is quite large, i am planning to submit the necessary patches as three separate patch series.
This is supposed to be the first of the three patch series. Its main purpose is to prepare the WMI driver core for the upcoming changes. The first patch fixes an issue inside the nls utf16 to utf8 conversion code, while the next two patches fix some minor issues inside the WMI driver core itself. The last patch finally moves the code of the WMI driver core into a separate repository to allow for future additions without cluttering the main directory.
Armin Wolf (4):
fs/nls: Fix utf16 to utf8 conversion
platform/x86: wmi: Use correct type when populating ACPI objects platform/x86: wmi: Remove extern keyword from prototypes platform/x86: wmi: Move WMI core code into a separate directory
Documentation/driver-api/wmi.rst | 2 +-
MAINTAINERS | 2 +-
drivers/platform/x86/Kconfig | 30 +------------------
drivers/platform/x86/Makefile | 2 +-
drivers/platform/x86/wmi/Kconfig | 34 ++++++++++++++++++++++
drivers/platform/x86/wmi/Makefile | 8 +++++
drivers/platform/x86/{wmi.c => wmi/core.c} | 34 +++++++++++++---------
fs/nls/nls_base.c | 16 +++++++---
include/linux/wmi.h | 15 ++++------
9 files changed, 84 insertions(+), 59 deletions(-)
create mode 100644 drivers/platform/x86/wmi/Kconfig
create mode 100644 drivers/platform/x86/wmi/Makefile
rename drivers/platform/x86/{wmi.c => wmi/core.c} (98%)Signature · 1 line
2.39.5
Armin Wolf
maintainerPATCH 1/4 fs/nls: Fix utf16 to utf8 conversion
Currently the function responsible for converting between utf16 and utf8 strings will ignore any characters that cannot be converted. This however also includes multi-byte characters that do not fit into the provided string buffer.
This can cause problems if such a multi-byte character is followed by a single-byte character. In such a case the multi-byte character might be ignored when the provided string buffer is too small, but the single-byte character might fit and is thus still copied into the resulting string.
Fix this by stop filling the provided string buffer once a character does not fit. In order to be able to do this extend utf32_to_utf8() to return useful errno codes instead of -1.
--- fs/nls/nls_base.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
fs/nls/nls_base.c +12 -4
@@ -94,7 +94,7 @@ int utf32_to_utf8(unicode_t u, u8 *s, int maxout) l = u;if (l >UNICODE_MAX || (l &SURROGATE_MASK ) ==SURROGATE_PAIR ) -return -1 ; +return -EILSEQ ; nc =0 ;for (t = utf8_table; t->cmask && maxout; t++, maxout--) {
@@ -110,7 +110,7 @@ int utf32_to_utf8(unicode_t u, u8 *s, int maxout)return nc; } } -return -1 ; +return -EOVERFLOW ; }EXPORT_SYMBOL (utf32_to_utf8);
@@ -217,8 +217,16 @@ int utf16s_to_utf8s(const wchar_t *pwcs, int inlen, enum utf16_endian endian, inlen--; } size =utf32_to_utf8 (u, op, maxout); -if (size ==-1 ) { -/* Ignore character and move on */ +if (size <0 ) { +if (size == -EILSEQ ) { +/* Ignore character and move on */ +continue ; + } +/* +* Stop filling the buffer with data once a character +* does not fit anymore. +*/ +break ; }else { op += size; maxout -= size;
Signature · 1 line
2.39.5
Armin Wolf
maintainerPATCH 2/4 platform/x86: wmi: Use correct type when populating ACPI objects
In reply to Armin WolfWhen evaluating a WMxx/WSxx ACPI control method, the data buffer either needs to be passed as an ACPI buffer or as an ACPI string. Use the correct type (buffer/string) when populating the associated ACPI object.
--- drivers/platform/x86/wmi.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
drivers/platform/x86/wmi.c +20 -14
@@ -142,14 +142,6 @@ static inline void get_acpi_method_name(const struct wmi_block *wblock, buffer[4 ] ='\0' ; } -static inline acpi_object_type get_param_acpi_type (const struct wmi_block *wblock) -{ -if (wblock->gblock.flags &ACPI_WMI_STRING ) -return ACPI_TYPE_STRING ; -else -return ACPI_TYPE_BUFFER ; -} -static int wmidev_match_guid (struct device *dev,const void *data) {struct wmi_block *wblock =dev_to_wblock (dev);
@@ -351,9 +343,16 @@ acpi_status wmidev_evaluate_method(struct wmi_device *wdev, u8 instance, u32 met params[0 ].integer.value = instance; params[1 ].type =ACPI_TYPE_INTEGER ; params[1 ].integer.value = method_id; - params[2 ].type =get_param_acpi_type (wblock); - params[2 ].buffer.length = in->length; - params[2 ].buffer.pointer = in->pointer; + +if (wblock->gblock.flags &ACPI_WMI_STRING ) { + params[2 ].type =ACPI_TYPE_STRING ; + params[2 ].string.length = in->length; + params[2 ].string.pointer = in->pointer; + }else { + params[2 ].type =ACPI_TYPE_BUFFER ; + params[2 ].buffer.length = in->length; + params[2 ].buffer.pointer = in->pointer; + }get_acpi_method_name (wblock,'M' , method);
@@ -519,9 +518,16 @@ acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct input.pointer = params; params[0 ].type =ACPI_TYPE_INTEGER ; params[0 ].integer.value = instance; - params[1 ].type =get_param_acpi_type (wblock); - params[1 ].buffer.length = in->length; - params[1 ].buffer.pointer = in->pointer; + +if (wblock->gblock.flags &ACPI_WMI_STRING ) { + params[1 ].type =ACPI_TYPE_STRING ; + params[1 ].string.length = in->length; + params[1 ].string.pointer = in->pointer; + }else { + params[1 ].type =ACPI_TYPE_BUFFER ; + params[1 ].buffer.length = in->length; + params[1 ].buffer.pointer = in->pointer; + }get_acpi_method_name (wblock,'S' , method);
Signature · 1 line
2.39.5
Armin Wolf
maintainerPATCH 3/4 platform/x86: wmi: Remove extern keyword from prototypes
In reply to Armin WolfThe external function definitions do not need the "extern" keyword. Remove it to silence the associated checkpatch warnings.
--- include/linux/wmi.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
include/linux/wmi.h +6 -9
@@ -36,13 +36,10 @@ struct wmi_device {*/ #define to_wmi_device (device) container_of_const(device, struct wmi_device, dev) -extern acpi_status wmidev_evaluate_method (struct wmi_device *wdev, -u8 instance,u32 method_id, -const struct acpi_buffer *in, -struct acpi_buffer *out); +acpi_status wmidev_evaluate_method (struct wmi_device *wdev,u8 instance,u32 method_id, +const struct acpi_buffer *in,struct acpi_buffer *out); -extern union acpi_object *wmidev_block_query (struct wmi_device *wdev, -u8 instance); +union acpi_object *wmidev_block_query (struct wmi_device *wdev,u8 instance);acpi_status wmidev_block_set (struct wmi_device *wdev,u8 instance,const struct acpi_buffer *in);
@@ -81,9 +78,9 @@ struct wmi_driver {*/ #define to_wmi_driver (drv) container_of_const(drv, struct wmi_driver, driver) -extern int __must_check __wmi_driver_register (struct wmi_driver *driver, -struct module *owner); -extern void wmi_driver_unregister (struct wmi_driver *driver); +int __must_check __wmi_driver_register (struct wmi_driver *driver,struct module *owner); + +void wmi_driver_unregister (struct wmi_driver *driver);/** * wmi_driver_register() - Helper macro to register a WMI driver
Signature · 1 line
2.39.5
Armin Wolf
maintainerPATCH 4/4 platform/x86: wmi: Move WMI core code into a separate directory
In reply to Armin WolfMove the WMI core code into a separate directory to prepare for future additions to the WMI driver.
---
Documentation/driver-api/wmi.rst | 2 +-
MAINTAINERS | 2 +-
drivers/platform/x86/Kconfig | 30 +------------------
drivers/platform/x86/Makefile | 2 +-
drivers/platform/x86/wmi/Kconfig | 34 ++++++++++++++++++++++
drivers/platform/x86/wmi/Makefile | 8 +++++
drivers/platform/x86/{wmi.c => wmi/core.c} | 0
7 files changed, 46 insertions(+), 32 deletions(-)
create mode 100644 drivers/platform/x86/wmi/Kconfig
create mode 100644 drivers/platform/x86/wmi/Makefile
rename drivers/platform/x86/{wmi.c => wmi/core.c} (100%)Documentation/driver-api/wmi.rst +1 -1
@@ -16,5 +16,5 @@ which will be bound to compatible WMI devices by the driver core. .. kernel-doc:: include/linux/wmi.h :internal: -.. kernel-doc:: drivers/platform/x86/wmi.c +.. kernel-doc:: drivers/platform/x86/wmi/core.c :export:
MAINTAINERS +1 -1
@@ -402,7 +402,7 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-wmi F: Documentation/driver-api/wmi.rst F: Documentation/wmi/ -F: drivers/platform/x86/wmi.c +F: drivers/platform/x86/wmi/ F: include/uapi/linux/wmi.h ACRN HYPERVISOR SERVICE MODULE
drivers/platform/x86/Kconfig +1 -29
@@ -16,35 +16,7 @@ menuconfig X86_PLATFORM_DEVICES if X86_PLATFORM_DEVICES -config ACPI_WMI - tristate "WMI" - depends on ACPI - help - This driver adds support for the ACPI-WMI (Windows Management - Instrumentation) mapper device (PNP0C14) found on some systems. - - ACPI-WMI is a proprietary extension to ACPI to expose parts of the - ACPI firmware to userspace - this is done through various vendor - defined methods and data blocks in a PNP0C14 device, which are then - made available for userspace to call. - - The implementation of this in Linux currently only exposes this to - other kernel space drivers. - - This driver is a required dependency to build the firmware specific - drivers needed on many machines, including Acer and HP laptops. - - It is safe to enable this driver even if your DSDT doesn't define - any ACPI-WMI devices. - -config ACPI_WMI_LEGACY_DEVICE_NAMES - bool "Use legacy WMI device naming scheme" - depends on ACPI_WMI - help - Say Y here to force the WMI driver core to use the old WMI device naming - scheme when creating WMI devices. Doing so might be necessary for some - userspace applications but will cause the registration of WMI devices with - the same GUID to fail in some corner cases. +source "drivers/platform/x86/wmi/Kconfig" config WMI_BMOF tristate "WMI embedded Binary MOF driver"
drivers/platform/x86/Makefile +1 -1
@@ -5,7 +5,7 @@ # # Windows Management Interface -obj-$(CONFIG_ACPI_WMI) += wmi.o +obj-y += wmi/ obj-$(CONFIG_WMI_BMOF) += wmi-bmof.o # WMI drivers
drivers/platform/x86/wmi/Kconfig new file +34 -0
@@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# ACPI WMI Core +# + +config ACPI_WMI + tristate "WMI" + depends on ACPI + help + This driver adds support for the ACPI-WMI (Windows Management + Instrumentation) mapper device (PNP0C14) found on some systems. + + ACPI-WMI is a proprietary extension to ACPI to expose parts of the + ACPI firmware to userspace - this is done through various vendor + defined methods and data blocks in a PNP0C14 device, which are then + made available for userspace to call. + + The implementation of this in Linux currently only exposes this to + other kernel space drivers. + + This driver is a required dependency to build the firmware specific + drivers needed on many machines, including Acer and HP laptops. + + It is safe to enable this driver even if your DSDT doesn't define + any ACPI-WMI devices. + +config ACPI_WMI_LEGACY_DEVICE_NAMES + bool "Use legacy WMI device naming scheme" + depends on ACPI_WMI + help + Say Y here to force the WMI driver core to use the old WMI device naming + scheme when creating WMI devices. Doing so might be necessary for some + userspace applications but will cause the registration of WMI devices with + the same GUID to fail in some corner cases.
drivers/platform/x86/wmi/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for linux/drivers/platform/x86/wmi +# ACPI WMI core +# + +wmi-y := core.o +obj-$(CONFIG_ACPI_WMI) += wmi.o
drivers/platform/x86/wmi/core.c renamed from drivers/platform/x86/wmi.c +0 -0
Signature · 1 line
2.39.5
Ilpo Järvinen
maintainerRe: [PATCH 4/4] platform/x86: wmi: Move WMI core code into a separate directory
Quoted 87 lines · Armin Wolf
Move the WMI core code into a separate directory to prepare for future additions to the WMI driver.
Signed-off-by Armin Wolf <[email protected]>--- Documentation/driver-api/wmi.rst | 2 +- MAINTAINERS | 2 +- drivers/platform/x86/Kconfig | 30 +------------------ drivers/platform/x86/Makefile | 2 +- drivers/platform/x86/wmi/Kconfig | 34 ++++++++++++++++++++++ drivers/platform/x86/wmi/Makefile | 8 +++++ drivers/platform/x86/{wmi.c => wmi/core.c} | 0 7 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 drivers/platform/x86/wmi/Kconfig create mode 100644 drivers/platform/x86/wmi/Makefile rename drivers/platform/x86/{wmi.c => wmi/core.c} (100%)Documentation/driver-api/wmi.rst +1
-1@@ -16,5 +16,5 @@ which will be bound to compatible WMI devices by the driver core. .. kernel-doc:: include/linux/wmi.h :internal: -.. kernel-doc:: drivers/platform/x86/wmi.c +.. kernel-doc:: drivers/platform/x86/wmi/core.c :export:MAINTAINERS +1
-1@@ -402,7 +402,7 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-wmi F: Documentation/driver-api/wmi.rst F: Documentation/wmi/ -F: drivers/platform/x86/wmi.c +F: drivers/platform/x86/wmi/ F: include/uapi/linux/wmi.h ACRN HYPERVISOR SERVICE MODULEdrivers/platform/x86/Kconfig +1
-29@@ -16,35 +16,7 @@ menuconfig X86_PLATFORM_DEVICES if X86_PLATFORM_DEVICES -config ACPI_WMI - tristate "WMI" - depends on ACPI - help - This driver adds support for the ACPI-WMI (Windows Management - Instrumentation) mapper device (PNP0C14) found on some systems. - - ACPI-WMI is a proprietary extension to ACPI to expose parts of the - ACPI firmware to userspace - this is done through various vendor - defined methods and data blocks in a PNP0C14 device, which are then - made available for userspace to call. - - The implementation of this in Linux currently only exposes this to - other kernel space drivers. - - This driver is a required dependency to build the firmware specific - drivers needed on many machines, including Acer and HP laptops. - - It is safe to enable this driver even if your DSDT doesn't define - any ACPI-WMI devices. - -config ACPI_WMI_LEGACY_DEVICE_NAMES - bool "Use legacy WMI device naming scheme" - depends on ACPI_WMI - help - Say Y here to force the WMI driver core to use the old WMI device naming - scheme when creating WMI devices. Doing so might be necessary for some - userspace applications but will cause the registration of WMI devices with - the same GUID to fail in some corner cases. +source "drivers/platform/x86/wmi/Kconfig" config WMI_BMOF tristate "WMI embedded Binary MOF driver"drivers/platform/x86/Makefile +0
-0
drivers/platform/x86/Makefile line 8
Quoted 5 lines
drivers/platform/x86/Makefile +1
-1@@ -5,7 +5,7 @@ # # Windows Management Interface -obj-$(CONFIG_ACPI_WMI) += wmi.o +obj-y += wmi/
Is there a good reason for the first part of the change? That is, do you anticipate need for something outside of what this would cover:
obj-$(CONFIG_ACPI_WMI) += wmi/
Other than that, this series looks fine.
Signature · 1 line
i.
Quoted 62 lines
drivers/platform/x86/Makefile +0
-0obj-$(CONFIG_WMI_BMOF) += wmi-bmof.o # WMI driversdrivers/platform/x86/wmi/Kconfig new file +34
-0@@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# ACPI WMI Core +# + +config ACPI_WMI + tristate "WMI" + depends on ACPI + help + This driver adds support for the ACPI-WMI (Windows Management + Instrumentation) mapper device (PNP0C14) found on some systems. + + ACPI-WMI is a proprietary extension to ACPI to expose parts of the + ACPI firmware to userspace - this is done through various vendor + defined methods and data blocks in a PNP0C14 device, which are then + made available for userspace to call. + + The implementation of this in Linux currently only exposes this to + other kernel space drivers. + + This driver is a required dependency to build the firmware specific + drivers needed on many machines, including Acer and HP laptops. + + It is safe to enable this driver even if your DSDT doesn't define + any ACPI-WMI devices. + +config ACPI_WMI_LEGACY_DEVICE_NAMES + bool "Use legacy WMI device naming scheme" + depends on ACPI_WMI + help + Say Y here to force the WMI driver core to use the old WMI device naming + scheme when creating WMI devices. Doing so might be necessary for some + userspace applications but will cause the registration of WMI devices with + the same GUID to fail in some corner cases.drivers/platform/x86/wmi/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for linux/drivers/platform/x86/wmi +# ACPI WMI core +# + +wmi-y := core.o +obj-$(CONFIG_ACPI_WMI) += wmi.odrivers/platform/x86/wmi/core.c renamed from drivers/platform/x86/wmi.c +0
-0
Armin Wolf
maintainerRe: [PATCH 4/4] platform/x86: wmi: Move WMI core code into a separate directory
Am 05.11.25 um 10:41 schrieb Ilpo Järvinen:
Quoted 98 lines · Armin Wolf
Quoted 88 lines
Move the WMI core code into a separate directory to prepare for future additions to the WMI driver.
Signed-off-by Armin Wolf <[email protected]>--- Documentation/driver-api/wmi.rst | 2 +- MAINTAINERS | 2 +- drivers/platform/x86/Kconfig | 30 +------------------ drivers/platform/x86/Makefile | 2 +- drivers/platform/x86/wmi/Kconfig | 34 ++++++++++++++++++++++ drivers/platform/x86/wmi/Makefile | 8 +++++ drivers/platform/x86/{wmi.c => wmi/core.c} | 0 7 files changed, 46 insertions(+), 32 deletions(-)create mode 100644
drivers/platform/x86/wmi/Kconfigcreate mode 100644drivers/platform/x86/wmi/Makefilerenamedrivers/platform/x86/{wmi.c=>wmi/core.c} (100%)Documentation/driver-api/wmi.rst +1
-1@@ -16,5 +16,5 @@ which will be bound to compatible WMI devices by the driver core. .. kernel-doc:: include/linux/wmi.h :internal: -.. kernel-doc:: drivers/platform/x86/wmi.c +.. kernel-doc:: drivers/platform/x86/wmi/core.c :export:MAINTAINERS +1
-1@@ -402,7 +402,7 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-wmi F: Documentation/driver-api/wmi.rst F: Documentation/wmi/ -F: drivers/platform/x86/wmi.c +F: drivers/platform/x86/wmi/ F: include/uapi/linux/wmi.h ACRN HYPERVISOR SERVICE MODULEdrivers/platform/x86/Kconfig +1
-29@@ -16,35 +16,7 @@ menuconfig X86_PLATFORM_DEVICES if X86_PLATFORM_DEVICES -config ACPI_WMI - tristate "WMI" - depends on ACPI - help - This driver adds support for the ACPI-WMI (Windows Management - Instrumentation) mapper device (PNP0C14) found on some systems. - - ACPI-WMI is a proprietary extension to ACPI to expose parts of the - ACPI firmware to userspace - this is done through various vendor - defined methods and data blocks in a PNP0C14 device, which are then - made available for userspace to call. - - The implementation of this in Linux currently only exposes this to - other kernel space drivers. - - This driver is a required dependency to build the firmware specific - drivers needed on many machines, including Acer and HP laptops. - - It is safe to enable this driver even if your DSDT doesn't define - any ACPI-WMI devices. - -config ACPI_WMI_LEGACY_DEVICE_NAMES - bool "Use legacy WMI device naming scheme" - depends on ACPI_WMI - help - Say Y here to force the WMI driver core to use the old WMI device naming - scheme when creating WMI devices. Doing so might be necessary for some - userspace applications but will cause the registration of WMI devices with - the same GUID to fail in some corner cases. +source "drivers/platform/x86/wmi/Kconfig" config WMI_BMOF tristate "WMI embedded Binary MOF driver"drivers/platform/x86/Makefile +0
-0drivers/platform/x86/Makefile line 8
Quoted 5 lines
drivers/platform/x86/Makefile +1
-1@@ -5,7 +5,7 @@ # # Windows Management Interface -obj-$(CONFIG_ACPI_WMI) += wmi.o +obj-y += wmi/Is there a good reason for the first part of the change? That is, do you anticipate need for something outside of what this would cover:
Quoted 3 lines
obj-$(CONFIG_ACPI_WMI) += wmi/
Other than that, this series looks fine.
The final version will look like this:
wmi-y := core.o marshalling.o string.o
obj-$(CONFIG_ACPI_WMI) += wmi.o
# Unit tests
obj-y += tests/
So i think this change is necessary.
Thanks,
Armin Wolf
Ilpo Järvinen
maintainerRe: [PATCH 4/4] platform/x86: wmi: Move WMI core code into a separate directory
Quoted 105 lines · Armin Wolf
Am 05.11.25 um 10:41 schrieb Ilpo Järvinen:
Quoted 97 lines · Armin Wolf
Quoted 88 lines
Move the WMI core code into a separate directory to prepare for future additions to the WMI driver.
Signed-off-by Armin Wolf <[email protected]>--- Documentation/driver-api/wmi.rst | 2 +- MAINTAINERS | 2 +- drivers/platform/x86/Kconfig | 30 +------------------ drivers/platform/x86/Makefile | 2 +- drivers/platform/x86/wmi/Kconfig | 34 ++++++++++++++++++++++ drivers/platform/x86/wmi/Makefile | 8 +++++ drivers/platform/x86/{wmi.c => wmi/core.c} | 0 7 files changed, 46 insertions(+), 32 deletions(-)create mode 100644
drivers/platform/x86/wmi/Kconfigcreate mode 100644drivers/platform/x86/wmi/Makefilerenamedrivers/platform/x86/{wmi.c=>wmi/core.c} (100%)Documentation/driver-api/wmi.rst +0
-0@@ -16,5 +16,5 @@ which will be bound to compatible WMI devices by thedriver core.
.. kernel-doc::include/linux/wmi.h
:internal:
-.. kernel-doc::drivers/platform/x86/wmi.c
+.. kernel-doc::drivers/platform/x86/wmi/core.c
:export:MAINTAINERS +1
-1@@ -402,7 +402,7 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-wmi F: Documentation/driver-api/wmi.rst F: Documentation/wmi/ -F: drivers/platform/x86/wmi.c +F: drivers/platform/x86/wmi/ F: include/uapi/linux/wmi.h ACRN HYPERVISOR SERVICE MODULEdrivers/platform/x86/Kconfig +0
-25@@ -16,35 +16,7 @@ menuconfig X86_PLATFORM_DEVICES if X86_PLATFORM_DEVICES -config ACPI_WMI - tristate "WMI" - depends on ACPI - help - This driver adds support for the ACPI-WMI (Windows Management - Instrumentation) mapper device (PNP0C14) found on some systems. - - ACPI-WMI is a proprietary extension to ACPI to expose parts of the - ACPI firmware to userspace - this is done through various vendor - defined methods and data blocks in a PNP0C14 device, which are then - made available for userspace to call. - - The implementation of this in Linux currently only exposes this to - other kernel space drivers. - - This driver is a required dependency to build the firmware specific - drivers needed on many machines, including Acer and HP laptops. - - It is safe to enable this driver even if your DSDT doesn't define - any ACPI-WMI devices. - -config ACPI_WMI_LEGACY_DEVICE_NAMES - bool "Use legacy WMI device naming scheme" - depends on ACPI_WMI - help - Say Y here to force the WMI driver core to use the old WMI devicenaming
drivers/platform/x86/Kconfig +0
-1- scheme when creating WMI devices. Doing so might be necessary forsome
drivers/platform/x86/Kconfig +0
-1- userspace applications but will cause the registration of WMIdevices with
drivers/platform/x86/Kconfig +1
-1- the same GUID to fail in some corner cases. +source "drivers/platform/x86/wmi/Kconfig" config WMI_BMOF tristate "WMI embedded Binary MOF driver"drivers/platform/x86/Makefile +0
-0drivers/platform/x86/Makefile line 7
Quoted 4 lines
drivers/platform/x86/Makefile +1
-1@@ -5,7 +5,7 @@ # # Windows Management Interface -obj-$(CONFIG_ACPI_WMI) += wmi.o +obj-y += wmi/Is there a good reason for the first part of the change? That is, do you anticipate need for something outside of what this would cover:
Quoted 3 lines
obj-$(CONFIG_ACPI_WMI) += wmi/
Other than that, this series looks fine.
The final version will look like this:
Quoted 7 lines
wmi-y := core.o marshalling.o string.o
obj-$(CONFIG_ACPI_WMI) += wmi.o# Unit tests
obj-y += tests/So i think this change is necessary.
Fair enough.
Signature · 1 line
i.
Quoted 2 lines · Armin Wolf
After over a year of reverse engineering, i am finally ready to introduce support for WMI-ACPI marshalling inside the WMI driver core.
marshaling> Since the resulting patch series is quite large, i am planning to
Quoted 9 lines
submit the necessary patches as three separate patch series.
This is supposed to be the first of the three patch series. Its main purpose is to prepare the WMI driver core for the upcoming changes. The first patch fixes an issue inside the nls utf16 to utf8 conversion code, while the next two patches fix some minor issues inside the WMI driver core itself. The last patch finally moves the code of the WMI driver core into a separate repository to allow for future additions without cluttering the main directory.
One question I have here on the patch to move things.
Since Windows on ARM (WoA) laptops are a thing - is this still actually x86 specific? I am wondering if this should be moving to a different subsystem altogether like ACPI; especially now with this impending other large patch series you have on your way.
Quoted 17 lines
Armin Wolf (4):
fs/nls: Fix utf16 to utf8 conversion
platform/x86: wmi: Use correct type when populating ACPI objects platform/x86: wmi: Remove extern keyword from prototypes platform/x86: wmi: Move WMI core code into a separate directoryDocumentation/driver-api/wmi.rst | 2 +- MAINTAINERS | 2 +- drivers/platform/x86/Kconfig | 30 +------------------ drivers/platform/x86/Makefile | 2 +- drivers/platform/x86/wmi/Kconfig | 34 ++++++++++++++++++++++ drivers/platform/x86/wmi/Makefile | 8 +++++ drivers/platform/x86/{wmi.c => wmi/core.c} | 34 +++++++++++++--------- fs/nls/nls_base.c | 16 +++++++--- include/linux/wmi.h | 15 ++++------ 9 files changed, 84 insertions(+), 59 deletions(-)
Quoted 4 lines
create mode 100644
drivers/platform/x86/wmi/Kconfigcreate mode 100644drivers/platform/x86/wmi/Makefilerenamedrivers/platform/x86/{wmi.c=>wmi/core.c} (98%)
Armin Wolf
maintainerAm 04.11.25 um 21:52 schrieb Mario Limonciello:
Quoted 14 lines · Armin Wolf
Quoted 2 lines
After over a year of reverse engineering, i am finally ready to introduce support for WMI-ACPI marshalling inside the WMI driver core.
marshaling> Since the resulting patch series is quite large, i am planning to
Quoted 9 lines
submit the necessary patches as three separate patch series.
This is supposed to be the first of the three patch series. Its main purpose is to prepare the WMI driver core for the upcoming changes. The first patch fixes an issue inside the nls utf16 to utf8 conversion code, while the next two patches fix some minor issues inside the WMI driver core itself. The last patch finally moves the code of the WMI driver core into a separate repository to allow for future additions without cluttering the main directory.
Quoted 3 lines
One question I have here on the patch to move things.
Since Windows on ARM (WoA) laptops are a thing - is this still actually x86 specific? I am wondering if this should be moving to a different subsystem altogether like ACPI; especially now with this impending other large patch series you have on your way.
I know of a few WoA laptops that contain ACPI-WMI devices, meaning this driver is indeed not x86-specific. However i need to make some changes to the WMI driver core (and actually tests it on a AArch64 VM) first before moving it out of drivers/platform/x86.
Once i am actually ready for this i would prefer to move the whole stuff to drivers/platform, as drivers/acpi IMHO is better suited for core ACPI drivers.
Thanks,
Armin Wolf
Quoted 23 lines
Quoted 16 lines
Armin Wolf (4):
fs/nls: Fix utf16 to utf8 conversion
platform/x86: wmi: Use correct type when populating ACPI objects platform/x86: wmi: Remove extern keyword from prototypes platform/x86: wmi: Move WMI core code into a separate directoryDocumentation/driver-api/wmi.rst | 2 +- MAINTAINERS | 2 +- drivers/platform/x86/Kconfig | 30 +------------------ drivers/platform/x86/Makefile | 2 +- drivers/platform/x86/wmi/Kconfig | 34 ++++++++++++++++++++++ drivers/platform/x86/wmi/Makefile | 8 +++++
drivers/platform/x86/{wmi.c=>wmi/core.c} | 34 +++++++++++++--------- fs/nls/nls_base.c | 16 +++++++--- include/linux/wmi.h | 15 ++++------Quoted 5 lines
9 files changed, 84 insertions(+), 59 deletions(-)create mode 100644
drivers/platform/x86/wmi/Kconfigcreate mode 100644drivers/platform/x86/wmi/Makefilerenamedrivers/platform/x86/{wmi.c=>wmi/core.c} (98%)Reviewed-by Mario Limonciello (AMD) <[email protected]>
Ilpo Järvinen
maintainerQuoted 30 lines · Armin Wolf
Am 04.11.25 um 21:52 schrieb Mario Limonciello:
Quoted 15 lines · Armin Wolf
Quoted 2 lines
After over a year of reverse engineering, i am finally ready to introduce support for WMI-ACPI marshalling inside the WMI driver core.
marshaling> Since the resulting patch series is quite large, i am planning to
Quoted 9 lines
submit the necessary patches as three separate patch series.
This is supposed to be the first of the three patch series. Its main purpose is to prepare the WMI driver core for the upcoming changes. The first patch fixes an issue inside the nls utf16 to utf8 conversion code, while the next two patches fix some minor issues inside the WMI driver core itself. The last patch finally moves the code of the WMI driver core into a separate repository to allow for future additions without cluttering the main directory.
Quoted 6 lines
One question I have here on the patch to move things.
Since Windows on ARM (WoA) laptops are a thing - is this still actually x86 specific? I am wondering if this should be moving to a different subsystem altogether like ACPI; especially now with this impending other large patch series you have on your way.
I know of a few WoA laptops that contain ACPI-WMI devices, meaning this driver is indeed not x86-specific.
However i need to make some changes to the WMI driver core (and actually tests it on a AArch64 VM) first
before moving it out ofdrivers/platform/x86.
Quoted 3 lines
Once i am actually ready for this i would prefer to move the whole stuff to
drivers/platform, asdrivers/acpi
IMHO is better suited for core ACPI drivers.
So no need to put it under drivers/platform/x86/wmi/ then at all. It can move directly to drivers/platform/wmi/ and you work there towards making it non-x86-specific.
Signature · 1 line
i.
Quoted 28 lines
Thanks,
Armin WolfQuoted 23 lines
Quoted 16 lines
Armin Wolf (4):
fs/nls: Fix utf16 to utf8 conversion
platform/x86: wmi: Use correct type when populating ACPI objects platform/x86: wmi: Remove extern keyword from prototypes platform/x86: wmi: Move WMI core code into a separate directoryDocumentation/driver-api/wmi.rst | 2 +- MAINTAINERS | 2 +- drivers/platform/x86/Kconfig | 30 +------------------ drivers/platform/x86/Makefile | 2 +- drivers/platform/x86/wmi/Kconfig | 34 ++++++++++++++++++++++ drivers/platform/x86/wmi/Makefile | 8 +++++
drivers/platform/x86/{wmi.c=>wmi/core.c} | 34 +++++++++++++--------- fs/nls/nls_base.c | 16 +++++++--- include/linux/wmi.h | 15 ++++------Quoted 5 lines
9 files changed, 84 insertions(+), 59 deletions(-)create mode 100644
drivers/platform/x86/wmi/Kconfigcreate mode 100644drivers/platform/x86/wmi/Makefilerenamedrivers/platform/x86/{wmi.c=>wmi/core.c} (98%)Reviewed-by Mario Limonciello (AMD) <[email protected]>
Armin Wolf
maintainerAm 10.11.25 um 12:00 schrieb Ilpo Järvinen:
Quoted 30 lines · Armin Wolf
Quoted 29 lines
Am 04.11.25 um 21:52 schrieb Mario Limonciello:
Quoted 14 lines · Armin Wolf
Quoted 2 lines
After over a year of reverse engineering, i am finally ready to introduce support for WMI-ACPI marshalling inside the WMI driver core.
marshaling> Since the resulting patch series is quite large, i am planning to
Quoted 9 lines
submit the necessary patches as three separate patch series.
This is supposed to be the first of the three patch series. Its main purpose is to prepare the WMI driver core for the upcoming changes. The first patch fixes an issue inside the nls utf16 to utf8 conversion code, while the next two patches fix some minor issues inside the WMI driver core itself. The last patch finally moves the code of the WMI driver core into a separate repository to allow for future additions without cluttering the main directory.
Quoted 6 lines
One question I have here on the patch to move things.
Since Windows on ARM (WoA) laptops are a thing - is this still actually x86 specific? I am wondering if this should be moving to a different subsystem altogether like ACPI; especially now with this impending other large patch series you have on your way.
I know of a few WoA laptops that contain ACPI-WMI devices, meaning this driver is indeed not x86-specific.
However i need to make some changes to the WMI driver core (and actually tests it on a AArch64 VM) first
before moving it out ofdrivers/platform/x86.
Quoted 6 lines
Quoted 3 lines
Once i am actually ready for this i would prefer to move the whole stuff to
drivers/platform, asdrivers/acpi
IMHO is better suited for core ACPI drivers.So no need to put it under
drivers/platform/x86/wmi/then at all. It can move directly todrivers/platform/wmi/and you work there towards making it non-x86-specific.
OK, i will send the v2 revision of this series soon.
Thanks,
Armin Wolf