1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2002 ARM Ltd.
6 * This hotplug implementation is _specific_ to the situation found on
7 * ARM development platforms where there is _no_ possibility of actually
8 * taking a CPU offline, resetting it, or otherwise. Real platforms must
11 #include <linux/kernel.h>
12 #include <linux/errno.h>
13 #include <linux/smp.h>
15 #include <asm/smp_plat.h>
18 #include <plat/platsmp.h>
20 static inline void versatile_immitation_enter_lowpower(unsigned int actrl_mask
)
25 "mcr p15, 0, %1, c7, c5, 0\n"
26 " mcr p15, 0, %1, c7, c10, 4\n"
30 " mrc p15, 0, %0, c1, c0, 1\n"
32 " mcr p15, 0, %0, c1, c0, 1\n"
33 " mrc p15, 0, %0, c1, c0, 0\n"
35 " mcr p15, 0, %0, c1, c0, 0\n"
37 : "r" (0), "Ir" (CR_C
), "Ir" (actrl_mask
)
41 static inline void versatile_immitation_leave_lowpower(unsigned int actrl_mask
)
46 "mrc p15, 0, %0, c1, c0, 0\n"
48 " mcr p15, 0, %0, c1, c0, 0\n"
49 " mrc p15, 0, %0, c1, c0, 1\n"
51 " mcr p15, 0, %0, c1, c0, 1\n"
53 : "Ir" (CR_C
), "Ir" (actrl_mask
)
57 static inline void versatile_immitation_do_lowpower(unsigned int cpu
, int *spurious
)
60 * there is no power-control hardware on this platform, so all
61 * we can do is put the core into WFI; this is safe as the calling
62 * code will have already disabled interrupts.
64 * This code should not be used outside Versatile platforms.
69 if (versatile_cpu_release
== cpu_logical_map(cpu
)) {
71 * OK, proper wakeup, we're done
77 * Getting here, means that we have come out of WFI without
78 * having been woken up - this shouldn't happen
80 * Just note it happening - when we're woken, we can report
88 * platform-specific code to shutdown a CPU.
89 * This code supports immitation-style CPU hotplug for Versatile/Realview/
90 * Versatile Express platforms that are unable to do real CPU hotplug.
92 void versatile_immitation_cpu_die(unsigned int cpu
, unsigned int actrl_mask
)
96 versatile_immitation_enter_lowpower(actrl_mask
);
97 versatile_immitation_do_lowpower(cpu
, &spurious
);
98 versatile_immitation_leave_lowpower(actrl_mask
);
101 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu
, spurious
);