Bug 225688 - ppc64: Unable to read timebase
Summary: ppc64: Unable to read timebase
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ppc (Nobody)
Keywords: patch
Depends on:
Reported: 2018-02-05 16:42 UTC by Breno Leitao
Modified: 2021-10-09 14:19 UTC (History)
1 user (show)

See Also:

Get the timebase from the proper OF field. (1.76 KB, patch)
2018-02-05 16:42 UTC, Breno Leitao
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Breno Leitao 2018-02-05 16:42:26 UTC
Created attachment 190344 [details]
Get the timebase from the proper OF field.

After revision rS328534('PPC64: use hwref instead of cpuid'), FreeBSD on powerpc64 virtual machine panics since it is unable to read the timebase, showing the following error:
gcc version 4.2.1 20070831 patched [FreeBSD]
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: Running on a broken hypervisor that does not support mandatory H_CLEAR_MOD and H_CLEAR_REF hypercalls. Performance will be suboptimal.
VT: init without driver.

get-property for timebase-frequency on zero phandle

panic: Unable to determine timebase frequency!
cpuid = 0
time = 1
KDB: stack backtrace:
0xc000000000008510: at .kdb_backtrace+0x5c
0xc000000000008640: at .vpanic+0x1a4
0xc000000000008700: at .panic+0x38
0xc000000000008790: at .chrp_timebase_freq+0x44
0xc000000000008820: at .platform_timebase_freq+0x78
0xc0000000000088b0: at .decr_init+0x54
0xc000000000008980: at .cpu_startup+0x20
0xc000000000008a10: at .mi_startup+0x11c
0xc000000000008aa0: at btext+0xb4
KDB: enter: panic

With the change above,  cpuref->cr_hwref does not contain the phandle anymore, thus, it never reads the proper CPU entry in OF.
Comment 1 Breno Leitao 2018-02-05 16:50:26 UTC
Please find the patch that fix this issue attached.
Comment 2 Breno Leitao 2018-02-05 17:24:31 UTC
I also created a diff at phabricator. Since this is my first time using this system, it might not be in the appropriate format:

Comment 3 Piotr Pawel Stefaniak freebsd_committer 2021-10-09 14:19:15 UTC
The fix seems present in all supported branches.