diff options
author | Furquan Shaikh <furquan@google.com> | 2014-11-21 15:42:40 -0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-10 20:47:44 +0200 |
commit | 9482498003d500db6aced4c94bf4ab3485cab18e (patch) | |
tree | e2c2ec3cc22f6893d772da62782b3795245c101a /src/arch/arm64/armv8/secmon | |
parent | b17f580d2955822d0095e1fb914d98eeabf2a708 (diff) |
arm64: Add support for save/restore registers for CPU startup.
startup.c provides function to enable CPU in any stage to save register data
that can be used by secondary CPU (for normal boot) or any CPU (for resume
boot). stage_entry.S defines space for saving arm64_startup_data. This can be
filled by:
1) Primary CPU before bringing up secondary CPUs so that the secondary can use
register values to initialize MMU-related and other required registers to
appropriate values.
2) CPU suspend path to ensure that on resume the values which were saved are
restored appropriately.
stage_entry.S provides a common path for both normal and resume boot to
initialize saved registers. For resume path, it is important to set the
secondary entry point for startup since x26 needs to be 1 for enabling MMU and
cache.
This also ensures that we do not fall into false memory cache errors which
caused CPU to fail during normal / resume boot. Thus, we can get rid of the
stack cache invalidate for secondary CPUs.
BUG=chrome-os-partner:33962
BRANCH=None
TEST=Compiles and boots both CPU0 and CPU1 on ryu without mmu_enable and stack
cache invalidate for CPU1.
Change-Id: Ia4ca0e7d35c0738dbbaa926cce4268143c6f9de3
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 9f5e78469313ddd144ad7cf5abc3e07cb712183a
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Change-Id: I527a95779cf3fed37392b6605b096f54f8286d64
Original-Reviewed-on: https://chromium-review.googlesource.com/231561
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Tested-by: Furquan Shaikh <furquan@chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/9540
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/arch/arm64/armv8/secmon')
-rw-r--r-- | src/arch/arm64/armv8/secmon/secmon_init.c | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/src/arch/arm64/armv8/secmon/secmon_init.c b/src/arch/arm64/armv8/secmon/secmon_init.c index 63bd4907d9..7d7f8bb811 100644 --- a/src/arch/arm64/armv8/secmon/secmon_init.c +++ b/src/arch/arm64/armv8/secmon/secmon_init.c @@ -27,20 +27,11 @@ #include <arch/psci.h> #include <arch/secmon.h> #include <arch/smc.h> +#include <arch/startup.h> #include <console/console.h> #include <stddef.h> #include "secmon.h" -/* Common CPU state for all CPUs running in secmon. */ -struct cpu_resume_data { - uint64_t mair; - uint64_t tcr; - uint64_t ttbr0; - uint64_t scr; -}; - -static struct cpu_resume_data resume_data; - static void secmon_init(struct secmon_params *params, int bsp); static void secmon_init_bsp(void *arg) @@ -61,27 +52,6 @@ void (*c_entry[2])(void *) = { &secmon_init_bsp, &secmon_init_nonbsp }; static void cpu_resume(void *unused) { - uint32_t sctlr; - - /* Re-enable exception vector. */ - exception_hwinit(); - - tlbiall_el3(); - raw_write_mair_el3(resume_data.mair); - raw_write_tcr_el3(resume_data.tcr); - raw_write_ttbr0_el3(resume_data.ttbr0); - dsb(); - isb(); - - /* Enable MMU */ - sctlr = raw_read_sctlr_el3(); - sctlr |= SCTLR_C | SCTLR_M | SCTLR_I; - raw_write_sctlr_el3(sctlr); - isb(); - - raw_write_scr_el3(resume_data.scr); - isb(); - psci_cpu_entry(); } @@ -92,11 +62,7 @@ static void cpu_resume_init(void) dcache_clean_by_mva(&c_entry, sizeof(c_entry)); /* Back up state. */ - resume_data.mair = raw_read_mair_el3(); - resume_data.tcr = raw_read_tcr_el3(); - resume_data.ttbr0 = raw_read_ttbr0_el3(); - resume_data.scr = raw_read_scr_el3(); - dcache_clean_by_mva(&resume_data, sizeof(resume_data)); + startup_save_cpu_data(); } static void start_up_cpu(void *arg) @@ -150,7 +116,7 @@ static void secmon_init(struct secmon_params *params, int bsp) wait_for_all_cpus(params->online_cpus); smc_init(); - psci_init((uintptr_t)arm64_cpu_startup); + psci_init((uintptr_t)arm64_cpu_startup_resume); /* Initialize the resume path. */ cpu_resume_init(); |