Skip to content
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

arm64 cpu identification is not portable to BSDs #795

Open
j-bm opened this issue Feb 13, 2024 · 2 comments
Open

arm64 cpu identification is not portable to BSDs #795

j-bm opened this issue Feb 13, 2024 · 2 comments

Comments

@j-bm
Copy link
Contributor

j-bm commented Feb 13, 2024

The bli_cpuid.c code for ARM64 is fairly complex, relies on linux-isms and therefore is not portable to *BSD systems.

There is some #ifdef for Apple that seems redundant, though I must say I am not able to test this.

@devinamatthews
Copy link
Member

Yes this is a known problem. Do you happen to know what the equivalent mechanism to HWCAP is on BSD?

@j-bm
Copy link
Contributor Author

j-bm commented Feb 16, 2024

I'm slowly becoming more knowledgeable about aarch64 machines...

It seems Linux user-mode runs at EL1 allowing access to CPU feature registers like MIDR or ID_AA64PFR0_EL1 to succeed.

OpenBSD (at least) runs at EL0 therefore these instructions fail with SIGILL (illegal instruction).

I see two paths forward: grep the dmesg output for indicators; OpenBSD for now does not publish the full CPU feature set in the dmesg output for aarch64 (it does so for most other architectures.)

Or run test code, trap SIGILL and revert to "generic" if needed.

Both look about as hacky as can be imagined.

(I don't know what Apple machines do.) I'm testing on Raspberry Pi 4B.

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

No branches or pull requests

2 participants