Hot-plugging non-sensor devices on non-PnP buses (was: Re: entity-manager: SBTSI and hwmontempsensor)

Paul Fertser fercerpav at gmail.com
Fri May 5 19:23:06 AEST 2023


Hi Zev,

I do not mean to hi-jack the topic as the issue I have a question about
is closely related, please see inline.

On Thu, May 04, 2023 at 02:10:15PM -0700, Zev Weiss wrote:
> It shouldn't be in your DTS, because then it'd be statically defined and
> hwmontempsensor wouldn't be able to remove it when the host is powered off
> (which I assume you'd want).
> 
> In terms of userspace/kernel separation, it's overall pretty similar to how
> it had been previously, just with the management of device lifetimes
> (instantiation & removal) moved to hwmontempsensor instead of
> entity-manager.

I see similar mechanism is also implemented in omnisensor, so this can
be an option (probably preferred since it's a much cleaner code) too.

But what if the device in consideration isn't a sensor at all? We're
trying to use PCA9551 which is a LED driver controllable over
I2C. Since it's meant to show statuses of the host storage devices
it's powered only when the host is powered. The kernel driver
leds-pca955x handles it nicely but the probe() needs to be run with
the device powered.

I initially thought entity-manager should be the right place in the
architecture to handle cases like this, but now that you say OpenBMC
is moving towards implementing dynamic driver assigning functionality
in the sensors daemons instead I wonder what the solution for the
non-sensor devices should be (as duplicating the relevant code in
phosphor-led-manager seems to be obviously wrong). I can also imagine
e.g. SPI devices needing similar treatment, so it's neither sensors
nor I2C specific in the big picture.

What further complicates situation with leds-pca955x specifically is
that it /needs/ DT or platform data to work, and that makes it try
binding automatically on startup, and probe() fails while the host
system is off, and "new_device" sysfs node can't be used to retry (as
the device is already defined), so either the driver needs to be
modular and reloaded with essentially rmmod/insmod sequence or the
userspace can use sysfs "bind" node to call probe() again (this is
also problematic with entity-manager as $Address template argument
isn't suitable for a string like 5-0019, where 19 is in hex).

I would be happy to hear your and the other OpenBMC community member's
thoughts on this matter.

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav at gmail.com


More information about the openbmc mailing list