* [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement
@ 2025-06-19 22:14 Armin Wolf
2025-06-19 22:14 ` [PATCH 2/2] platform/x86: wmi: Update documentation of WCxx/WExx ACPI methods Armin Wolf
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Armin Wolf @ 2025-06-19 22:14 UTC (permalink / raw)
To: dimich.dmb, hdegoede, ilpo.jarvinen, kuurtb
Cc: corbet, platform-driver-x86, linux-kernel
It turns out that the Windows WMI-ACPI driver always enables/disables
WMI events regardless of whether they are marked as expensive or not.
This finding is further reinforced when reading the documentation of
the WMI_FUNCTION_CONTROL_CALLBACK callback used by Windows drivers
for enabling/disabling WMI devices:
The DpWmiFunctionControl routine enables or disables
notification of events, and enables or disables data
collection for data blocks that the driver registered
as expensive to collect.
Follow this behavior to fix the WMI event used for reporting hotkey
events on the Dell Latitude 5400 and likely many more devices.
Reported-by: Dmytro Bagrii <dimich.dmb@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220246
Tested-by: Dmytro Bagrii <dimich.dmb@gmail.com>
Fixes: 656f0961d126 ("platform/x86: wmi: Rework WCxx/WExx ACPI method handling")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
drivers/platform/x86/wmi.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 21b7e54bd7ab..4e86a422f05f 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -180,16 +180,22 @@ static int wmi_device_enable(struct wmi_device *wdev, bool enable)
acpi_handle handle;
acpi_status status;
- if (!(wblock->gblock.flags & ACPI_WMI_EXPENSIVE))
- return 0;
-
if (wblock->dev.dev.type == &wmi_type_method)
return 0;
- if (wblock->dev.dev.type == &wmi_type_event)
+ if (wblock->dev.dev.type == &wmi_type_event) {
+ /*
+ * Windows always enables/disables WMI events, even when they are
+ * not marked as being expensive. We follow this behavior for
+ * compatibility reasons.
+ */
snprintf(method, sizeof(method), "WE%02X", wblock->gblock.notify_id);
- else
+ } else {
+ if (!(wblock->gblock.flags & ACPI_WMI_EXPENSIVE))
+ return 0;
+
get_acpi_method_name(wblock, 'C', method);
+ }
/*
* Not all WMI devices marked as expensive actually implement the
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] platform/x86: wmi: Update documentation of WCxx/WExx ACPI methods
2025-06-19 22:14 [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement Armin Wolf
@ 2025-06-19 22:14 ` Armin Wolf
2025-06-25 12:28 ` [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement Ilpo Järvinen
2025-06-26 15:19 ` Ilpo Järvinen
2 siblings, 0 replies; 6+ messages in thread
From: Armin Wolf @ 2025-06-19 22:14 UTC (permalink / raw)
To: dimich.dmb, hdegoede, ilpo.jarvinen, kuurtb
Cc: corbet, platform-driver-x86, linux-kernel
Inform potential firmware developers that WExx ACPI methods are
always called by the WMI driver core even if the associated WMI event
is not marked as being expensive.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
Documentation/wmi/acpi-interface.rst | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/Documentation/wmi/acpi-interface.rst b/Documentation/wmi/acpi-interface.rst
index f1b28835d23c..1ef003b033bf 100644
--- a/Documentation/wmi/acpi-interface.rst
+++ b/Documentation/wmi/acpi-interface.rst
@@ -36,7 +36,7 @@ Offset Size (in bytes) Content
The WMI object flags control whether the method or notification ID is used:
-- 0x1: Data block usage is expensive and must be explicitly enabled/disabled.
+- 0x1: Data block is expensive to collect.
- 0x2: Data block contains WMI methods.
- 0x4: Data block contains ASCIZ string.
- 0x8: Data block describes a WMI event, use notification ID instead
@@ -83,14 +83,18 @@ event as hexadecimal value. Their first parameter is an integer with a value
of 0 if the WMI event should be disabled, other values will enable
the WMI event.
+Those ACPI methods are always called even for WMI events not registered as
+being expensive to collect to match the behavior of the Windows driver.
+
WCxx ACPI methods
-----------------
-Similar to the ``WExx`` ACPI methods, except that it controls data collection
-instead of events and thus the last two characters of the ACPI method name are
-the method ID of the data block to enable/disable.
+Similar to the ``WExx`` ACPI methods, except that instead of WMI events it controls
+data collection of data blocks registered as being expensive to collect. Thus the
+last two characters of the ACPI method name are the method ID of the data block
+to enable/disable.
Those ACPI methods are also called before setting data blocks to match the
-behaviour of the Windows driver.
+behavior of the Windows driver.
_WED ACPI method
----------------
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement
2025-06-19 22:14 [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement Armin Wolf
2025-06-19 22:14 ` [PATCH 2/2] platform/x86: wmi: Update documentation of WCxx/WExx ACPI methods Armin Wolf
@ 2025-06-25 12:28 ` Ilpo Järvinen
2025-06-25 13:09 ` Armin Wolf
2025-06-26 15:19 ` Ilpo Järvinen
2 siblings, 1 reply; 6+ messages in thread
From: Ilpo Järvinen @ 2025-06-25 12:28 UTC (permalink / raw)
To: Armin Wolf
Cc: dimich.dmb, Hans de Goede, kuurtb, corbet, platform-driver-x86,
LKML
On Fri, 20 Jun 2025, Armin Wolf wrote:
> It turns out that the Windows WMI-ACPI driver always enables/disables
> WMI events regardless of whether they are marked as expensive or not.
> This finding is further reinforced when reading the documentation of
> the WMI_FUNCTION_CONTROL_CALLBACK callback used by Windows drivers
> for enabling/disabling WMI devices:
>
> The DpWmiFunctionControl routine enables or disables
> notification of events, and enables or disables data
> collection for data blocks that the driver registered
> as expensive to collect.
>
> Follow this behavior to fix the WMI event used for reporting hotkey
> events on the Dell Latitude 5400 and likely many more devices.
>
> Reported-by: Dmytro Bagrii <dimich.dmb@gmail.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220246
> Tested-by: Dmytro Bagrii <dimich.dmb@gmail.com>
> Fixes: 656f0961d126 ("platform/x86: wmi: Rework WCxx/WExx ACPI method handling")
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> ---
> drivers/platform/x86/wmi.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 21b7e54bd7ab..4e86a422f05f 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -180,16 +180,22 @@ static int wmi_device_enable(struct wmi_device *wdev, bool enable)
> acpi_handle handle;
> acpi_status status;
>
> - if (!(wblock->gblock.flags & ACPI_WMI_EXPENSIVE))
> - return 0;
> -
> if (wblock->dev.dev.type == &wmi_type_method)
> return 0;
>
> - if (wblock->dev.dev.type == &wmi_type_event)
> + if (wblock->dev.dev.type == &wmi_type_event) {
> + /*
> + * Windows always enables/disables WMI events, even when they are
> + * not marked as being expensive. We follow this behavior for
Hi Armin,
Is the wording in the comment reversed? (I suspect you didn't mean to
include "not" into that statement?)
> + * compatibility reasons.
> + */
> snprintf(method, sizeof(method), "WE%02X", wblock->gblock.notify_id);
> - else
> + } else {
> + if (!(wblock->gblock.flags & ACPI_WMI_EXPENSIVE))
> + return 0;
> +
> get_acpi_method_name(wblock, 'C', method);
> + }
>
> /*
> * Not all WMI devices marked as expensive actually implement the
>
--
i.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement
2025-06-25 12:28 ` [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement Ilpo Järvinen
@ 2025-06-25 13:09 ` Armin Wolf
2025-06-25 13:13 ` Ilpo Järvinen
0 siblings, 1 reply; 6+ messages in thread
From: Armin Wolf @ 2025-06-25 13:09 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: dimich.dmb, Hans de Goede, kuurtb, corbet, platform-driver-x86,
LKML
Am 25.06.25 um 14:28 schrieb Ilpo Järvinen:
> On Fri, 20 Jun 2025, Armin Wolf wrote:
>
>> It turns out that the Windows WMI-ACPI driver always enables/disables
>> WMI events regardless of whether they are marked as expensive or not.
>> This finding is further reinforced when reading the documentation of
>> the WMI_FUNCTION_CONTROL_CALLBACK callback used by Windows drivers
>> for enabling/disabling WMI devices:
>>
>> The DpWmiFunctionControl routine enables or disables
>> notification of events, and enables or disables data
>> collection for data blocks that the driver registered
>> as expensive to collect.
>>
>> Follow this behavior to fix the WMI event used for reporting hotkey
>> events on the Dell Latitude 5400 and likely many more devices.
>>
>> Reported-by: Dmytro Bagrii <dimich.dmb@gmail.com>
>> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220246
>> Tested-by: Dmytro Bagrii <dimich.dmb@gmail.com>
>> Fixes: 656f0961d126 ("platform/x86: wmi: Rework WCxx/WExx ACPI method handling")
>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>> ---
>> drivers/platform/x86/wmi.c | 16 +++++++++++-----
>> 1 file changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
>> index 21b7e54bd7ab..4e86a422f05f 100644
>> --- a/drivers/platform/x86/wmi.c
>> +++ b/drivers/platform/x86/wmi.c
>> @@ -180,16 +180,22 @@ static int wmi_device_enable(struct wmi_device *wdev, bool enable)
>> acpi_handle handle;
>> acpi_status status;
>>
>> - if (!(wblock->gblock.flags & ACPI_WMI_EXPENSIVE))
>> - return 0;
>> -
>> if (wblock->dev.dev.type == &wmi_type_method)
>> return 0;
>>
>> - if (wblock->dev.dev.type == &wmi_type_event)
>> + if (wblock->dev.dev.type == &wmi_type_event) {
>> + /*
>> + * Windows always enables/disables WMI events, even when they are
>> + * not marked as being expensive. We follow this behavior for
> Hi Armin,
>
> Is the wording in the comment reversed? (I suspect you didn't mean to
> include "not" into that statement?)
Actually i did.
The WMI-ACPI spec seemed to suggest that WMI events should be enabled/disabled
only if they are being marked as expensive, however it turned out that WMI events
should also be enabled/disabled even if _not_ marked as being expensive.
Besides that another user tested this patch on his machine, so:
Tested-by: Grzegorz Suwaj <grzegorzssuwaj@gmail.com>
Thanks,
Armin Wolf
>> + * compatibility reasons.
>> + */
>> snprintf(method, sizeof(method), "WE%02X", wblock->gblock.notify_id);
>> - else
>> + } else {
>> + if (!(wblock->gblock.flags & ACPI_WMI_EXPENSIVE))
>> + return 0;
>> +
>> get_acpi_method_name(wblock, 'C', method);
>> + }
>>
>> /*
>> * Not all WMI devices marked as expensive actually implement the
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement
2025-06-25 13:09 ` Armin Wolf
@ 2025-06-25 13:13 ` Ilpo Järvinen
0 siblings, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2025-06-25 13:13 UTC (permalink / raw)
To: Armin Wolf
Cc: dimich.dmb, Hans de Goede, kuurtb, corbet, platform-driver-x86,
LKML
[-- Attachment #1: Type: text/plain, Size: 3234 bytes --]
On Wed, 25 Jun 2025, Armin Wolf wrote:
> Am 25.06.25 um 14:28 schrieb Ilpo Järvinen:
> > On Fri, 20 Jun 2025, Armin Wolf wrote:
> >
> > > It turns out that the Windows WMI-ACPI driver always enables/disables
> > > WMI events regardless of whether they are marked as expensive or not.
> > > This finding is further reinforced when reading the documentation of
> > > the WMI_FUNCTION_CONTROL_CALLBACK callback used by Windows drivers
> > > for enabling/disabling WMI devices:
> > >
> > > The DpWmiFunctionControl routine enables or disables
> > > notification of events, and enables or disables data
> > > collection for data blocks that the driver registered
> > > as expensive to collect.
> > >
> > > Follow this behavior to fix the WMI event used for reporting hotkey
> > > events on the Dell Latitude 5400 and likely many more devices.
> > >
> > > Reported-by: Dmytro Bagrii <dimich.dmb@gmail.com>
> > > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220246
> > > Tested-by: Dmytro Bagrii <dimich.dmb@gmail.com>
> > > Fixes: 656f0961d126 ("platform/x86: wmi: Rework WCxx/WExx ACPI method
> > > handling")
> > > Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> > > ---
> > > drivers/platform/x86/wmi.c | 16 +++++++++++-----
> > > 1 file changed, 11 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> > > index 21b7e54bd7ab..4e86a422f05f 100644
> > > --- a/drivers/platform/x86/wmi.c
> > > +++ b/drivers/platform/x86/wmi.c
> > > @@ -180,16 +180,22 @@ static int wmi_device_enable(struct wmi_device
> > > *wdev, bool enable)
> > > acpi_handle handle;
> > > acpi_status status;
> > > - if (!(wblock->gblock.flags & ACPI_WMI_EXPENSIVE))
> > > - return 0;
> > > -
> > > if (wblock->dev.dev.type == &wmi_type_method)
> > > return 0;
> > > - if (wblock->dev.dev.type == &wmi_type_event)
> > > + if (wblock->dev.dev.type == &wmi_type_event) {
> > > + /*
> > > + * Windows always enables/disables WMI events, even when they
> > > are
> > > + * not marked as being expensive. We follow this behavior for
> > Hi Armin,
> >
> > Is the wording in the comment reversed? (I suspect you didn't mean to
> > include "not" into that statement?)
>
> Actually i did.
>
> The WMI-ACPI spec seemed to suggest that WMI events should be enabled/disabled
> only if they are being marked as expensive, however it turned out that WMI
> events
> should also be enabled/disabled even if _not_ marked as being expensive.
Okay, fine. I seemingly missed the negation in the ACPI_WMI_EXPENSIVE
check.
--
i.
> Besides that another user tested this patch on his machine, so:
>
> Tested-by: Grzegorz Suwaj <grzegorzssuwaj@gmail.com>
>
> Thanks,
> Armin Wolf
>
> > > + * compatibility reasons.
> > > + */
> > > snprintf(method, sizeof(method), "WE%02X",
> > > wblock->gblock.notify_id);
> > > - else
> > > + } else {
> > > + if (!(wblock->gblock.flags & ACPI_WMI_EXPENSIVE))
> > > + return 0;
> > > +
> > > get_acpi_method_name(wblock, 'C', method);
> > > + }
> > > /*
> > > * Not all WMI devices marked as expensive actually implement the
> > >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement
2025-06-19 22:14 [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement Armin Wolf
2025-06-19 22:14 ` [PATCH 2/2] platform/x86: wmi: Update documentation of WCxx/WExx ACPI methods Armin Wolf
2025-06-25 12:28 ` [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement Ilpo Järvinen
@ 2025-06-26 15:19 ` Ilpo Järvinen
2 siblings, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2025-06-26 15:19 UTC (permalink / raw)
To: dimich.dmb, kuurtb, Hans de Goede, Armin Wolf
Cc: corbet, platform-driver-x86, linux-kernel
On Fri, 20 Jun 2025 00:14:39 +0200, Armin Wolf wrote:
> It turns out that the Windows WMI-ACPI driver always enables/disables
> WMI events regardless of whether they are marked as expensive or not.
> This finding is further reinforced when reading the documentation of
> the WMI_FUNCTION_CONTROL_CALLBACK callback used by Windows drivers
> for enabling/disabling WMI devices:
>
> The DpWmiFunctionControl routine enables or disables
> notification of events, and enables or disables data
> collection for data blocks that the driver registered
> as expensive to collect.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/2] platform/x86: wmi: Fix WMI event enablement
commit: cf0b812500e64a7d5e2957abed38c3a97917b34f
[2/2] platform/x86: wmi: Update documentation of WCxx/WExx ACPI methods
commit: 50b6914fc53c718c5426fb6e9cd9484f9ae967c2
--
i.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-26 15:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 22:14 [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement Armin Wolf
2025-06-19 22:14 ` [PATCH 2/2] platform/x86: wmi: Update documentation of WCxx/WExx ACPI methods Armin Wolf
2025-06-25 12:28 ` [PATCH 1/2] platform/x86: wmi: Fix WMI event enablement Ilpo Järvinen
2025-06-25 13:09 ` Armin Wolf
2025-06-25 13:13 ` Ilpo Järvinen
2025-06-26 15:19 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).