Skip to contentSkip to conversation

vexpress_aemv8a: Add spin table handling with per cpu release addresses

PATCH Superseded Arnab Basu 1 participant 1 message Jan 12, 2015

Subsystems (2)
lore
Share & tools
lore

Arnab Basu

author
#0 lore raw

PATCH v2 4/9 vexpress_aemv8a: Add spin table handling with per cpu release addresses

---
 arch/arm/cpu/armv8/cpu-dt.c       |  16 ++++-
 arch/arm/cpu/armv8/cpu.c          | 113 ++++++++++++++++++++++++++++++
 arch/arm/cpu/armv8/start.S        | 141 +++++++++++++++++++++++++++++---------
 arch/arm/include/asm/armv8/mp.h   |  36 ++++++++++
 arch/arm/include/asm/config.h     |   1 +
 include/configs/vexpress_aemv8a.h |   2 +
 6 files changed, 275 insertions(+), 34 deletions(-)
 create mode 100644 arch/arm/include/asm/armv8/mp.h
arch/arm/cpu/armv8/cpu-dt.c +15 -1
index 8833e6a..ce0e3c6 100644
@@ -7,16 +7,30 @@
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include <asm/armv8/mp.h>
 
 #ifdef CONFIG_MP
+DECLARE_GLOBAL_DATA_PTR;
 
 __weak u64 arch_get_release_addr(u64 cpu_id)
 {
-	return 0;
+	u64 val;
+	u64 spin_table_loc = (u64)get_spin_tbl_addr();
+
+	val = spin_table_loc;
+	val += id_to_core(cpu_id) * SPIN_TABLE_ELEM_SIZE;
+
+	return val;
 }
 
 __weak void arch_spin_table_reserve_mem(void *fdt)
 {
+	size_t *boot_code_size = &(__secondary_boot_code_size);
+	u64 boot_code_loc = ((u64)&secondary_boot_code - gd->relocaddr
+			+ CONFIG_SYS_TEXT_BASE);
+
+	fdt_add_mem_rsv(fdt, (uintptr_t)boot_code_loc,
+			*boot_code_size);
 }
 
 static void cpu_update_dt_spin_table(void *blob)
arch/arm/cpu/armv8/cpu.c +113 -0

119 lines not on this page · raw message

arch/arm/cpu/armv8/start.S +108 -33

166 lines not on this page · raw message

arch/arm/include/asm/armv8/mp.h new file +36 -0
new file mode 100644
index 0000000..77e79cb
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014, Freescale Semiconductor
+ * Copyright 2015, Arnab Basu <[email protected]>
+ * (modified version of arch/arm/cpu/armv8/fsl-lsch3/mp.h)
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ARMV8_MP_H
+#define _ARMV8_MP_H
+
+/*
+* Each spin table element is defined as
+* struct {
+*      uint64_t entry_addr;
+*      uint64_t status;
+*      uint64_t lpid;
+* };
+* we pad this struct to 64 bytes so each entry is in its own cacheline
+* the actual spin table is an array of these structures
+*/
+#define SPIN_TABLE_ELEM_ENTRY_ADDR_IDX	0
+#define SPIN_TABLE_ELEM_STATUS_IDX	1
+#define SPIN_TABLE_ELEM_LPID_IDX	2
+#define WORDS_PER_SPIN_TABLE_ENTRY	8	/* pad to 64 bytes */
+#define SPIN_TABLE_ELEM_SIZE		64
+
+#define id_to_core(x)	((x & 3) | (x >> 6))
+#ifndef __ASSEMBLY__
+extern u64 __spin_table[];
+extern phys_addr_t secondary_boot_code;
+extern size_t __secondary_boot_code_size;
+void *get_spin_tbl_addr(void);
+void secondary_boot_func(void);
+#endif
+#endif /* _ARMV8_MP_H */
arch/arm/include/asm/config.h +1 -0
index be80434..97544fb 100644
@@ -15,6 +15,7 @@
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #ifdef CONFIG_ARM64
+#define CONFIG_MP
 #define CONFIG_PHYS_64BIT
 #define CONFIG_STATIC_RELA
 #endif
include/configs/vexpress_aemv8a.h +2 -0
index 027d78b..9c4f06b 100644
@@ -8,6 +8,8 @@
 #ifndef __VEXPRESS_AEMV8A_H
 #define __VEXPRESS_AEMV8A_H
 
+#define CONFIG_MAX_CPUS 4
+
 /* We use generic board for v8 Versatile Express */
 #define CONFIG_SYS_GENERIC_BOARD
 
Signature · 1 line
1.9.1