Page MenuHomeFreeBSD

cpu: New cpu_get_pcpuid(), retrieves internal CPU ID
ClosedPublic

Authored by olce on Jun 27 2026, 1:44 AM.
Tags
None
Referenced Files
F175626977: D57897.diff
Mon, Oct 12, 3:38 AM
F175567582: D57897.id180801.diff
Sun, Oct 11, 6:26 PM
Unknown Object (File)
Thu, Oct 8, 1:50 PM
Unknown Object (File)
Fri, Oct 2, 6:49 PM
Unknown Object (File)
Wed, Sep 30, 10:48 PM
Unknown Object (File)
Tue, Sep 29, 4:14 AM
Unknown Object (File)
Thu, Sep 24, 4:35 PM
Unknown Object (File)
Thu, Sep 24, 3:01 PM
Subscribers

Details

Summary

It is a handy shortcut that will be used extensively in
hwpstate_intel(4) and hwpstate_amd(4).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.Jun 27 2026, 1:44 AM
jhb added inline comments.
sys/sys/cpu.h
45

This can now use __BUS_ACCESSOR_DEFAULT() to return NULL by default, which will also mean you can start using cpu_has_pcpu in the pstate drivers to check for the ivar being valid vs manually calling BUS_READ_IVAR. It wouldn't be a functional change, just a cosmetic change that spells things more typically. (Unrelated to this commit, just a nice cleanup you can do as a separate commit)

65

This can also now use __BUS_ACCESSOR_DEFAULT() with a default value of -1.

This revision is now accepted and ready to land.Jul 3 2026, 3:06 PM

Thanks, will do some followup next week.