git: 87a58d931db7 - main - arm64: Add an SVE sysarch
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 Sep 2024 12:23:38 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=87a58d931db7b40d8d225a7edb82b78937078b7f commit 87a58d931db7b40d8d225a7edb82b78937078b7f Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2024-09-27 13:37:10 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-09-30 12:04:23 +0000 arm64: Add an SVE sysarch To allow for user space to read the SVE vector length add a sysarch handler to return the value to userspace. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43308 --- sys/arm64/arm64/sys_machdep.c | 13 +++++++++++++ sys/arm64/include/sysarch.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/sys/arm64/arm64/sys_machdep.c b/sys/arm64/arm64/sys_machdep.c index eedc57f7c572..81b8ef73d9c0 100644 --- a/sys/arm64/arm64/sys_machdep.c +++ b/sys/arm64/arm64/sys_machdep.c @@ -28,6 +28,7 @@ */ #include <sys/param.h> +#include <sys/proc.h> #include <sys/systm.h> #include <sys/proc.h> #include <sys/sysproto.h> @@ -36,14 +37,19 @@ #include <vm/pmap.h> #include <vm/vm_map.h> +#include <machine/pcb.h> #include <machine/sysarch.h> #include <machine/vmparam.h> +#include <security/audit/audit.h> + int sysarch(struct thread *td, struct sysarch_args *uap) { struct arm64_guard_page_args gp_args; + struct pcb *pcb; vm_offset_t eva; + unsigned long sve_len; int error; switch (uap->op) { @@ -73,6 +79,13 @@ sysarch(struct thread *td, struct sysarch_args *uap) error = pmap_bti_set(vmspace_pmap(td->td_proc->p_vmspace), trunc_page(gp_args.addr), round_page(eva)); break; + case ARM64_GET_SVE_VL: + pcb = td->td_pcb; + sve_len = pcb->pcb_sve_len; + error = EINVAL; + if (sve_len != 0) + error = copyout(&sve_len, uap->parms, sizeof(sve_len)); + break; default: error = EINVAL; break; diff --git a/sys/arm64/include/sysarch.h b/sys/arm64/include/sysarch.h index 83094943423a..b7846651c031 100644 --- a/sys/arm64/include/sysarch.h +++ b/sys/arm64/include/sysarch.h @@ -46,6 +46,9 @@ struct arm64_guard_page_args { __size_t len; }; +#define ARM64_GET_SVE_VL 0x200 +/* Reserved ARM64_SET_SVE_VL 0x201 */ + #ifndef _KERNEL __BEGIN_DECLS