Polling Host state

Andrew Geissler geissonator at gmail.com
Tue Jul 18 03:53:35 AEST 2023



> On Jul 14, 2023, at 12:01 PM, Zehra Ozdemir <zehra.ozdemir at inventron.com.tr> wrote:
> 
> Hello to all,
> 
> When we try to shutdown the host over its operationg system, we saw that host-state-manager does not detect the pin signal and does not change the CurrentHostState property of xyz.openbmc_project.State.Host dbus interface. As far as we have looked through the source code of state manager, we have not been able to find a polling method for host state. There is just only one method called by scanGpioPin in host_condition_main.cpp which controls host pin signal by using gpio-line in dtb to write host's situation to CurrentFirmwareCondition value of xyz.openbmc_project.State.HostCondition.Gpio dbus interface. However, there is no polling to change host state for this CurrentFirmwareCondition value,  that can be triggered without using bmcweb or buttons .
> 
> Also there is obmc-op-control-power project to for polling pgood pin which is defined in  gpio_defs.json to  controls the pgood property of org.openbmc.control.Power interface for chassis-state-manager. If host is off, pgood is also 0. So we patched this project in poll_pgood method by using sd_bus methods of libsystemd-dev. When poll_pgood method detects pgood value as off, we control the the current state value of the host and if they are not parallel with each other, we set the host state and it seems to work correctly.
> 
> Could you please give us some information about if there is any proper implementation which we missed to detect host state by polling host pin signal or not?
> 
Hi Zehera,

phosphor-state-manager is just a wrapper around systemd targets. So It will say the chassis is off when it sees the obmc-chassis-poweroff at .target complete. It will set the host state to off when it sees the obmc-host-stop at .target complete. So what you have to do is put the systemd service needed for your system to power off in those targets, have them do whatever special logic your system needs, and then when the complete, the associated systemd targets will complete.

On some systems, PLDM is used to coordinate power off with the host. As you noted there’s also the GPIO driven host-condition (https://github.com/openbmc/phosphor-state-manager/tree/master/host_condition_gpio <https://github.com/openbmc/phosphor-state-manager/tree/master/host_condition_gpio>) but that’s more for the BMC reset logic, to know if the host is running when the BMC comes back from a reset.

I did a youtube overview of systemd and openbmc up at https://www.youtube.com/watch?v=JGUyCIAsYGU <https://www.youtube.com/watch?v=JGUyCIAsYGU> which may help clarify some of these questions.

x86-power-control is an alternative to phosphor-state-manager which depending on your system may work better (but I have minimal experience there).

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20230717/9fbde76e/attachment-0001.htm>


More information about the openbmc mailing list