aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/vfp/vfpmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/vfp/vfpmodule.c')
-rw-r--r--arch/arm/vfp/vfpmodule.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 4178f6cc3d37..dedbb449632e 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -40,10 +40,19 @@ unsigned int VFP_arch;
40static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) 40static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
41{ 41{
42 struct thread_info *thread = v; 42 struct thread_info *thread = v;
43 union vfp_state *vfp = &thread->vfpstate; 43 union vfp_state *vfp;
44 44
45 switch (cmd) { 45 if (likely(cmd == THREAD_NOTIFY_SWITCH)) {
46 case THREAD_NOTIFY_FLUSH: 46 /*
47 * Always disable VFP so we can lazily save/restore the
48 * old state.
49 */
50 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
51 return NOTIFY_DONE;
52 }
53
54 vfp = &thread->vfpstate;
55 if (cmd == THREAD_NOTIFY_FLUSH) {
47 /* 56 /*
48 * Per-thread VFP initialisation. 57 * Per-thread VFP initialisation.
49 */ 58 */
@@ -56,29 +65,12 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
56 * Disable VFP to ensure we initialise it first. 65 * Disable VFP to ensure we initialise it first.
57 */ 66 */
58 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE); 67 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
59
60 /*
61 * FALLTHROUGH: Ensure we don't try to overwrite our newly
62 * initialised state information on the first fault.
63 */
64
65 case THREAD_NOTIFY_RELEASE:
66 /*
67 * Per-thread VFP cleanup.
68 */
69 if (last_VFP_context == vfp)
70 last_VFP_context = NULL;
71 break;
72
73 case THREAD_NOTIFY_SWITCH:
74 /*
75 * Always disable VFP so we can lazily save/restore the
76 * old state.
77 */
78 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
79 break;
80 } 68 }
81 69
70 /* flush and release case: Per-thread VFP cleanup. */
71 if (last_VFP_context == vfp)
72 last_VFP_context = NULL;
73
82 return NOTIFY_DONE; 74 return NOTIFY_DONE;
83} 75}
84 76