Page MenuHomeFreeBSD

PC64: Get the timestap from the proper OF field
ClosedPublic

Authored by breno.leitao_gmail.com on Feb 5 2018, 5:23 PM.
Referenced Files
F83111585: D14204.id38887.diff
Mon, May 6, 10:46 AM
Unknown Object (File)
Sat, May 4, 7:45 PM
Unknown Object (File)
Fri, May 3, 3:30 AM
Unknown Object (File)
Fri, May 3, 12:42 AM
Unknown Object (File)
Fri, May 3, 12:42 AM
Unknown Object (File)
Fri, May 3, 12:42 AM
Unknown Object (File)
Thu, May 2, 5:44 PM
Unknown Object (File)
Thu, May 2, 5:30 AM
Subscribers

Details

Summary

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:

    
get-property for timebase-frequency on zero phandle
    
panic: Unable to determine timebase frequency!

With the change above, cpuref->cr_hwref does not contain the phandle
anymore, thus, it never reads the proper CPU entry in OF.

Diff Detail

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

Event Timeline

So I have a memory of OF properties not being NUL terminated. If so, this code is wrong, though it might accidentally be right in some cases.

sys/powerpc/pseries/platform_chrp.c
296 ↗(On Diff #38887)

Is buf NUL terminated?

303 ↗(On Diff #38887)

Is buf NUL terminated?

Turns out IEEE 1275 standard and successors all guarantee that text strings are 1 to 31 characters followed by a NUL byte, so my worry is bogus.

Let me attach a new fix as proposed by Justin

jhibbits requested changes to this revision.Feb 8 2018, 5:31 PM

Fix those two nits, otherwise looks good.

sys/powerpc/pseries/platform_chrp.c
294 ↗(On Diff #39048)

cpus is not a boolean, you should use cpus == 0.

302 ↗(On Diff #39048)

Same as above here.

This revision now requires changes to proceed.Feb 8 2018, 5:31 PM
This revision is now accepted and ready to land.Feb 8 2018, 7:11 PM
This revision was automatically updated to reflect the committed changes.