Skip to content

Commit

Permalink
PLDM: Disable surveillance timer (ibm-openbmc#262)
Browse files Browse the repository at this point in the history
This commit is to disable the timer when we fail
to receive the surveillance pings from PHYP.

DEFECT:SW551173

Signed-off-by: Sagar Srinivas <[email protected]>
  • Loading branch information
sagisin authored May 27, 2022
1 parent a811bb5 commit 3e9755c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
1 change: 1 addition & 0 deletions host-bmc/host_pdr_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ HostPDRHandler::HostPDRHandler(
{
if (oemPlatformHandler)
{
oemPlatformHandler->startStopTimer(false);
oemPlatformHandler->handleBootTypesAtChassisOff();
}
static constexpr auto searchpath =
Expand Down
5 changes: 5 additions & 0 deletions libpldmresponder/oem_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ class Handler : public CmdHandler
/** @brief To update container ID of Proc LED PDRs */
virtual void updateContainerIDofProcLed() = 0;

/** @brief Interface to reset or stop the surveillance timer
* @param[in] value - true or false, to indicate if the timer
* should be reset or turned off*/
virtual void startStopTimer(bool value) = 0;

/** @brief Interface to monitor the surveillance pings from host
*
* @param[in] tid - TID of the host
Expand Down
33 changes: 28 additions & 5 deletions oem/ibm/libpldmresponder/oem_ibm_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1755,21 +1755,44 @@ void pldm::responder::oem_ibm_platform::Handler::processPowerOffHardGraceful()
processPowerOffSoftGraceful();
}

void pldm::responder::oem_ibm_platform::Handler::startStopTimer(bool value)
{
if (value)
{
timer.restart(
std::chrono::seconds(HEARTBEAT_TIMEOUT + HEARTBEAT_TIMEOUT_DELTA));
}
else
{
timer.setEnabled(value);
}
}

void pldm::responder::oem_ibm_platform::Handler::setSurvTimer(uint8_t tid,
bool value)
{
if (hostOff || hostTransitioningToOff || tid != HYPERVISOR_TID)
std::cout << "setSurvTimer:hostOff=" << (bool)hostOff
<< " hostTransitioningToOff=" << (bool)hostTransitioningToOff
<< " tid=" << (uint16_t)tid << std::endl;
if ((hostOff == true) || (hostTransitioningToOff == true) ||
(tid != HYPERVISOR_TID))
{
if (timer.isEnabled())
{
startStopTimer(false);
}
return;
}
if (value)
{
timer.restart(
std::chrono::seconds(HEARTBEAT_TIMEOUT + HEARTBEAT_TIMEOUT_DELTA));
startStopTimer(true);
}
else
else if (!value && timer.isEnabled())
{
timer.setEnabled(false);
std::cout << "setSurvTimer:LogginPel:hostOff=" << (bool)hostOff
<< " hostTransitioningToOff=" << (bool)hostTransitioningToOff
<< " tid=" << (uint16_t)tid << std::endl;
startStopTimer(false);
pldm::utils::reportError(
"xyz.openbmc_project.PLDM.Error.setSurvTimer.RecvSurveillancePingFail",
pldm::PelSeverity::INFORMATIONAL);
Expand Down
6 changes: 6 additions & 0 deletions oem/ibm/libpldmresponder/oem_ibm_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ class Handler : public oem_platform::Handler
/** @brief To process auto power restore policy*/
void processPowerOffHardGraceful();

/** @brief Method to reset or stop the surveillance timer
*
* @param[in] value - true or false, to indicate if the timer
* should be reset or turned off*/
void startStopTimer(bool value);

/** @brief Method to Enable/Disable timer to see if host sends the
* surveillance ping and logs informational error if host fails to send the
* surveillance pings
Expand Down

0 comments on commit 3e9755c

Please sign in to comment.