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

Paul Fertser fercerpav at gmail.com
Tue May 9 17:40:26 AEST 2023


Hi Zev,

Thank you for answering. A quick additional point inline.

On Mon, May 08, 2023 at 03:46:13PM -0700, Zev Weiss wrote:
> On Fri, May 05, 2023 at 02:23:06AM PDT, Paul Fertser wrote:
> > 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).
> > 
> 
> This seems like the trickier part to me.  AFAIK the kernel as it stands
> doesn't really offer any way of specifying any of the additional parameters
> that DT properties and such can provide when dynamically instantiating
> devices, so if you need any non-default configuration your only option is a
> statically-defined device (via a DT node), and if that's not an option
> because you need dynamic instantiation then you're kind of out of luck
> unfortunately.

Dynamic instantiation is still possible either by having the
corresponding kernel driver modular or by using "bind" and "unbind"
sysfs nodes. In this specific case we tested having the driver
built-in, it tries binding on BMC startup, fails if the host is off,
then at any point of time one can do "echo 5-0019 >
/sys/bus/i2c/drivers/leds-pca955x/bind" and it'll re-try binding, and
that works if the host is on at the moment. And of course it can be
"unbind" later if needed. This could even almost work with current
entity-manager code if it was listening for host power state events,
if it wasn't skipping the devices that it already tried exporting, and
if it had something like $HexAddress for the template arguments.

-- 
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