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)
Sun, Apr 14, 1:38 AM
Unknown Object (File)
Dec 20 2023, 3:40 AM
Unknown Object (File)
Dec 12 2023, 5:57 AM
Unknown Object (File)
Sep 6 2023, 5:20 AM
Unknown Object (File)
Aug 27 2023, 2:24 AM
Unknown Object (File)
Jun 23 2023, 5:00 PM
Unknown Object (File)
May 14 2023, 9:44 AM
Unknown Object (File)
May 5 2023, 3:49 PM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable