All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@kernel.org
To: platform-driver-x86@vger.kernel.org
Subject: [Bug 216460] New: lenovo-thinklmi doesn't export a 'type' attribute and doesn't populate possible_values properly
Date: Wed, 07 Sep 2022 18:42:48 +0000	[thread overview]
Message-ID: <bug-216460-215701@https.bugzilla.kernel.org/> (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: drivers_platform_x86@kernel-bugs.osdl.org
          Reporter: mario.limonciello@amd.com
        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.

-- 
You may reply to this email to add a comment.

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

             reply	other threads:[~2022-09-07 18:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07 18:42 bugzilla-daemon [this message]
2022-09-07 18:43 ` [Bug 216460] lenovo-thinklmi doesn't export a 'type' attribute and doesn't populate possible_values properly bugzilla-daemon

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=bug-216460-215701@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.