Skip to content

Add HWCAP2 support for AArch64 Linux. #1335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 22, 2022

Conversation

jacobbramley
Copy link
Contributor

This doesn't extend the set of recognised features, but corrects some existing ones to refer to HWCAP2.

Note that this changes the behaviour when HWCAP2 is absent on any platform. In particular:

  • A zero result from getauxval() could just mean that none of those features are enabled.
  • If HWCAP2 is known to be truly absent (e.g. from reading /proc/self/auxv), but we have HWCAP, then it's likely that the kernel is too old to support the corresponding features, and looking at a fallback isn't likely to be productive.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) soon.

Please see the contribution instructions for more information.

HWCAP2 gets added on-demand for each architecture as they overflow
HWCAP, and for recent users (such as AArch64), we are likely to
encounter old kernels that do not provide HWCAP2.

A present-but-zero value is also likely in practice, since HWCAP2
naturally contains recent architectural features. `getauxval(AT_HWCAP2)`
cannot distinguish between absent and zero values, but to user-space
Rust the meaning is the same: the corresponding features are not
supported.
This doesn't extend the set of recognised features, but corrects some
existing ones to refer to HWCAP2.
@jacobbramley
Copy link
Contributor Author

I'm going to force-push to drop those Gerrit "Change-Id" tags. I apologise for the disruption.

@jacobbramley
Copy link
Contributor Author

Fixing the feature detection enabled a test that's apparently broken. (I didn't see it here because my hardware genuinely doesn't have that feature, so the test didn't run at all.) I'm investigating!

These weren't run before because "i8mm" feature detection was broken.

This change provides correct expected results, and also adds some
negative inputs so that each variant behaves differently.
@Amanieu Amanieu merged commit 586801d into rust-lang:master Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants