openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Matt Spinler <mspinler@linux.ibm.com>
To: Thu Nguyen OS <thu@os.amperecomputing.com>,
	Joseph Reynolds <jrey@linux.ibm.com>,
	"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
	Brad Bishop <bradleyb@fuzziesquirrel.com>
Subject: Re: The common solution to support bind/unbind the hwmon driver base on the host state.
Date: Mon, 5 Apr 2021 11:20:31 -0500	[thread overview]
Message-ID: <2eeceb70-2ca6-59ec-6545-35e08782fb29@linux.ibm.com> (raw)
In-Reply-To: <2E3157F2-E7D6-49B6-A015-A9DA00E6CD78@amperemail.onmicrosoft.com>



On 4/5/2021 10:17 AM, Thu Nguyen OS wrote:
> Sure, I will prepare the code.
>
> 1. Do you suggest the name of repo? I though we can use phosphor-driver-binder.

At one point, there was going to be an official way to ask where new 
functionality should go - 
https://lore.kernel.org/openbmc/20210111220919.zwc727vbwc4itm7h@thinkpad.fuzziesquirrel.com/. 
I can't remember seeing a way to make these requests though.  Maybe Brad 
can chime in.

How about just put it into the the phosphor-hwmon repo?

> 2. Below is format of the configuration file which I'm using.
> {
>         "hostDrivers" :
>         {
>                "bindDelay" : 0,
>                "unbindDelay" : 0,
>                "drivers" :
>                [
>                       {
>                              "name" : "",
>                              "path" : ""
>                       },
>                       {
>                              "name" : "",
>                              "path" : ""
>                       }
>                ]
>         },
>         "powerDrivers" :
>         {
>                "bindDelay" : 0,
>                "unbindDelay" : 0,
>                "drivers" :
>                [
>                       {
>                              "name" : "",
>                              "path" : ""
>                       },
>                       {
>                              "name" : "",
>                              "path" : ""
>                       }
>                ]
>          }
> }
> Where:
> * hostDrivers: Json entry to define the drivers which bind/unbind when the host change state.
> * bindDelay: The delay will be applied before start binding the drivers in the list.
> * unbindDelay: The delay will be applied before start unbinding the drivers in the list.
> * drivers: Define the list of drivers in one driver type.
> * name: define driver name.
> * path: is the path of that driver which have bind and unbind binary.
>
> * powerDrivers: Json entry to define the drivers which bind/unbind when the power change state.
>
> Do you think the json format is ok?

Looks pretty good to me.

> Regards.
> Thu Nguyen.
>
> On 05/04/2021, 22:06, "Matt Spinler" <mspinler@linux.ibm.com> wrote:
>
>
>
>      On 4/2/2021 2:52 AM, Thu Nguyen OS wrote:
>      > I thought that OpenBmc community have to have the solution for this.
>      > I can propose my solution but I don't think it is common enough.
>
>      I haven't seen any code that does a bind/unbind on power on, so I would
>      welcome your solution being upstreamed.  We put similar functionality
>      into phosphor-gpio-presence that can bind/unbind around presence
>      detection where the drivers are also listed in a config file.
>
>
>      >
>      > Regards,
>      > Thu Nguyen.
>      >
>      > On 31/03/2021, 23:14, "Joseph Reynolds" <jrey@linux.ibm.com> wrote:
>      >
>      >      On 3/30/21 9:14 PM, Thu Nguyen OS wrote:
>      >      > Hi All, Currently, In Mtjade platform of Ampere, we have SMPro mdf
>      >      > drivers (SMPro hwmon, SMPro errmon, SMPro misc driver). The drivers
>      >      > will be loaded by kernel when the BMC boot up. But they are only
>      >      > binded when the host is already On. ‍ ‍ ‍ ‍
>      >      >
>      >      > Hi All,
>      >      >
>      >      > Currently, In Mtjade platform of Ampere, we have SMPro mdf drivers
>      >      > (SMPro hwmon, SMPro errmon, SMPro misc driver).
>      >      >
>      >      > The drivers will be loaded by kernel when the BMC boot up. But they
>      >      > are only binded when the host is already On.
>      >      >
>      >      > They are also unbinded when the host is Off.
>      >      >
>      >      > To support binding/unbinding the SMPro drivesr, we have one service
>      >      > name driver-binder.
>      >      >
>      >      >  1. When the Dbus property CurrentHostState of service
>      >      >     xyz.openbmc_project.State.Host changes to “not Off”, we will bind
>      >      >     the drivers.
>      >      >  2. When the Dbus property RequestedHostTransition of service
>      >      >     xyz.openbmc_project.State.Host OR Dbus property
>      >      >     RequestedPowerTransition of xyz.openbmc_project.State.Chassis
>      >      >
>      >      > change to Off, we will unbind the drivers.
>      >      >
>      >      > The driver-binder is working as expected, it have the configuration
>      >      > file to configure which drivers will be binded/unbinded.
>      >      >
>      >      > But that is our solution.
>      >      >
>      >      > Do we have any common solution to do that job?
>      >      >
>      >
>      >      Thu,
>      >
>      >      I don't have a solution.  But I do want to be able to bind and unbind
>      >      drivers for the BMC-attached USB ports (as the underlying mechanism when
>      >      the BMC admin disables the ports), so I think it would be good to have a
>      >      common solution or understand the best practices.
>      >
>      >      Joseph
>      >
>      >      > Regards.
>      >      >
>      >      > Thu Nguyen.
>      >      >
>      >
>      >
>
>


  reply	other threads:[~2021-04-05 16:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31  2:14 The common solution to support bind/unbind the hwmon driver base on the host state Thu Nguyen OS
2021-03-31 16:14 ` Joseph Reynolds
2021-04-02  7:52   ` Thu Nguyen OS
2021-04-05 15:06     ` Matt Spinler
2021-04-05 15:17       ` Thu Nguyen OS
2021-04-05 16:20         ` Matt Spinler [this message]
2021-04-06 15:23           ` Thu Nguyen OS
2021-04-06 15:27             ` Matt Spinler
2021-04-05 16:32 ` Ed Tanous
2021-04-06 15:15   ` Thu Nguyen OS

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=2eeceb70-2ca6-59ec-6545-35e08782fb29@linux.ibm.com \
    --to=mspinler@linux.ibm.com \
    --cc=bradleyb@fuzziesquirrel.com \
    --cc=jrey@linux.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=thu@os.amperecomputing.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).