Module Name:    src
Committed By:   riastradh
Date:           Mon Jul 13 16:54:03 UTC 2020

Modified Files:
        src/sys/arch/aarch64/aarch64: fpu.c
        src/sys/arch/arm/vfp: vfp_init.c

Log Message:
Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/aarch64/fpu.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/arm/vfp/vfp_init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/aarch64/fpu.c
diff -u src/sys/arch/aarch64/aarch64/fpu.c:1.6 src/sys/arch/aarch64/aarch64/fpu.c:1.7
--- src/sys/arch/aarch64/aarch64/fpu.c:1.6	Mon Jul 13 16:52:23 2020
+++ src/sys/arch/aarch64/aarch64/fpu.c	Mon Jul 13 16:54:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu.c,v 1.6 2020/07/13 16:52:23 riastradh Exp $ */
+/* $NetBSD: fpu.c,v 1.7 2020/07/13 16:54:03 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: fpu.c,v 1.6 2020/07/13 16:52:23 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: fpu.c,v 1.7 2020/07/13 16:54:03 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -179,7 +179,6 @@ fpu_state_release(lwp_t *l)
 void
 fpu_kern_enter(void)
 {
-	struct lwp *l = curlwp;
 	struct cpu_info *ci;
 	int s;
 
@@ -196,14 +195,8 @@ fpu_kern_enter(void)
 	KASSERT(ci->ci_kfpu_spl == -1);
 	ci->ci_kfpu_spl = s;
 
-	/*
-	 * If we are in a softint and have a pinned lwp, the fpu state
-	 * is that of the pinned lwp, so save it there.
-	 */
-	if ((l->l_pflag & LP_INTR) && (l->l_switchto != NULL))
-		l = l->l_switchto;
-	if (fpu_used_p(l))
-		fpu_save(l);
+	/* Save any fpu state on the current CPU.  */
+	pcu_save_all_on_cpu();
 
 	/*
 	 * Enable the fpu, and wait until it is enabled before

Index: src/sys/arch/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.67 src/sys/arch/arm/vfp/vfp_init.c:1.68
--- src/sys/arch/arm/vfp/vfp_init.c:1.67	Mon Jul 13 16:53:06 2020
+++ src/sys/arch/arm/vfp/vfp_init.c	Mon Jul 13 16:54:03 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: vfp_init.c,v 1.67 2020/07/13 16:53:06 riastradh Exp $ */
+/*      $NetBSD: vfp_init.c,v 1.68 2020/07/13 16:54:03 riastradh Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -32,7 +32,7 @@
 #include "opt_cputypes.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.67 2020/07/13 16:53:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.68 2020/07/13 16:54:03 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -668,7 +668,6 @@ vfp_setcontext(struct lwp *l, const mcon
 void
 fpu_kern_enter(void)
 {
-	struct lwp *l = curlwp;
 	struct cpu_info *ci;
 	uint32_t fpexc;
 	int s;
@@ -686,14 +685,8 @@ fpu_kern_enter(void)
 	KASSERT(ci->ci_kfpu_spl == -1);
 	ci->ci_kfpu_spl = s;
 
-	/*
-	 * If we are in a softint and have a pinned lwp, the fpu state
-	 * is that of the pinned lwp, so save it there.
-	 */
-	if ((l->l_pflag & LP_INTR) && (l->l_switchto != NULL))
-		l = l->l_switchto;
-	if (vfp_used_p(l))
-		vfp_savecontext(l);
+	/* Save any fpu state on the current CPU.  */
+	pcu_save_all_on_cpu();
 
 	/* Enable the fpu.  */
 	fpexc = armreg_fpexc_read();

Reply via email to