Skip to content

Commit 4977349

Browse files
maheshsalstewartsmith
authored andcommitted
opal/hmi: set a flag to inform OS that TOD/TB has failed.
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>
1 parent ca349b8 commit 4977349

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

core/hmi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,10 +1223,12 @@ static int handle_tfac_errors(struct OpalHMIEvent *hmi_evt, uint64_t *out_flags)
12231223
/* Set the TB state looking at TFMR register before we head out. */
12241224
this_cpu()->tb_invalid = !(mfspr(SPR_TFMR) & SPR_TFMR_TB_VALID);
12251225

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

12311233
return recover;
12321234
}

doc/opal-api/opal-handle-hmi-98-166.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ OPAL_HANDLE_HMI and OPAL_HANDLE_HMI2
9393
is an old interface. ```OPAL_HANDLE_HMI2``` is newly introduced opal call
9494
that returns direct info to Linux. It returns a 64-bit flag mask currently
9595
set to provide info about which timer facilities were lost, and whether an
96-
event was generated.
96+
event was generated. This information will help OS to take respective
97+
actions.
98+
99+
In case where opal hmi handler is unable to recover from TOD or TB errors,
100+
it would flag ```OPAL_HMI_FLAGS_TOD_TB_FAIL``` to indicate OS that TB is
101+
dead. This information then can be used by OS to make sure that the
102+
functions relying on TB value (e.g. udelay()) are aware of TB not ticking.
103+
This will avoid OS getting stuck or hang during its way to panic path.
97104

98105
OPAL_HANDLE_HMI
99106
---------------
@@ -122,5 +129,6 @@ parameters
122129
OPAL_HMI_FLAGS_TB_RESYNC = (1ull << 0), /* Timebase has been resynced */
123130
OPAL_HMI_FLAGS_DEC_LOST = (1ull << 1), /* DEC lost, needs to be reprogrammed */
124131
OPAL_HMI_FLAGS_HDEC_LOST = (1ull << 2), /* HDEC lost, needs to be reprogrammed */
132+
OPAL_HMI_FLAGS_TOD_TB_FAIL = (1ull << 3), /* TOD/TB recovery failed. */
125133
OPAL_HMI_FLAGS_NEW_EVENT = (1ull << 63), /* An event has been created */
126134
};

include/opal-api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,7 @@ enum {
777777
OPAL_HMI_FLAGS_TB_RESYNC = (1ull << 0), /* Timebase has been resynced */
778778
OPAL_HMI_FLAGS_DEC_LOST = (1ull << 1), /* DEC lost, needs to be reprogrammed */
779779
OPAL_HMI_FLAGS_HDEC_LOST = (1ull << 2), /* HDEC lost, needs to be reprogrammed */
780+
OPAL_HMI_FLAGS_TOD_TB_FAIL = (1ull << 3), /* TOD/TB recovery failed. */
780781
OPAL_HMI_FLAGS_NEW_EVENT = (1ull << 63), /* An event has been created */
781782
};
782783

0 commit comments

Comments
 (0)