[coreboot-gerrit] New patch to review for coreboot: 0508ee7 arm64: implement cpu_info() correctly

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Mar 26 10:48:26 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9009

-gerrit

commit 0508ee7b37b2daa8869a358f65e31f670f99258d
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Wed Aug 27 10:30:39 2014 -0500

    arm64: implement cpu_info() correctly
    
    There are 2 things wrong with the current implementation:
    1. the stack isn't guaranteed to be aligned to CONFIG_STACK_SIZE.
    2. the stack isn't necessarily CONFIG_STACK_SIZE bytes.
    
    Utilize the smp_processor_id() function to obtain the correct
    cpu_info structure to obtain the correct index.
    
    BUG=chrome-os-partner:31545
    BRANC=None
    TEST=Built and booted.
    
    Change-Id: I43d4a2baa26e48147bc0dbdb3e9e13ad023f0690
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: e2c32b1a46ac8dc1364ed03c195322c0bf28dd7f
    Original-Change-Id: I2825118e2313dbbf13712a4afdfa05a2e38ee3a4
    Original-Signed-off-by: Aaron Durbin <adurbin at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/214665
    Original-Reviewed-by: Furquan Shaikh <furquan at chromium.org>
---
 src/arch/arm64/cpu.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/arch/arm64/cpu.c b/src/arch/arm64/cpu.c
index f90c759..e3bc19d 100644
--- a/src/arch/arm64/cpu.c
+++ b/src/arch/arm64/cpu.c
@@ -30,13 +30,9 @@
 #include <stdlib.h>
 #include <arch/cpu.h>
 
-/* Return the cpu struct which is at the high memory address of the stack.
- */
+static struct cpu_info cpu_infos[CONFIG_MAX_CPUS];
+
 struct cpu_info *cpu_info(void)
 {
-	uintptr_t addr = ALIGN((uintptr_t)__builtin_frame_address(0),
-		CONFIG_STACK_SIZE);
-	addr -= sizeof(struct cpu_info);
-	return (void *)addr;
+	return &cpu_infos[smp_processor_id()];
 }
-



More information about the coreboot-gerrit mailing list