mbox series

[v3,0/9] hwmon: (dell-smm) Add support for WMI SMM interface

Message ID 20231106064351.42347-1-W_Armin@gmx.de (mailing list archive)
Headers show
Series hwmon: (dell-smm) Add support for WMI SMM interface | expand

Message

Armin Wolf Nov. 6, 2023, 6:43 a.m. UTC
This patch series adds support for an alternative SMM calling
backend to the dell-smm-hwmon driver. The reason for this is
that on some modern machines, the legacy SMM calling interface
does not work anymore and the SMM handler can be called over
ACPI WMI instead.

The first four patches prepare the driver by allowing to
specify different SMM calling backends, and by moving most of
the DMI handling into i8k_init() so that the DMI tables can
keep their __initconst attributes (the WMI SMM backend driver
does not probe at module init time). The fifth patch does some
minor cleanup, while the next three patches implement the new
WMI SMM calling backend. The last patch adds the machine of
the user who requested and tested the changes to the fan control
whitelist.

If the driver does not detect the legacy SMM interface, either
because the machine is not whitelisted or because the SMM handler
does not react, it registers an WMI driver which will then bound
to the WMI SMM interface and do the remaining initialization.

The deprecated procfs interface is not supported when using the
WMI SMM calling backend for the following reason: the WMI driver
can potentially be instantiated multiple times while the deprectated
procfs interface cannot. This should not cause any regressions
because on machines supporting only the WMI SMM interface, the
driver would, until now, not load anyway.

All patches where tested on a Dell Inspiron 3505 and a Dell
OptiPlex 7000.

Changes since v2:
- Rework WMI response parsing
- Use #define for method number

Changes since v1:
- Cc platform driver maintainers
- Fix formating inside documentation

Armin Wolf (9):
  hwmon: (dell-smm) Prepare for multiple SMM calling backends
  hwmon: (dell-smm) Move blacklist handling to module init
  hwmon: (dell-smm) Move whitelist handling to module init
  hwmon: (dell-smm) Move DMI config handling to module init
  hwmon: (dell-smm) Move config entries out of i8k_dmi_table
  hwmon: (dell-smm) Introduce helper function for data init
  hwmon: (dell-smm) Add support for WMI SMM interface
  hwmon: (dell-smm) Document the WMI SMM interface
  hwmon: (dell-smm) Add Optiplex 7000 to fan control whitelist

 Documentation/hwmon/dell-smm-hwmon.rst |  38 +-
 drivers/hwmon/Kconfig                  |   1 +
 drivers/hwmon/dell-smm-hwmon.c         | 603 +++++++++++++++++--------
 drivers/platform/x86/wmi.c             |   1 +
 4 files changed, 453 insertions(+), 190 deletions(-)

--
2.39.2

Comments

Armin Wolf Nov. 13, 2023, 7:55 p.m. UTC | #1
Am 06.11.23 um 07:43 schrieb Armin Wolf:

> This patch series adds support for an alternative SMM calling
> backend to the dell-smm-hwmon driver. The reason for this is
> that on some modern machines, the legacy SMM calling interface
> does not work anymore and the SMM handler can be called over
> ACPI WMI instead.
>
> The first four patches prepare the driver by allowing to
> specify different SMM calling backends, and by moving most of
> the DMI handling into i8k_init() so that the DMI tables can
> keep their __initconst attributes (the WMI SMM backend driver
> does not probe at module init time). The fifth patch does some
> minor cleanup, while the next three patches implement the new
> WMI SMM calling backend. The last patch adds the machine of
> the user who requested and tested the changes to the fan control
> whitelist.
>
> If the driver does not detect the legacy SMM interface, either
> because the machine is not whitelisted or because the SMM handler
> does not react, it registers an WMI driver which will then bound
> to the WMI SMM interface and do the remaining initialization.
>
> The deprecated procfs interface is not supported when using the
> WMI SMM calling backend for the following reason: the WMI driver
> can potentially be instantiated multiple times while the deprectated
> procfs interface cannot. This should not cause any regressions
> because on machines supporting only the WMI SMM interface, the
> driver would, until now, not load anyway.
>
> All patches where tested on a Dell Inspiron 3505 and a Dell
> OptiPlex 7000.

Any thoughts on this?

Armin Wolf

>
> Changes since v2:
> - Rework WMI response parsing
> - Use #define for method number
>
> Changes since v1:
> - Cc platform driver maintainers
> - Fix formating inside documentation
>
> Armin Wolf (9):
>    hwmon: (dell-smm) Prepare for multiple SMM calling backends
>    hwmon: (dell-smm) Move blacklist handling to module init
>    hwmon: (dell-smm) Move whitelist handling to module init
>    hwmon: (dell-smm) Move DMI config handling to module init
>    hwmon: (dell-smm) Move config entries out of i8k_dmi_table
>    hwmon: (dell-smm) Introduce helper function for data init
>    hwmon: (dell-smm) Add support for WMI SMM interface
>    hwmon: (dell-smm) Document the WMI SMM interface
>    hwmon: (dell-smm) Add Optiplex 7000 to fan control whitelist
>
>   Documentation/hwmon/dell-smm-hwmon.rst |  38 +-
>   drivers/hwmon/Kconfig                  |   1 +
>   drivers/hwmon/dell-smm-hwmon.c         | 603 +++++++++++++++++--------
>   drivers/platform/x86/wmi.c             |   1 +
>   4 files changed, 453 insertions(+), 190 deletions(-)
>
> --
> 2.39.2
>
Hans de Goede Nov. 13, 2023, 8:17 p.m. UTC | #2
Hi Armin,

