Skip to content

Commit

Permalink
opal/hmi: set a flag to inform OS that TOD/TB has failed.
Browse files Browse the repository at this point in the history
Set a flag to indicate OS about TOD/TB failure as part of new
opal_handle_hmi2 handler. This flag then can be used by OS to make sure
functions depending on TB value (e.g. udelay()) are aware of TB not
ticking.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
maheshsal authored and stewartsmith committed Mar 5, 2019
1 parent ca349b8 commit 4977349
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/hmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,10 +1223,12 @@ static int handle_tfac_errors(struct OpalHMIEvent *hmi_evt, uint64_t *out_flags)
/* Set the TB state looking at TFMR register before we head out. */
this_cpu()->tb_invalid = !(mfspr(SPR_TFMR) & SPR_TFMR_TB_VALID);

if (this_cpu()->tb_invalid)
if (this_cpu()->tb_invalid) {
*out_flags |= OPAL_HMI_FLAGS_TOD_TB_FAIL;
prlog(PR_WARNING, "Failed to get TB in running state! "
"CPU=%x, TFMR=%016lx\n", this_cpu()->pir,
mfspr(SPR_TFMR));
}

return recover;
}
Expand Down
10 changes: 9 additions & 1 deletion doc/opal-api/opal-handle-hmi-98-166.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ OPAL_HANDLE_HMI and OPAL_HANDLE_HMI2
is an old interface. ```OPAL_HANDLE_HMI2``` is newly introduced opal call
that returns direct info to Linux. It returns a 64-bit flag mask currently
set to provide info about which timer facilities were lost, and whether an
event was generated.
event was generated. This information will help OS to take respective
actions.

In case where opal hmi handler is unable to recover from TOD or TB errors,
it would flag ```OPAL_HMI_FLAGS_TOD_TB_FAIL``` to indicate OS that TB is
dead. This information then can be used by OS to make sure that the
functions relying on TB value (e.g. udelay()) are aware of TB not ticking.
This will avoid OS getting stuck or hang during its way to panic path.

OPAL_HANDLE_HMI
---------------
Expand Down Expand Up @@ -122,5 +129,6 @@ parameters
OPAL_HMI_FLAGS_TB_RESYNC = (1ull << 0), /* Timebase has been resynced */
OPAL_HMI_FLAGS_DEC_LOST = (1ull << 1), /* DEC lost, needs to be reprogrammed */
OPAL_HMI_FLAGS_HDEC_LOST = (1ull << 2), /* HDEC lost, needs to be reprogrammed */
OPAL_HMI_FLAGS_TOD_TB_FAIL = (1ull << 3), /* TOD/TB recovery failed. */
OPAL_HMI_FLAGS_NEW_EVENT = (1ull << 63), /* An event has been created */
};
1 change: 1 addition & 0 deletions include/opal-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ enum {
OPAL_HMI_FLAGS_TB_RESYNC = (1ull << 0), /* Timebase has been resynced */
OPAL_HMI_FLAGS_DEC_LOST = (1ull << 1), /* DEC lost, needs to be reprogrammed */
OPAL_HMI_FLAGS_HDEC_LOST = (1ull << 2), /* HDEC lost, needs to be reprogrammed */
OPAL_HMI_FLAGS_TOD_TB_FAIL = (1ull << 3), /* TOD/TB recovery failed. */
OPAL_HMI_FLAGS_NEW_EVENT = (1ull << 63), /* An event has been created */
};

Expand Down

0 comments on commit 4977349

Please sign in to comment.