Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2024 15:05:08 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3f2ed1883896 - stable/14 - arm64: Create a version of vfp_save_state for cpu_switch
Message-ID:  <202410211505.49LF58n8046865@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by andrew:

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

commit 3f2ed1883896651e51a98060f34808457d24f679
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-06-12 13:09:14 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-10-21 15:03:26 +0000

    arm64: Create a version of vfp_save_state for cpu_switch
    
    This will be used when we add SVE support to reduce the registers
    needed to be saved on context switch.
    
    Reviewed by:    imp
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D43305
    
    (cherry picked from commit a30149b2a9c6ac5280523eea9570e5b5e5f1fdf8)
---
 sys/arm64/arm64/swtch.S | 4 +---
 sys/arm64/arm64/vfp.c   | 8 ++++++++
 sys/arm64/include/vfp.h | 1 +
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S
index 9c43de3a9eae..882bfd7cf05a 100644
--- a/sys/arm64/arm64/swtch.S
+++ b/sys/arm64/arm64/swtch.S
@@ -146,9 +146,7 @@ ENTRY(cpu_switch)
 	mov	x21, x2
 
 #ifdef VFP
-	/* Load the pcb address */
-	mov	x1, x4
-	bl	vfp_save_state
+	bl	vfp_save_state_switch
 	mov	x0, x20
 #else
 	mov	x0, x1
diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c
index f35cd960702b..c65108a83399 100644
--- a/sys/arm64/arm64/vfp.c
+++ b/sys/arm64/arm64/vfp.c
@@ -216,6 +216,14 @@ vfp_save_state_savectx(struct pcb *pcb)
 	vfp_save_state_common(curthread, pcb);
 }
 
+void
+vfp_save_state_switch(struct thread *td)
+{
+	KASSERT(td != NULL, ("NULL vfp thread"));
+
+	vfp_save_state_common(td, td->td_pcb);
+}
+
 /*
  * Update the VFP state for a forked process or new thread. The PCB will
  * have been copied from the old thread.
diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h
index 7f4c86e7737d..47d068d6050c 100644
--- a/sys/arm64/include/vfp.h
+++ b/sys/arm64/include/vfp.h
@@ -79,6 +79,7 @@ void	vfp_reset_state(struct thread *, struct pcb *);
 void	vfp_restore_state(void);
 void	vfp_save_state(struct thread *, struct pcb *);
 void	vfp_save_state_savectx(struct pcb *);
+void	vfp_save_state_switch(struct thread *);
 
 struct fpu_kern_ctx;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410211505.49LF58n8046865>