Arch: Arm: SMP: Boot & Voting Refactor
Support booting from any usable core in systems with partially fused-off CPUs. Update get_cpu_logic_id to iterate over the actual number of enabled CPUs using DT_CHILD_NUM_STATUS_OKAY(DT_PATH(cpus)) instead of CONFIG_MP_MAX_NUM_CPUS. Resize the voting[] array based on DT_CHILD_NUM_STATUS_OKAY to ensure each CPU can vote correctly. Signed-off-by: urvashi sharma <urvashis@qti.qualcomm.com>
This commit is contained in:
parent
69c14e37ac
commit
9cef24bc62
3 changed files with 7 additions and 4 deletions
|
@ -25,7 +25,7 @@
|
||||||
* Get CPU logic id by looking up cpu_node_list
|
* Get CPU logic id by looking up cpu_node_list
|
||||||
* returns
|
* returns
|
||||||
* xreg0: MPID
|
* xreg0: MPID
|
||||||
* xreg1: logic id (0 ~ CONFIG_MP_MAX_NUM_CPUS - 1)
|
* xreg1: logic id (0 ~ DT_CHILD_NUM_STATUS_OKAY(DT_PATH(cpus)) - 1)
|
||||||
* clobbers: xreg0, xreg1, xreg2, xreg3
|
* clobbers: xreg0, xreg1, xreg2, xreg3
|
||||||
*/
|
*/
|
||||||
.macro get_cpu_logic_id xreg0, xreg1, xreg2, xreg3
|
.macro get_cpu_logic_id xreg0, xreg1, xreg2, xreg3
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
cmp \xreg2, \xreg0
|
cmp \xreg2, \xreg0
|
||||||
beq 2f
|
beq 2f
|
||||||
add \xreg1, \xreg1, 1
|
add \xreg1, \xreg1, 1
|
||||||
cmp \xreg1, #CONFIG_MP_MAX_NUM_CPUS
|
cmp \xreg1, #DT_CHILD_NUM_STATUS_OKAY(DT_PATH(cpus))
|
||||||
bne 1b
|
bne 1b
|
||||||
b .
|
b .
|
||||||
2:
|
2:
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <zephyr/linker/sections.h>
|
#include <zephyr/linker/sections.h>
|
||||||
#include <zephyr/arch/cpu.h>
|
#include <zephyr/arch/cpu.h>
|
||||||
#include <zephyr/offsets.h>
|
#include <zephyr/offsets.h>
|
||||||
|
#include <zephyr/devicetree.h>
|
||||||
#include "boot.h"
|
#include "boot.h"
|
||||||
#include "macro_priv.inc"
|
#include "macro_priv.inc"
|
||||||
|
|
||||||
|
@ -163,7 +164,7 @@ resetwait:
|
||||||
/* wait */
|
/* wait */
|
||||||
bne 2b
|
bne 2b
|
||||||
add x5, x5, #1
|
add x5, x5, #1
|
||||||
cmp x5, #CONFIG_MP_MAX_NUM_CPUS
|
cmp x5, #DT_CHILD_NUM_STATUS_OKAY(DT_PATH(cpus))
|
||||||
bne 2b
|
bne 2b
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
struct boot_params {
|
struct boot_params {
|
||||||
uint64_t mpid;
|
uint64_t mpid;
|
||||||
char *sp;
|
char *sp;
|
||||||
uint8_t voting[CONFIG_MP_MAX_NUM_CPUS];
|
uint8_t voting[DT_CHILD_NUM_STATUS_OKAY(DT_PATH(cpus))];
|
||||||
arch_cpustart_t fn;
|
arch_cpustart_t fn;
|
||||||
void *arg;
|
void *arg;
|
||||||
int cpu_num;
|
int cpu_num;
|
||||||
|
@ -56,6 +56,8 @@ const uint64_t cpu_node_list[] = {
|
||||||
DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_PATH(cpus), DT_REG_ADDR, (,))
|
DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_PATH(cpus), DT_REG_ADDR, (,))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BUILD_ASSERT(ARRAY_SIZE(cpu_node_list) == DT_CHILD_NUM_STATUS_OKAY(DT_PATH(cpus)));
|
||||||
|
|
||||||
/* cpu_map saves the maping of core id and mpid */
|
/* cpu_map saves the maping of core id and mpid */
|
||||||
static uint64_t cpu_map[CONFIG_MP_MAX_NUM_CPUS] = {
|
static uint64_t cpu_map[CONFIG_MP_MAX_NUM_CPUS] = {
|
||||||
[0 ... (CONFIG_MP_MAX_NUM_CPUS - 1)] = INV_MPID
|
[0 ... (CONFIG_MP_MAX_NUM_CPUS - 1)] = INV_MPID
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue