Page MenuHomeFreeBSD

arm64: export new HWCAP features
ClosedPublic

Authored by mhorne on Aug 11 2020, 7:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 14, 7:34 AM
Unknown Object (File)
Thu, Mar 14, 7:34 AM
Unknown Object (File)
Fri, Mar 8, 8:29 AM
Unknown Object (File)
Feb 14 2024, 10:47 AM
Unknown Object (File)
Feb 10 2024, 1:20 PM
Unknown Object (File)
Dec 21 2023, 6:38 PM
Unknown Object (File)
Dec 20 2023, 1:50 AM
Unknown Object (File)
Nov 27 2023, 2:19 PM
Subscribers

Details

Summary

This includes the addition of elf_hwcap2 into the sysvec, and a separate
function to parse for those features.

This only exposes features which require no further configuration, e.g.
indicating the presence of certain instructions. Larger features (SVE)
will not be advertised until we actually support them.

Reference: https://www.kernel.org/doc/html/v5.8/arm64/elf_hwcaps.html

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33001
Build 30390: arc lint + arc unit

Event Timeline

sys/arm64/arm64/identcpu.c
1143

Suppose CPUs 0 and 1 have different capabilities: CPU 0 has no capabilities covered by the elf_hwcap2 mask, but CPU 1 has at least one. Then, when cpu == 1 we will see that elf_hwcap2 == 0 and set elf_hwcap2 to the set of CPU 1's capabilities even though they are not shared by all CPUs.

I suppose this could happen with elf_hwcap too, but it seems less likely that a CPU has no capabilities in that set.

sys/arm64/arm64/identcpu.c
1143

That's a good point. I think instead we could initialize elf_hwcap2 to (u_long)-1 and use &= all the way.

Do any of the new caps require kernel support before they can be used? If so we shouldn't report them to the user until that support is in place.

sys/arm64/arm64/identcpu.c
1143

I think we should be using user_cpu_desc to set both elf_hwcap and elf_hwcap2. This will ensure we are consistent with what we report through both methods.

Do any of the new caps require kernel support before they can be used? If so we shouldn't report them to the user until that support is in place.

Not as far as I know, most simply indicate the presence of instructions. I need to do a second reading to be sure before committing.

Expose SSBS in user_cpu_desc. Annotate elf_hwcap and elf_hwcap2 as __read_frequently.

Do any of the new caps require kernel support before they can be used? If so we shouldn't report them to the user until that support is in place.

Not as far as I know, most simply indicate the presence of instructions. I need to do a second reading to be sure before committing.

ARMv8.5-BTI will require some work in the kernel before it can be exposed to userspace, so it is still gated behind user_cpu_desc. The rest of these features are safe to expose.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 8 2020, 3:36 PM
This revision was automatically updated to reflect the committed changes.