Commit e5b61baf authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

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: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: default avatarSebastian 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.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 148b9e2a
...@@ -643,19 +643,19 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp, ...@@ -643,19 +643,19 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
* hardware state at every thread switch. We clear our held state when * hardware state at every thread switch. We clear our held state when
* a CPU has been killed, indicating that the VFP hardware doesn't contain * a CPU has been killed, indicating that the VFP hardware doesn't contain
* a threads VFP state. When a CPU starts up, we re-enable access to the * a threads VFP state. When a CPU starts up, we re-enable access to the
* VFP hardware. * VFP hardware. The callbacks below are called on the CPU which
*
* Both CPU_DYING and CPU_STARTING are called on the CPU which
* is being offlined/onlined. * is being offlined/onlined.
*/ */
static int vfp_hotplug(struct notifier_block *b, unsigned long action, static int vfp_dying_cpu(unsigned int cpu)
void *hcpu) {
vfp_force_reload(cpu, current_thread_info());
return 0;
}
static int vfp_starting_cpu(unsigned int unused)
{ {
if (action == CPU_DYING || action == CPU_DYING_FROZEN)
vfp_current_hw_state[(long)hcpu] = NULL;
else if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
vfp_enable(NULL); vfp_enable(NULL);
return NOTIFY_OK; return 0;
} }
void vfp_kmode_exception(void) void vfp_kmode_exception(void)
...@@ -732,6 +732,10 @@ static int __init vfp_init(void) ...@@ -732,6 +732,10 @@ static int __init vfp_init(void)
unsigned int vfpsid; unsigned int vfpsid;
unsigned int cpu_arch = cpu_architecture(); unsigned int cpu_arch = cpu_architecture();
/*
* Enable the access to the VFP on all online CPUs so the
* following test on FPSID will succeed.
*/
if (cpu_arch >= CPU_ARCH_ARMv6) if (cpu_arch >= CPU_ARCH_ARMv6)
on_each_cpu(vfp_enable, NULL, 1); on_each_cpu(vfp_enable, NULL, 1);
...@@ -794,7 +798,9 @@ static int __init vfp_init(void) ...@@ -794,7 +798,9 @@ static int __init vfp_init(void)
VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT;
} }
hotcpu_notifier(vfp_hotplug, 0); cpuhp_setup_state_nocalls(CPUHP_AP_ARM_VFP_STARTING,
"AP_ARM_VFP_STARTING", vfp_starting_cpu,
vfp_dying_cpu);
vfp_vector = vfp_support_entry; vfp_vector = vfp_support_entry;
......
...@@ -34,6 +34,7 @@ enum cpuhp_state { ...@@ -34,6 +34,7 @@ enum cpuhp_state {
CPUHP_AP_PERF_X86_CQM_STARTING, CPUHP_AP_PERF_X86_CQM_STARTING,
CPUHP_AP_PERF_X86_CSTATE_STARTING, CPUHP_AP_PERF_X86_CSTATE_STARTING,
CPUHP_AP_PERF_XTENSA_STARTING, CPUHP_AP_PERF_XTENSA_STARTING,
CPUHP_AP_ARM_VFP_STARTING,
CPUHP_AP_NOTIFY_STARTING, CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE, CPUHP_AP_ONLINE,
CPUHP_TEARDOWN_CPU, CPUHP_TEARDOWN_CPU,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment