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.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index a63c4be99b36..7f3f59fcaa21 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -433,7 +433,11 @@ static inline void vfp_pm_init(void) { }
433 * saved one. This function is used by the ptrace mechanism. 433 * saved one. This function is used by the ptrace mechanism.
434 */ 434 */
435#ifdef CONFIG_SMP 435#ifdef CONFIG_SMP
436void vfp_sync_state(struct thread_info *thread) 436void vfp_sync_hwstate(struct thread_info *thread)
437{
438}
439
440void vfp_flush_hwstate(struct thread_info *thread)
437{ 441{
438 /* 442 /*
439 * On SMP systems, the VFP state is automatically saved at every 443 * On SMP systems, the VFP state is automatically saved at every
@@ -444,35 +448,48 @@ void vfp_sync_state(struct thread_info *thread)
444 thread->vfpstate.hard.cpu = NR_CPUS; 448 thread->vfpstate.hard.cpu = NR_CPUS;
445} 449}
446#else 450#else
447void vfp_sync_state(struct thread_info *thread) 451void vfp_sync_hwstate(struct thread_info *thread)
448{ 452{
449 unsigned int cpu = get_cpu(); 453 unsigned int cpu = get_cpu();
450 u32 fpexc = fmrx(FPEXC);
451 454
452 /* 455 /*
453 * If VFP is enabled, the previous state was already saved and 456 * If the thread we're interested in is the current owner of the
454 * last_VFP_context updated. 457 * hardware VFP state, then we need to save its state.
455 */ 458 */
456 if (fpexc & FPEXC_EN) 459 if (last_VFP_context[cpu] == &thread->vfpstate) {
457 goto out; 460 u32 fpexc = fmrx(FPEXC);
458 461
459 if (!last_VFP_context[cpu]) 462 /*
460 goto out; 463 * Save the last VFP state on this CPU.
464 */
465 fmxr(FPEXC, fpexc | FPEXC_EN);
466 vfp_save_state(&thread->vfpstate, fpexc | FPEXC_EN);
467 fmxr(FPEXC, fpexc);
468 }
461 469
462 /* 470 put_cpu();
463 * Save the last VFP state on this CPU. 471}
464 */ 472
465 fmxr(FPEXC, fpexc | FPEXC_EN); 473void vfp_flush_hwstate(struct thread_info *thread)
466 vfp_save_state(last_VFP_context[cpu], fpexc); 474{
467 fmxr(FPEXC, fpexc); 475 unsigned int cpu = get_cpu();
468 476
469 /* 477 /*
470 * Set the context to NULL to force a reload the next time the thread 478 * If the thread we're interested in is the current owner of the
471 * uses the VFP. 479 * hardware VFP state, then we need to save its state.
472 */ 480 */
473 last_VFP_context[cpu] = NULL; 481 if (last_VFP_context[cpu] == &thread->vfpstate) {
482 u32 fpexc = fmrx(FPEXC);
483
484 fmxr(FPEXC, fpexc & ~FPEXC_EN);
485
486 /*
487 * Set the context to NULL to force a reload the next time
488 * the thread uses the VFP.
489 */
490 last_VFP_context[cpu] = NULL;
491 }
474 492
475out:
476 put_cpu(); 493 put_cpu();
477} 494}
478#endif 495#endif