On 11/13/23 20:55, Armin Wolf wrote:
> Am 06.11.23 um 07:43 schrieb Armin Wolf:
> 
>> This patch series adds support for an alternative SMM calling
>> backend to the dell-smm-hwmon driver. The reason for this is
>> that on some modern machines, the legacy SMM calling interface
>> does not work anymore and the SMM handler can be called over
>> ACPI WMI instead.
>>
>> The first four patches prepare the driver by allowing to
>> specify different SMM calling backends, and by moving most of
>> the DMI handling into i8k_init() so that the DMI tables can
>> keep their __initconst attributes (the WMI SMM backend driver
>> does not probe at module init time). The fifth patch does some
>> minor cleanup, while the next three patches implement the new
>> WMI SMM calling backend. The last patch adds the machine of
>> the user who requested and tested the changes to the fan control
>> whitelist.
>>
>> If the driver does not detect the legacy SMM interface, either
>> because the machine is not whitelisted or because the SMM handler
>> does not react, it registers an WMI driver which will then bound
>> to the WMI SMM interface and do the remaining initialization.
>>
>> The deprecated procfs interface is not supported when using the
>> WMI SMM calling backend for the following reason: the WMI driver
>> can potentially be instantiated multiple times while the deprectated
>> procfs interface cannot. This should not cause any regressions
>> because on machines supporting only the WMI SMM interface, the
>> driver would, until now, not load anyway.
>>
>> All patches where tested on a Dell Inspiron 3505 and a Dell
>> OptiPlex 7000.
> 
> Any thoughts on this?

I was waiting for the merge window to close before
reviewing / merging patches for the next cycle.

I plan to review and hopefully merge this and your
other series sometime this week.

Regards,

Hans
Guenter Roeck Nov. 14, 2023, 1:57 p.m. UTC | #3
On Mon, Nov 13, 2023 at 09:17:48PM +0100, Hans de Goede wrote:
> 
> I plan to review and hopefully merge this and your
> other series sometime this week.
> 

What warrants merging this series through your tree(s) instead of
through hwmon ?

Guenter
Hans de Goede Nov. 14, 2023, 2:08 p.m. UTC | #4
Hi Guenter,

On 11/14/23 14:57, Guenter Roeck wrote:
> On Mon, Nov 13, 2023 at 09:17:48PM +0100, Hans de Goede wrote:
>>
>> I plan to review and hopefully merge this and your
>> other series sometime this week.
>>
> 
> What warrants merging this series through your tree(s) instead of
> through hwmon ?

My bad, I was not paying attention to what the patches were touching
(just a quick reply to Armin's status request), I agree that this
should be merged through the hwmon tree, sorry about the confusion.

Regards,

Hans
Hans de Goede Nov. 20, 2023, 1:03 p.m. UTC | #5
Hi,

On 11/6/23 07:43, Armin Wolf wrote:
> This patch series adds support for an alternative SMM calling
> backend to the dell-smm-hwmon driver. The reason for this is
> that on some modern machines, the legacy SMM calling interface
> does not work anymore and the SMM handler can be called over
> ACPI WMI instead.
> 
> The first four patches prepare the driver by allowing to
> specify different SMM calling backends, and by moving most of
> the DMI handling into i8k_init() so that the DMI tables can
> keep their __initconst attributes (the WMI SMM backend driver
> does not probe at module init time). The fifth patch does some
> minor cleanup, while the next three patches implement the new
> WMI SMM calling backend. The last patch adds the machine of
> the user who requested and tested the changes to the fan control
> whitelist.
> 
> If the driver does not detect the legacy SMM interface, either
> because the machine is not whitelisted or because the SMM handler
> does not react, it registers an WMI driver which will then bound
> to the WMI SMM interface and do the remaining initialization.
> 
> The deprecated procfs interface is not supported when using the
> WMI SMM calling backend for the following reason: the WMI driver
> can potentially be instantiated multiple times while the deprectated
> procfs interface cannot. This should not cause any regressions
> because on machines supporting only the WMI SMM interface, the
> driver would, until now, not load anyway.
> 
> All patches where tested on a Dell Inspiron 3505 and a Dell
> OptiPlex 7000.

Thank you for the patches.

Other then the signed int vs unsigned issue which Pali pointed
out this looks good to me, so with that fixed:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

for the series.

Note that the signed vs unsigned int issue needs to
be fixed in at least both struct smm_regs as well
as in the register parsing, specifically in these lines:

static int wmi_parse_register(u8 *buffer, u32 length, int *reg)

	int *registers[] = {

Also I think it might be better to use u32 instead of
"unsigned int" here. But I'll leave that choice up to you.

Regards,

Hans







> Changes since v2:
> - Rework WMI response parsing
> - Use #define for method number
> 
> Changes since v1:
> - Cc platform driver maintainers
> - Fix formating inside documentation
> 
> Armin Wolf (9):
>   hwmon: (dell-smm) Prepare for multiple SMM calling backends
>   hwmon: (dell-smm) Move blacklist handling to module init
>   hwmon: (dell-smm) Move whitelist handling to module init
>   hwmon: (dell-smm) Move DMI config handling to module init
>   hwmon: (dell-smm) Move config entries out of i8k_dmi_table
>   hwmon: (dell-smm) Introduce helper function for data init
>   hwmon: (dell-smm) Add support for WMI SMM interface
>   hwmon: (dell-smm) Document the WMI SMM interface
>   hwmon: (dell-smm) Add Optiplex 7000 to fan control whitelist
> 
>  Documentation/hwmon/dell-smm-hwmon.rst |  38 +-
>  drivers/hwmon/Kconfig                  |   1 +
>  drivers/hwmon/dell-smm-hwmon.c         | 603 +++++++++++++++++--------
>  drivers/platform/x86/wmi.c             |   1 +
>  4 files changed, 453 insertions(+), 190 deletions(-)
> 
> --
> 2.39.2
>