The branch stable/14 has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=aa594ddcc85459ed342694816df26434e96ba88a

commit aa594ddcc85459ed342694816df26434e96ba88a
Author:     Andrew Turner <and...@freebsd.org>
AuthorDate: 2024-09-27 13:37:10 +0000
Commit:     Andrew Turner <and...@freebsd.org>
CommitDate: 2024-10-21 15:03:26 +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
    
    (cherry picked from commit 87a58d931db7b40d8d225a7edb82b78937078b7f)
---
 sys/arm64/arm64/sys_machdep.c | 22 +++++++++++++++++++++-
 sys/arm64/include/sysarch.h   |  3 +++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/sys_machdep.c b/sys/arm64/arm64/sys_machdep.c
index c50b745cfba0..aba864b9526e 100644
--- a/sys/arm64/arm64/sys_machdep.c
+++ b/sys/arm64/arm64/sys_machdep.c
@@ -29,14 +29,34 @@
 
 #include <sys/cdefs.h>
 #include <sys/param.h>
+#include <sys/proc.h>
 #include <sys/systm.h>
 #include <sys/sysproto.h>
 
+#include <machine/pcb.h>
 #include <machine/sysarch.h>
 
+#include <security/audit/audit.h>
+
 int
 sysarch(struct thread *td, struct sysarch_args *uap)
 {
+       struct pcb *pcb;
+       unsigned long sve_len;
+       int error;
+
+       switch (uap->op) {
+       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;
+       }
 
-       return (ENOTSUP);
+       return (error);
 }
diff --git a/sys/arm64/include/sysarch.h b/sys/arm64/include/sysarch.h
index 2bd45d384743..f72d3427602e 100644
--- a/sys/arm64/include/sysarch.h
+++ b/sys/arm64/include/sysarch.h
@@ -39,6 +39,9 @@
 #ifndef _MACHINE_SYSARCH_H_
 #define        _MACHINE_SYSARCH_H_
 
+#define        ARM64_GET_SVE_VL        0x200
+/* Reserved ARM64_SET_SVE_VL   0x201 */
+
 #ifndef _KERNEL
 
 __BEGIN_DECLS

Reply via email to