Bug 216460
Summary: | lenovo-thinklmi doesn't export a 'type' attribute and doesn't populate possible_values properly | ||
---|---|---|---|
Product: | Drivers | Reporter: | Mario Limonciello (AMD) (mario.limonciello) |
Component: | Platform_x86 | Assignee: | Mark Pearson (mpearson-lenovo) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | fkrueger, js |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 6.0-rc3 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
Patch to expose type attributes
Patch to expose type attributes (v2) |
Description
Mario Limonciello (AMD)
2022-09-07 18:42:48 UTC
JFYI: Given fwupd 1.8.5, I am seeing "fwupd[31123]: 19:40:48:0984 FuBiosSettings KERNEL BUG: 'type' attribute not exported: (failed to load type: File >>/sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/type<< No such file or directory)" (In reply to Frank Kruger from comment #1) > JFYI: Given fwupd 1.8.5, I am seeing "fwupd[31123]: 19:40:48:0984 > FuBiosSettings KERNEL BUG: 'type' attribute not exported: (failed to > load type: File > >>/sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/type<< No > such file or directory)" ...with ThinkPad T14 Gen1 and up-to-date FW 1.41. Created attachment 303304 [details]
Patch to expose type attributes
I've given fixing this a shot. I've made every exported firmware attribute a "string". If this is not desired the fix will definitely be more involved.
I don't think that's technically the right solution. Those are mostly enumeration types and possible values need to be exported. That's what fwupd is working around. I can probably fix this in the patch, but it would be nice to have some documentation of this interface. Does anyone have pointers? I believe https://download.lenovo.com/ibmdl/pub/pc/pccbbs/thinkcentre_pdf/hrdeploy_en.pdf might be what you're looking for. Ah, now I understand it. Then the patch may be extremely simple. We already expose `possible_values` for all firmware attributes in sysfs. This means we just have to expose type=enumeration as well. I'm going to give this a spin on my Thinkpad. Well yes and no. A new type=enumeration is needed; yes. But this is what I see on my system: $ cat /sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/possible_values cat: /sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/possible_values: Operation not supported $ sudo cat /sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/current_value Disable;[Optional:Disable,Enable] What I expected to see is something like this: $ cat /sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/possible_values Disable,Enable $ sudo cat /sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/current_value Disable Created attachment 303391 [details]
Patch to expose type attributes (v2)
I've updated the patch. It now only adds the `enumeration` type field:
/sys/class/firmware-attributes/thinklmi/attributes/SecureBoot # cat current_value
Disable
/sys/class/firmware-attributes/thinklmi/attributes/SecureBoot # cat possible_values
Disable,Enable
/sys/class/firmware-attributes/thinklmi/attributes/SecureBoot # cat type
enumeration
That seems like part of the solution, but on my system (P620) I still see: $ cat /sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/possible_values cat: /sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/possible_values: Operation not supported $ cat /sys/class/firmware-attributes/thinklmi/attributes/SecureBoot/current_value Disable;[Optional:Disable,Enable] So there needs to be further string processing. I can try to dig deeper, but this may be a firmware issue. Are you running the latest firmware? I just upgraded from 1.38 to 1.77 (the latest firmware), but the issue still persists on P620. I've got an internal ticket open with the FW team on the possible_values issue. The ThinkStation implementation doesn't support the WMI call that provides the possible_values separately (instead they've lumped them in with the current_value). The type - I'd forgotten about this. It's not really a thing we have in the thinklmi implementation. I'm not actually sure why it was made mandatory but regardless I should fix the driver. Enumeration works as a fix except for AlarmDate, AlarmTime and UserDefinedAlarmTime which are strings.....sigh At least from an "interface to userspace" perspective I think we should abstract the differences from one platform to another. It might mean slicing and dicing strings in the kernel, but at least then we don't have to carry a pile of quirks for every software above the kernel. Fixes for this have been landed in mainline with these commit hashes: 8a02d70679fc1c434401863333c8ea7dbf201494 cf337f27f3bfc4aeab4954c468239fd6233c7638 45e21289bfc6e257885514790a8a8887da822d40 583329dcf22e568a328a944f20427ccfc95dce01 I validated with a snapshot of 6.3rc4+ (fcd476ea6a88 ("Merge tag 'urgent-rcu.2023.03.28a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu")) and fwupd 1.8.13. Everything is behaving properly now on Thinkstation P620, many thanks. |