[Skiboot] [PATCH 3/3] opal/hmi: set a flag to inform OS that TOD/TB has failed.
Mahesh Jagannath Salgaonkar
mahesh at linux.vnet.ibm.com
Wed Feb 20 20:54:05 AEDT 2019
On 2/19/19 7:32 AM, Stewart Smith wrote:
> Mahesh J Salgaonkar <mahesh at linux.vnet.ibm.com> writes:
>> 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>
>> ---
>> core/hmi.c | 4 +++-
>> include/opal-api.h | 1 +
>> 2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> 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/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 */
>> };
>
> Please also add to doc/opal-api/opal-handle-hmi-98-166.rst so we have
> some amount of documentation for it. It's probably worthwhile to add a
> paragraph there about since the TB is dead at that point, the OS should
> not do anything that relies on it, and panic() is the likely only
> correct outcome.
>
Sure will add that. Will send out linux patch that checks this flag and
get __udelay() to skip relying on TB so that Linux do not get stuck on
panic path.
Thanks,
-Mahesh.
More information about the Skiboot
mailing list