Module Name:    src
Committed By:   skrll
Date:           Sat Apr  6 08:48:53 UTC 2019

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

Log Message:
Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.61 src/sys/arch/arm/vfp/vfp_init.c:1.62
--- src/sys/arch/arm/vfp/vfp_init.c:1.61	Sun Mar 17 08:41:42 2019
+++ src/sys/arch/arm/vfp/vfp_init.c	Sat Apr  6 08:48:53 2019
@@ -1,4 +1,4 @@
-/*      $NetBSD: vfp_init.c,v 1.61 2019/03/17 08:41:42 skrll Exp $ */
+/*      $NetBSD: vfp_init.c,v 1.62 2019/04/06 08:48:53 skrll 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.61 2019/03/17 08:41:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.62 2019/04/06 08:48:53 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -260,7 +260,8 @@ vfp_attach(struct cpu_info *ci)
 		if ((nsacr & nsacr_vfp) != nsacr_vfp) {
 			aprint_normal_dev(ci->ci_dev,
 			    "VFP access denied (NSACR=%#x)\n", nsacr);
-			install_coproc_handler(VFP_COPROC, vfp_fpscr_handler);
+			if (CPU_IS_PRIMARY(ci))
+				install_coproc_handler(VFP_COPROC, vfp_fpscr_handler);
 			ci->ci_vfp_id = 0;
 			evcnt_attach_dynamic(&ci->ci_vfp_evs[0],
 			    EVCNT_TYPE_TRAP, NULL, ci->ci_cpuname,
@@ -290,7 +291,8 @@ vfp_attach(struct cpu_info *ci)
 		if (!vfp_p) {
 			aprint_normal_dev(ci->ci_dev,
 			    "VFP access denied (CPACR=%#x)\n", cpacr);
-			install_coproc_handler(VFP_COPROC, vfp_fpscr_handler);
+			if (CPU_IS_PRIMARY(ci))
+				install_coproc_handler(VFP_COPROC, vfp_fpscr_handler);
 			ci->ci_vfp_id = 0;
 			evcnt_attach_dynamic(&ci->ci_vfp_evs[0],
 			    EVCNT_TYPE_TRAP, NULL, ci->ci_cpuname,
@@ -309,7 +311,8 @@ vfp_attach(struct cpu_info *ci)
 
 	if (undefined_test != 0) {
 		aprint_normal_dev(ci->ci_dev, "No VFP detected\n");
-		install_coproc_handler(VFP_COPROC, vfp_fpscr_handler);
+		if (CPU_IS_PRIMARY(ci))
+			install_coproc_handler(VFP_COPROC, vfp_fpscr_handler);
 		ci->ci_vfp_id = 0;
 		return;
 	}
@@ -343,7 +346,8 @@ vfp_attach(struct cpu_info *ci)
 	default:
 		aprint_normal_dev(ci->ci_dev, "unrecognized VFP version %#x\n",
 		    fpsid);
-		install_coproc_handler(VFP_COPROC, vfp_fpscr_handler);
+		if (CPU_IS_PRIMARY(ci))
+			install_coproc_handler(VFP_COPROC, vfp_fpscr_handler);
 		vfp_fpscr_changable = VFP_FPSCR_CSUM|VFP_FPSCR_ESUM
 		    |VFP_FPSCR_RMODE;
 		vfp_fpscr_default = 0;
@@ -391,12 +395,14 @@ vfp_attach(struct cpu_info *ci)
 	    ci->ci_cpuname, "vfp coproc re-use");
 	evcnt_attach_dynamic(&ci->ci_vfp_evs[2], EVCNT_TYPE_TRAP, NULL,
 	    ci->ci_cpuname, "vfp coproc fault");
-	install_coproc_handler(VFP_COPROC, vfp_handler);
-	install_coproc_handler(VFP_COPROC2, vfp_handler);
+	if (CPU_IS_PRIMARY(ci)) {
+		install_coproc_handler(VFP_COPROC, vfp_handler);
+		install_coproc_handler(VFP_COPROC2, vfp_handler);
 #ifdef CPU_CORTEX
-	if (cpu_neon_present)
-		install_coproc_handler(CORE_UNKNOWN_HANDLER, neon_handler);
+		if (cpu_neon_present)
+			install_coproc_handler(CORE_UNKNOWN_HANDLER, neon_handler);
 #endif
+	}
 }
 
 /* The real handler for VFP bounces.  */

Reply via email to