aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-07-13 13:16:35 -0400
committerIngo Molnar <mingo@kernel.org>2016-07-15 04:40:22 -0400
commite5b61bafe70477e05e1dce0d6ca4ec181e23cb2a (patch)
tree64875370c78c0d7a8541f779dac945b468bbca1b
parent148b9e2abea6f50e4620e4ac0683b4913c4364c0 (diff)
arm: Convert VFP hotplug notifiers to state machine
Straight forward conversion plus commentary why code which is executed in hotplug callbacks needs to be invoked before installing them. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russell King <linux@arm.linux.org.uk> Cc: linux-arm-kernel@lists.infradead.org Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153335.713612993@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/arm/vfp/vfpmodule.c28
-rw-r--r--include/linux/cpuhotplug.h1
2 files changed, 18 insertions, 11 deletions
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 73085d3482ed..da0b33deba6d 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -643,19 +643,19 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
643 * hardware state at every thread switch. We clear our held state when 643 * hardware state at every thread switch. We clear our held state when
644 * a CPU has been killed, indicating that the VFP hardware doesn't contain 644 * a CPU has been killed, indicating that the VFP hardware doesn't contain
645 * a threads VFP state. When a CPU starts up, we re-enable access to the 645 * a threads VFP state. When a CPU starts up, we re-enable access to the
646 * VFP hardware. 646 * VFP hardware. The callbacks below are called on the CPU which
647 *
648 * Both CPU_DYING and CPU_STARTING are called on the CPU which
649 * is being offlined/onlined. 647 * is being offlined/onlined.
650 */ 648 */
651static int vfp_hotplug(struct notifier_block *b, unsigned long action, 649static int vfp_dying_cpu(unsigned int cpu)
652 void *hcpu)
653{ 650{
654 if (action == CPU_DYING || action == CPU_DYING_FROZEN) 651 vfp_force_reload(cpu, current_thread_info());
655 vfp_current_hw_state[(long)hcpu] = NULL; 652 return 0;
656 else if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) 653}
657 vfp_enable(NULL); 654
658 return NOTIFY_OK; 655static int vfp_starting_cpu(unsigned int unused)
656{
657 vfp_enable(NULL);
658 return 0;
659} 659}
660 660
661void vfp_kmode_exception(void) 661void vfp_kmode_exception(void)
@@ -732,6 +732,10 @@ static int __init vfp_init(void)
732 unsigned int vfpsid; 732 unsigned int vfpsid;
733 unsigned int cpu_arch = cpu_architecture(); 733 unsigned int cpu_arch = cpu_architecture();
734 734
735 /*
736 * Enable the access to the VFP on all online CPUs so the
737 * following test on FPSID will succeed.
738 */
735 if (cpu_arch >= CPU_ARCH_ARMv6) 739 if (cpu_arch >= CPU_ARCH_ARMv6)
736 on_each_cpu(vfp_enable, NULL, 1); 740 on_each_cpu(vfp_enable, NULL, 1);
737 741
@@ -794,7 +798,9 @@ static int __init vfp_init(void)
794 VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; 798 VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT;
795 } 799 }
796 800
797 hotcpu_notifier(vfp_hotplug, 0); 801 cpuhp_setup_state_nocalls(CPUHP_AP_ARM_VFP_STARTING,
802 "AP_ARM_VFP_STARTING", vfp_starting_cpu,
803 vfp_dying_cpu);
798 804
799 vfp_vector = vfp_support_entry; 805 vfp_vector = vfp_support_entry;
800 806
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 3e719ba44fbe..4c63cb30aee6 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -34,6 +34,7 @@ enum cpuhp_state {
34 CPUHP_AP_PERF_X86_CQM_STARTING, 34 CPUHP_AP_PERF_X86_CQM_STARTING,
35 CPUHP_AP_PERF_X86_CSTATE_STARTING, 35 CPUHP_AP_PERF_X86_CSTATE_STARTING,
36 CPUHP_AP_PERF_XTENSA_STARTING, 36 CPUHP_AP_PERF_XTENSA_STARTING,
37 CPUHP_AP_ARM_VFP_STARTING,
37 CPUHP_AP_NOTIFY_STARTING, 38 CPUHP_AP_NOTIFY_STARTING,
38 CPUHP_AP_ONLINE, 39 CPUHP_AP_ONLINE,
39 CPUHP_TEARDOWN_CPU, 40 CPUHP_TEARDOWN_CPU,