From b777f3e3d1cb4265f1a4bf392781b93bd0c37eea Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Tue, 28 Oct 2014 15:38:17 -0500 Subject: arm64: psci: add node hierarchy In order to properly support more arm64 SoCs PSCI needs to handle the hierarchy of cpus/clusters within the SoC. The nodes within PSCI are kept in a tree as well as a depth-first ordered array of same tree. Additionally, the PSCI states are now maintained in a hierachal manner. OFF propogates up the tree as long as all siblings are set to OFF. ON propogates up the tree until a node is not already set to OFF. The SoC provides the operations for determining how many children are at a given affinity level. Lastly, the secmon startup has been reworked in that all non-BSP CPUs wait for instructions from the BSP. BUG=chrome-os-partner:32136 BRANCH=None TEST=Can still boot into kernel with SMP. Change-Id: I036fabaf0f1cefa2841264c47e4092c75a2ff4dc Signed-off-by: Patrick Georgi Original-Commit-Id: 721d408cd110e1b56d38789177b740aa0e54ca33 Original-Change-Id: I520a9726e283bee7edcb514cda28ec1eb31b5ea0 Original-Signed-off-by: Aaron Durbin Original-Reviewed-on: https://chromium-review.googlesource.com/226480 Original-Reviewed-by: Furquan Shaikh Reviewed-on: http://review.coreboot.org/9390 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/arch/arm64/armv8/secmon/secmon_init.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'src/arch/arm64/armv8/secmon/secmon_init.c') diff --git a/src/arch/arm64/armv8/secmon/secmon_init.c b/src/arch/arm64/armv8/secmon/secmon_init.c index 56ed4f14bc..9097a08b36 100644 --- a/src/arch/arm64/armv8/secmon/secmon_init.c +++ b/src/arch/arm64/armv8/secmon/secmon_init.c @@ -30,6 +30,18 @@ #include #include "secmon.h" +/* Save initial secmon params per CPU to handle turn up. */ +static struct secmon_params *init_params[CONFIG_MAX_CPUS]; + +static void start_up_cpu(void *arg) +{ + struct secmon_params *params = init_params[cpu_info()->id]; + + if (params == NULL) + psci_turn_off_self(); + psci_turn_on_self(params->entry, params->arg); +} + static void cpu_init(int bsp) { struct cpu_info *ci = cpu_info(); @@ -43,17 +55,26 @@ static void cpu_init(int bsp) static void secmon_init(struct secmon_params *params, int bsp) { + struct cpu_action action = { + .run = start_up_cpu, + }; + exception_hwinit(); cpu_init(bsp); + init_params[cpu_info()->id] = params; + + if (!cpu_is_bsp()) + secmon_wait_for_action(); + smc_init(); psci_init(); - /* Turn on CPU if params are not NULL. */ - if (params != NULL) - psci_turn_on_self(params->entry, params->arg); + arch_run_on_all_cpus_async(&action); - secmon_wait_for_action(); + printk(BIOS_ERR, "CPU turn on failed for BSP.\n"); + while (1) + ; } void secmon_wait_for_action(void) -- cgit v1.2.3