Skip to contentSkip to conversation

New: lenovo-thinklmi doesn't export a 'type' attribute and doesn't populate possible_values properly

Bug 216460 [email protected] 1 participant 2 messages Sep 7, 2022 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=216460

            Bug ID: 216460
           Summary: lenovo-thinklmi doesn't export a 'type' attribute and
                    doesn't populate possible_values properly
           Product: Drivers
           Version: 2.5
    Kernel Version: 6.0-rc3
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Platform_x86
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

The firmware-attributes documentation (
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-firmware-attributes)
indicates that all drivers that support firmware-attributes need to support the 'type' attribute.

This is important for userspace software to know how to interact with the driver.

fwupd 1.8.4 added support for the firmware-attributes class API, but since lenovo-thinklmi doesn't meet it shows the following error on every boot.

KERNEL BUG: 'type' attribute not exported: (failed to load type: Failed to open file “/sys/class/firmware-attributes/thinklmi/attributes/MCRUSBHeader/type”: No such file or directory)

A workaround has been landed in fwupd to avoid this attribute and hardcode the known behavior of the current driver when it finds it.

It seems like all the attributes are actually "enumeration", so the lenovo-thinklmi kernel driver should probably just export a type sysfs file with "enumeration" hardcoded for all attributes.

Also though, the possible_values key is not populated either. Instead the values are put into the "current_value" string. On a Lenovo P620 the following happens:

$ sudo cat
/sys/class/firmware-attributes/thinklmi/attributes/NUMA/current_value
Auto;[Optional:NPS1,NPS2,NPS4,Auto]
$ sudo cat
/sys/class/firmware-attributes/thinklmi/attributes/NUMA/possible_values
cat: /sys/class/firmware-attributes/thinklmi/attributes/NUMA/possible_values:
Operation not supported

That is the userspace software tears apart the current_value string and instead puts it into what the possible_values are. This should be the responsibility of the kernel driver. Even if the firwmare returns all that in current_value, the kernel driver should be doing the splitting so that userspace doesn't need to carry quirks for different kernel drivers behaving differently.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 216460] lenovo-thinklmi doesn't export a 'type' attribute and doesn't populate possible_values properly

https://bugzilla.kernel.org/show_bug.cgi?id=216460

Mario Limonciello (AMD) ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

           Assignee|drivers_platform_x86@kernel |[email protected]
                   |-bugs.osdl.org              |
Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.