[Skiboot] [PATCH v2 3/3] opal/hmi: set a flag to inform OS that TOD/TB has failed.
Mahesh J Salgaonkar
mahesh at linux.vnet.ibm.com
Tue Mar 5 04:06:42 AEDT 2019
From: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
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 at linux.vnet.ibm.com>
---
Change in v2:
- Update the opal-handle-hmi-98-166.rst doc.
---
core/hmi.c | 4 +++-
doc/opal-api/opal-handle-hmi-98-166.rst | 10 +++++++++-
include/opal-api.h | 1 +
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/core/hmi.c b/core/hmi.c
index 7094b4ca5..fbb182c32 100644
--- a/core/hmi.c
+++ b/core/hmi.c
@@ -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;
}
diff --git a/doc/opal-api/opal-handle-hmi-98-166.rst b/doc/opal-api/opal-handle-hmi-98-166.rst
index 05f707d71..950e0c4ef 100644
--- a/doc/opal-api/opal-handle-hmi-98-166.rst
+++ b/doc/opal-api/opal-handle-hmi-98-166.rst
@@ -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
---------------
@@ -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 */
};
diff --git a/include/opal-api.h b/include/opal-api.h
index 5f397c8e6..73f86f9a5 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -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 */
};
More information about the Skiboot
mailing list