Page MenuHomeFreeBSD

arm64: Initial SVE support
Needs ReviewPublic

Authored by andrew on Jan 4 2024, 12:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 13, 12:52 PM
Unknown Object (File)
Sun, Jun 30, 11:03 AM
Unknown Object (File)
Sat, Jun 29, 10:57 AM
Unknown Object (File)
Sat, Jun 22, 7:04 AM
Unknown Object (File)
Sat, Jun 22, 3:33 AM
Unknown Object (File)
Jun 14 2024, 5:48 AM
Unknown Object (File)
Jun 3 2024, 6:40 AM
Unknown Object (File)
May 23 2024, 3:57 PM
Subscribers

Details

Reviewers
kib
markj
manu
Group Reviewers
arm64
Summary

Add initial kernel support for SVE. This detects if SVE is present on
all CPUs, and if so allows for the use of SVE in the future.

As the SVE registers are a superset of the VFP registers we don't need
to restore the VFP registers when SVE is enabled.

Ths interface to enable SVE is provided, but not used until SVE is
supported in signals and with ptrace.

Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 58161
Build 55049: arc lint + arc unit

Event Timeline

This one seems reasonable, but it would be best to get others to say so too.

sys/arm64/arm64/vfp.c
111

Do you want to leave this in?

662

should you free the svesaved memory instead?

Rework to not guarentee the SVE registers are saved over a syscall other than sigreturn.
The ABI doesn't require SVE registers to be saved on a function call so extend this to a system call.
As dropping the SVE state on all system calls could get expensive only do it on context switch when in one.

Rework to not guarentee the SVE registers are saved over a syscall other than sigreturn.
The ABI doesn't require SVE registers to be saved on a function call so extend this to a system call.
As dropping the SVE state on all system calls could get expensive only do it on context switch when in one.

I read this as disallowing use of rtld for any custom ABI. Imagine that rtld bind is called to resolve a symbol which use custom calling conventions (namely, preserving SVE state). Then, if rtld ever needed to issue a syscall while working, it corrupts the SVE state of the caller.

Functions that take an SVE register as an argument, or use one for the return value are marked with STO_AARCH64_VARIANT_PCS [1]. In glibc it looks like they avoid lazy resolution for all variant pcs functions. As there are more reasons than just SVE for a function to be marked as a variant, and more reasons could be added in the future I think it's the only safe option.

[1] https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst#st_other-values

rebase + remove tf_flags to detect when we are in a syscall