Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Thomas Gleixner and committed by
Ingo Molnar
e5b61baf 148b9e2a

+18 -11
+17 -11
arch/arm/vfp/vfpmodule.c
··· 643 643 * hardware state at every thread switch. We clear our held state when 644 644 * a CPU has been killed, indicating that the VFP hardware doesn't contain 645 645 * a threads VFP state. When a CPU starts up, we re-enable access to the 646 - * VFP hardware. 647 - * 648 - * Both CPU_DYING and CPU_STARTING are called on the CPU which 646 + * VFP hardware. The callbacks below are called on the CPU which 649 647 * is being offlined/onlined. 650 648 */ 651 - static int vfp_hotplug(struct notifier_block *b, unsigned long action, 652 - void *hcpu) 649 + static int vfp_dying_cpu(unsigned int cpu) 653 650 { 654 - if (action == CPU_DYING || action == CPU_DYING_FROZEN) 655 - vfp_current_hw_state[(long)hcpu] = NULL; 656 - else if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) 657 - vfp_enable(NULL); 658 - return NOTIFY_OK; 651 + vfp_force_reload(cpu, current_thread_info()); 652 + return 0; 653 + } 654 + 655 + static int vfp_starting_cpu(unsigned int unused) 656 + { 657 + vfp_enable(NULL); 658 + return 0; 659 659 } 660 660 661 661 void vfp_kmode_exception(void) ··· 732 732 unsigned int vfpsid; 733 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 739 if (cpu_arch >= CPU_ARCH_ARMv6) 736 740 on_each_cpu(vfp_enable, NULL, 1); 737 741 ··· 798 794 VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; 799 795 } 800 796 801 - hotcpu_notifier(vfp_hotplug, 0); 797 + cpuhp_setup_state_nocalls(CPUHP_AP_ARM_VFP_STARTING, 798 + "AP_ARM_VFP_STARTING", vfp_starting_cpu, 799 + vfp_dying_cpu); 802 800 803 801 vfp_vector = vfp_support_entry; 804 802
+1
include/linux/cpuhotplug.h
··· 34 34 CPUHP_AP_PERF_X86_CQM_STARTING, 35 35 CPUHP_AP_PERF_X86_CSTATE_STARTING, 36 36 CPUHP_AP_PERF_XTENSA_STARTING, 37 + CPUHP_AP_ARM_VFP_STARTING, 37 38 CPUHP_AP_NOTIFY_STARTING, 38 39 CPUHP_AP_ONLINE, 39 40 CPUHP_TEARDOWN_CPU,