summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/cpu/cpu.c5
-rw-r--r--arch/x86/cpu/mp_init.c16
-rw-r--r--arch/x86/include/asm/mp.h17
3 files changed, 38 insertions, 0 deletions
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index c343586e04..69c14189d1 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -67,6 +67,11 @@ static const char *const x86_vendor_name[] = {
int __weak x86_cleanup_before_linux(void)
{
+ int ret;
+
+ ret = mp_park_aps();
+ if (ret)
+ return log_msg_ret("park", ret);
bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
CONFIG_BOOTSTAGE_STASH_SIZE);
diff --git a/arch/x86/cpu/mp_init.c b/arch/x86/cpu/mp_init.c
index dd6d6bfab7..427ec8fc23 100644
--- a/arch/x86/cpu/mp_init.c
+++ b/arch/x86/cpu/mp_init.c
@@ -668,6 +668,22 @@ int mp_run_on_cpus(int cpu_select, mp_run_func func, void *arg)
return 0;
}
+static void park_this_cpu(void *unused)
+{
+ stop_this_cpu();
+}
+
+int mp_park_aps(void)
+{
+ int ret;
+
+ ret = mp_run_on_cpus(MP_SELECT_APS, park_this_cpu, NULL);
+ if (ret)
+ return log_ret(ret);
+
+ return 0;
+}
+
int mp_init(void)
{
int num_aps, num_cpus;
diff --git a/arch/x86/include/asm/mp.h b/arch/x86/include/asm/mp.h
index eb49e690f2..f9d6c8e6bf 100644
--- a/arch/x86/include/asm/mp.h
+++ b/arch/x86/include/asm/mp.h
@@ -109,6 +109,15 @@ typedef void (*mp_run_func)(void *arg);
* @return 0 on success, -ve on error
*/
int mp_run_on_cpus(int cpu_select, mp_run_func func, void *arg);
+
+/**
+ * mp_park_aps() - Park the APs ready for the OS
+ *
+ * This halts all CPUs except the main one, ready for the OS to use them
+ *
+ * @return 0 if OK, -ve on error
+ */
+int mp_park_aps(void);
#else
static inline int mp_run_on_cpus(int cpu_select, mp_run_func func, void *arg)
{
@@ -117,6 +126,14 @@ static inline int mp_run_on_cpus(int cpu_select, mp_run_func func, void *arg)
return 0;
}
+
+static inline int mp_park_aps(void)
+{
+ /* No APs to park */
+
+ return 0;
+}
+
#endif
#endif /* _X86_MP_H_ */