Page MenuHomeFreeBSD

powerpc64/powernv: re-read RTC after polling
ClosedPublic

Authored by breno.leitao_gmail.com on Aug 7 2018, 10:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 8:53 PM
Unknown Object (File)
Sat, Nov 23, 12:40 AM
Unknown Object (File)
Tue, Nov 19, 10:26 PM
Unknown Object (File)
Mon, Nov 11, 12:39 AM
Unknown Object (File)
Tue, Nov 5, 1:46 PM
Unknown Object (File)
Oct 16 2024, 6:22 PM
Unknown Object (File)
Oct 14 2024, 6:00 PM
Unknown Object (File)
Oct 13 2024, 8:17 AM
Subscribers

Details

Summary

If OPAL_RTC_READ is busy and does not return the information on the first run,
as returning OPAL_BUSY_EVENT, the system will crash since ymd and hmsm variable will
contain junk values, as:

panic: invalid bcd 248
cpuid = 15
time = 1533662783
KDB: stack backtrace:
0xe000000075f80f70: at .kdb_backtrace+0x5c
0xe000000075f810a0: at .vpanic+0x1b4
0xe000000075f81160: at .kassert_panic+0xf8
0xe000000075f81200: at .opal_check+0x19d8
0xe000000075f812a0: at .opal_check+0x1b9c
0xe000000075f81380: at .clock_schedule+0x184
0xe000000075f81420: at .inittodr+0x24
0xe000000075f814b0: at .vfs_mountroot+0x1254
0xe000000075f81740: at .sysinit_add+0x3e8
0xe000000075f81850: at .fork_exit+0xd0
0xe000000075f818f0: at .fork_trampoline+0x10
0xe000000075f81920: at -0x4

This is happening because we were not calling OPAL_RTC_READ again after
OPAL_POLL_EVENTS' return, which would finally replace the old/junk hmsm and ymd
values.

The code was also mixing OPAL_RTC_READ and OPAL_POLL_EVENTS return values.

This patch fix this logic and guarantee that we call OPAL_RTC_READ after
OPAL_POLL_EVENTS return, and guarantee the code will only proceed if
OPAL_RTC_READ returns OPAL_SUCCESS.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18631
Build 18319: arc lint + arc unit