diff options
-rw-r--r-- | arch/arm64/kernel/fpsimd.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 3dca15634e69..44d6f7545505 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/cpu.h> | ||
20 | #include <linux/cpu_pm.h> | 21 | #include <linux/cpu_pm.h> |
21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
@@ -296,6 +297,35 @@ static void fpsimd_pm_init(void) | |||
296 | static inline void fpsimd_pm_init(void) { } | 297 | static inline void fpsimd_pm_init(void) { } |
297 | #endif /* CONFIG_CPU_PM */ | 298 | #endif /* CONFIG_CPU_PM */ |
298 | 299 | ||
300 | #ifdef CONFIG_HOTPLUG_CPU | ||
301 | static int fpsimd_cpu_hotplug_notifier(struct notifier_block *nfb, | ||
302 | unsigned long action, | ||
303 | void *hcpu) | ||
304 | { | ||
305 | unsigned int cpu = (long)hcpu; | ||
306 | |||
307 | switch (action) { | ||
308 | case CPU_DEAD: | ||
309 | case CPU_DEAD_FROZEN: | ||
310 | per_cpu(fpsimd_last_state, cpu) = NULL; | ||
311 | break; | ||
312 | } | ||
313 | return NOTIFY_OK; | ||
314 | } | ||
315 | |||
316 | static struct notifier_block fpsimd_cpu_hotplug_notifier_block = { | ||
317 | .notifier_call = fpsimd_cpu_hotplug_notifier, | ||
318 | }; | ||
319 | |||
320 | static inline void fpsimd_hotplug_init(void) | ||
321 | { | ||
322 | register_cpu_notifier(&fpsimd_cpu_hotplug_notifier_block); | ||
323 | } | ||
324 | |||
325 | #else | ||
326 | static inline void fpsimd_hotplug_init(void) { } | ||
327 | #endif | ||
328 | |||
299 | /* | 329 | /* |
300 | * FP/SIMD support code initialisation. | 330 | * FP/SIMD support code initialisation. |
301 | */ | 331 | */ |
@@ -315,6 +345,7 @@ static int __init fpsimd_init(void) | |||
315 | elf_hwcap |= HWCAP_ASIMD; | 345 | elf_hwcap |= HWCAP_ASIMD; |
316 | 346 | ||
317 | fpsimd_pm_init(); | 347 | fpsimd_pm_init(); |
348 | fpsimd_hotplug_init(); | ||
318 | 349 | ||
319 | return 0; | 350 | return 0; |
320 | } | 351 | } |