mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: Antheas Kapenekakis <lkml@antheas.dev>,
	Derek John Clark <derekjohn.clark@gmail.com>
Cc: corbet@lwn.net, hdegoede@redhat.com,
	ilpo.jarvinen@linux.intel.com, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, luke@ljones.dev,
	mpearson-lenovo@squebb.ca, nijs1@lenovo.com,
	pgriffais@valvesoftware.com, platform-driver-x86@vger.kernel.org,
	shaohz1@lenovo.com, superm1@kernel.org, zhangzx36@lenovo.com,
	johnfanv2@gmail.com, codyit@gmail.com
Subject: Re: [PATCH 0/1] platform/x86: Add Lenovo Legion WMI Drivers
Date: Sun, 29 Dec 2024 21:45:40 +0100	[thread overview]
Message-ID: <b7089d69-4d7b-42fb-90b3-bd13a27fcf1e@gmx.de> (raw)
In-Reply-To: <CAGwozwF79xYrWkCSKpBaLSiXNEZz-5tmayWMbkw-of4zB=LPUQ@mail.gmail.com>

Am 28.12.24 um 12:50 schrieb Antheas Kapenekakis:

>> I'll let them weigh in on this again if they want to, but I think it
>> was clear from those threads that this is a new way to use the class.
>> Armin's comment was related to the fan curve setting John was
>> discussing, which is specifically covered by the hwmon subsystem.
>> Hwmon does not cover platform profiles or PPT.
> I quote the following from Armin:
>
>> The firmware-attribute class interface is only intended for attributes which are persistent
>> and cannot be exposed over other subsystem interfaces.
> The former part is not met here.

If Ilpo and Hans agree to extend the scope of the firmware-attribute class to also cover non-persistent
firmware settings then i will not resist.

>
>>> To rephrase, your ABI style is not intuitive, because it contains
>>> implementation details such as "gamezone", "capdata01", and "Other
>>> Method", in addition to the ABI being hardcoded to the WMI structure
>>> lenovo uses. The documentation uses those keywords as well.
>> Yeah, it's a driver for those interfaces... If you want an agnostic
>> BMOF driver then make one. This isn't that.
> It's a driver for Legion Go and Legion laptops. _Not_ those
> interfaces. Which only exist in gen 7+ if I recall from John's driver.
> That was my comment.
>
> Establishing an ABI that works with older laptops and laptops that
> supersede those interfaces would be beneficial I'd say.

Excuse me for asking a stupid question here, but what WMI interfaces exactly are we currently arguing about?

>>> If I understand correctly your last sentence, Armin suggested much of
>>> the same (ie combine and merge).
>> You don't seem to, no. The suggestion was to use the component  driver
>> API to aggregate the Other Method driver with the capability data
>> driver so that the firmware-attributes class is only loaded when both
>> are present. That is decidedly different from breaking the kernel's
>> WMI driver requirements and merging two GUID's into one driver.
>>
>>> GUID tables loading != drivers loading also, I would not pin that on
>>> the kernel.
>> What exactly do you think the following does?
>>
>>   +MODULE_DEVICE_TABLE(wmi, gamezone_wmi_id_table);
> Call the probe function that can -ENODEV
>
>>> I do not understand what "I hard code the page to custom" means.
>>> If you mean the capability data does not change you are right, they
>>> are hardcoded in the decompiled ACPI I am pretty sure (it has been
>>> close to a year now so I might be forgetting).
>> The capability data interface has a data block instance for every
>> attribute in every fan mode. SPL has one for quiet, balanced,
>> performance, and custom. The method for getting that data block (page)
>> is the same as calling get/set in Other Method (0x01030100 -
>> 0x0103FF00). Every page produces different values for each attribute,
>> but I am only ever retrieving the instance for custom (0x0103FF00) as
>> that's the only one where setting that method ID in Other Method
>> changes the values on the Legion Go. It is the only relevant data for
>> userspace. Other Gaming Series laptops might treat this differently,
>> where every fan mode has an applicable range. I'll need to do more
>> testing on other hardware to confirm that. In any case, this isn't
>> relevant as I'm dropping the gamezone check (as I've stated multiple
>> times in this discussion) and always setting/getting the custom method
>> ID for a given attribute.
> Hm, for some reason I missed the capability block when doing my RE
> [1]. Feel free to reference when making the driver.
>
> You should also provision for the fact some legion laptops have an
> extreme mode which is stubbed on the Legion Go
>
> Ok,
> let's wrap up this discussion and put a bow on it.
>
> I currently have two issues that block me from committing to your
> driver: novel use of kernel APIs/design and performance
> degradation/instability from unnecessary calls and checks, as those
> are (i) slower (ii) could error out (iii) could have incorrect data.
>
> The former can leave me with tech debt if your proposed ABI is vetoed
> and the latter would result in a degraded experience for my users; I
> would be putting in work to go backwards. I do not mention missing
> features, as that is something I could have also worked on if I
> committed to your driver.
>
> Therefore, I'm left in a situation where I have to wait for buy-in
> from kernel maintainers and for your V2, hoping it fixes the latter
> issue which you said it will only do partly.

