From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11151C433B4 for ; Mon, 5 Apr 2021 16:33:33 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95CD260FDB for ; Mon, 5 Apr 2021 16:33:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95CD260FDB Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FDbnR1TMjz30BK for ; Tue, 6 Apr 2021 02:33:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=Xv9ZiA65; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=google.com (client-ip=2a00:1450:4864:20::335; helo=mail-wm1-x335.google.com; envelope-from=edtanous@google.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=Xv9ZiA65; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FDbn05BXQz2ywx for ; Tue, 6 Apr 2021 02:33:07 +1000 (AEST) Received: by mail-wm1-x335.google.com with SMTP id p19so5976404wmq.1 for ; Mon, 05 Apr 2021 09:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=bD1EX+IFh4CcUCSM14oMlmYhzl5pt97bKMS9rs637+g=; b=Xv9ZiA65T0WuK/NDLKAColWdfB+1l+ZtCXqfpUNOTbE+SXJ5vucIMSeD0hs0TmowY0 yylFBRxF2UkzNEuqKaZI51ApA46ewI2Kpk4VwTmhtzZ6MjG2/VQ65wWXsBMSE7q3T9ie 2sBleG4AGepk9MrMb7lLtZXrPLQWdcOcPJNB/xH4EuHtlcnwIyCAweGd2PY/F3kkG4FM uZywTO29EXCj9Jxxte7cG17nxLxLIIubzTIzGB1c2brVU4nZX9bxb7BahMbYWSpNO5RT 0cUPON8UxQQ5K6FsZlS8cUOMfrOelSnFQsEEJfk9Tr2Mis2K1J6mQTaKQ/IKJ9Ul7DUQ q1eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=bD1EX+IFh4CcUCSM14oMlmYhzl5pt97bKMS9rs637+g=; b=mSVXW9sZeQhjv7C+gzLX3nKK1Tp27SoDSyWBxGiqyD3d7dIC+9sErpLeBFHOkASmPW uTrq4nzD0rnziDrJIauOJu3Z+m1s6W1Zi45j+0igMKA4LznlZRMhgOhK98xqfkBEeoVJ B5Iav3RfZ2Jbz0jhYSbPF7sR6AdnLt1abvluIgtM/rc8toU6sO6zAfhhUM8Jo0iLPA9W /5JOskQuIr2qzMdu71oGShflQnXmjvlUeLcAabzdfqBUmny0BEFpVXXdEz1YRF940wSX cE2rNprfVReEPuY4GLQQSKNWe3lv+EOU5haF+BXPVu7Rep7nUYACPRjjyRCS43k4o5ZM MYaQ== X-Gm-Message-State: AOAM531Us+/rtNzW83PZ9bWHvfbOnZ25wf69BBCasgB7bZeukZHv3PVs 2YG2z+5O8te4DptRdNcJrE+p8hpXczRLF5MTTgzqJPsgxs/oCQ== X-Google-Smtp-Source: ABdhPJxbtI6Cks4XbA7DdG+I5xc4oR+FZhjVTgVdwr7L9id8sm+RcXV3m8u9mZ6EIOPyCXPxLHcT/cT+vwU1VqCXXPc= X-Received: by 2002:a1c:f618:: with SMTP id w24mr25800415wmc.93.1617640379642; Mon, 05 Apr 2021 09:32:59 -0700 (PDT) MIME-Version: 1.0 References: <7252DA19-35E9-4A14-A7DF-7BBC54A312C2@amperemail.onmicrosoft.com> In-Reply-To: <7252DA19-35E9-4A14-A7DF-7BBC54A312C2@amperemail.onmicrosoft.com> From: Ed Tanous Date: Mon, 5 Apr 2021 09:32:48 -0700 Message-ID: Subject: Re: The common solution to support bind/unbind the hwmon driver base on the host state. To: Thu Nguyen OS Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "openbmc@lists.ozlabs.org" Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Tue, Mar 30, 2021 at 7: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 o= nly binded when the host is already On. Assuming you're using dbus-sensors, you'd normally just write an app that's capable of unloading the modules and watching the power states. Experience seems to show that very few true "rules" exist with regards to this kind of enabling/disabling, and as hardware gets used more, more odd error handling seems to pop up, so as a matter of design we pushed this into the individual sensor daemons early on to try to keep it somewhat sane to manage. dbus-sensors somewhat takes the position that once all hardware is debugged, there is no "common" solution to reset, and we've proven that on several occasions with other simple sensors. Overall, I'd recommend just writing an AMDCpuSensor application, as I suspect this is the first of many special cases that the processor will need. > > They are also unbinded when the host is Off. > > To support binding/unbinding the SMPro drivesr, we have one service name = driver-binder. > > When the Dbus property CurrentHostState of service xyz.openbmc_project.St= ate.Host changes to =E2=80=9Cnot Off=E2=80=9D, we will bind the drivers. > When the Dbus property RequestedHostTransition of service xyz.openbmc_pro= ject.State.Host OR Dbus property RequestedPowerTransition of xyz.openbmc_pr= oject.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? > > > > Regards. > > Thu Nguyen. > > > >