openbmc / phosphor-state-manager

Apache License 2.0
10 stars 21 forks source link

Incorrect interface used for TPM device #27

Open krzk opened 3 weeks ago

krzk commented 3 weeks ago

Code value : '/sys/firmware/devicetree/base/ahb/apb/bus@1e78a000/i2c-bus@680/tpm@2e', https://github.com/openbmc/phosphor-state-manager/blob/3c1351cc2b63178876ef68f4107c9804d2e17dcc/meson.options#L140 hard-codes device node name, which can change. Device node name is not an ABI. The compatible is. This will soon stop working due to node name renaming: https://lore.kernel.org/all/20240531193115.3814887-1-robh@kernel.org/

geissonator commented 3 weeks ago

@Lakshmi-y I know we made this configurable so we could in theory override it via the bitbake recipe if it changes but seems like we should find a way to utilize the compatible here. Could you take a look?

krzk commented 3 weeks ago

BTW, anyway the proper device path should not be /sys/firmware/devicetree, because that's what firmware contains, not Linux, but instead /sys/devices/.../ (or /sys/bus). This is much more reliable although such device name can still change, so the only truly reliable is /sys/class and then check the found device, e.g. compatible, type, name etc. (depending what the subsystem is exposing via sysfs interface).