Regarding the firmware-attributes: if Ilpo and Hans give their OK, then i see no problems in using the firmware-attribute class for
non-persistent firmware settings. I for my part would be OK with such a change.

Regarding the enforcement of firmware limits: i believe that caching those limits during probing would solve the performance problem.
If users want to override those limits when we can add a module param (marked as unsafe to taint the kernel if used) later which tells
the driver to ignore those limits when writing firmware settings.

Any important points which i missed?

Thanks,
Armin Wolf

> Best,
> Antheas
>
> [1] https://github.com/hhd-dev/hwinfo/tree/master/devices/legion_go#get-feature-command

  reply	other threads:[~2024-12-29 20:46 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17 23:06 Derek J. Clark
2024-12-17 23:06 ` [PATCH 1/1] platform/x86: Add lenovo-legion-wmi drivers Derek J. Clark
2024-12-18  2:39   ` Mario Limonciello
2024-12-18  3:36     ` Derek J. Clark
2024-12-22 22:55       ` Armin Wolf
2024-12-23 15:47         ` Derek John Clark
2024-12-23 16:50           ` Armin Wolf
2024-12-25  5:25   ` Cody T.-H. Chiu
2024-12-25  8:34     ` Derek J. Clark
2024-12-25 21:11       ` Armin Wolf
2024-12-26  7:17         ` Derek J. Clark
2024-12-27 17:21           ` Mark Pearson
2024-12-30  7:51       ` Cody T.-H. Chiu
2024-12-27 18:48   ` [PATCH 0/1] platform/x86: Add Lenovo Legion WMI Drivers Antheas Kapenekakis
2024-12-27 23:22     ` Derek John Clark
2024-12-28  1:09       ` Antheas Kapenekakis
2024-12-28  3:30         ` Derek John Clark
2024-12-28 11:50           ` Antheas Kapenekakis
2024-12-29 20:45             ` Armin Wolf [this message]
2024-12-29 22:41               ` Antheas Kapenekakis
2024-12-30 13:41                 ` Antheas Kapenekakis
2024-12-29 20:28     ` Armin Wolf
2024-12-22  8:42 ` John Martens
     [not found]   ` <CAFqHKT==PiLb_VuFPHJzgfrprukGGig+iUzcih+3TJ1VYt94Dw@mail.gmail.com>
2024-12-22 20:34     ` Derek John Clark
2024-12-22 23:05   ` Armin Wolf
2024-12-26  0:18     ` John Martens
2024-12-26 23:19       ` Armin Wolf
2024-12-27 17:06         ` Mark Pearson
2024-12-27 23:18       ` Derek John Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7089d69-4d7b-42fb-90b3-bd13a27fcf1e@gmx.de \
    --to=w_armin@gmx.de \
    --cc=codyit@gmail.com \
    --cc=corbet@lwn.net \
    --cc=derekjohn.clark@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=johnfanv2@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@antheas.dev \
    --cc=luke@ljones.dev \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=nijs1@lenovo.com \
    --cc=pgriffais@valvesoftware.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=shaohz1@lenovo.com \
    --cc=superm1@kernel.org \
    --cc=zhangzx36@lenovo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®