Properly propagate ARCHI_NO_FC to enable boot without the FC.

Core 0 does the initialization as if it was the FC and then
all the cores enter the main with the proper stack initialization.
This commit is contained in:
Luca Valente 2023-03-23 23:14:53 +01:00
parent 1ddf10447c
commit 9e9bffbd50
4 changed files with 46 additions and 6 deletions

View file

@ -126,12 +126,13 @@ int run_suite(testcase_t *tests)
for (i = 0; i < num; i++) {
testresult_t result;
run_benchmark(&tests[i], &result);
if(enable_printf) print_result(&tests[i], &result);
if(enable_printf && (get_core_id()==0))
print_result(&tests[i], &result);
errors += result.errors;
}
print_summary(errors);
if(get_core_id() == 0)
print_summary(errors);
return errors;
}
@ -275,5 +276,9 @@ extern int main(int argc, const char * const argv[]);
int bench_cluster_forward(int cid)
{
#ifdef ARCHI_NO_FC
return 0;
#else
return bench_cluster_exec(cid, main);
#endif
}

View file

@ -47,12 +47,19 @@ void cluster_entry_stub()
{
cluster_core_init();
synch_barrier();
int retval = ((int (*)())cluster_entry)();
synch_barrier();
if (hal_core_id() == 0)
{
cluster_retval = retval;
cluster_running = 0;
#ifdef ARCHI_NO_FC
exit(cluster_retval);
#endif
}
pos_wait_forever();
@ -65,18 +72,22 @@ void cluster_start(int cid, int (*entry)())
cluster_entry = entry;
// Init FLL
#ifndef ARCHI_NO_FC
pos_fll_init(POS_FLL_CL);
#endif
// Initialize cluster L1 memory allocator
alloc_init_l1(cid);
// Activate icache
hal_icache_cluster_enable(cid);
#ifndef ARCHI_NO_FC
if (!hal_is_fc())
{
cluster_core_init();
}
#endif
alloc_init_l1(cid);
@ -87,12 +98,14 @@ void cluster_start(int cid, int (*entry)())
cluster_running = 1;
// Fetch all cores
#ifndef ARCHI_NO_FC
for (int i=0; i<ARCHI_CLUSTER_NB_PE; i++)
{
plp_ctrl_core_bootaddr_set_remote(cid, i, (int)_start);
}
eoc_fetch_enable_remote(cid, (1<<ARCHI_CLUSTER_NB_PE) - 1);
#endif
}

View file

@ -26,6 +26,14 @@ pos_init_entry:
#if defined(ARCHI_HAS_CLUSTER)
csrr a0, 0xF14
andi a1, a0, 0x1f
#ifdef ARCHI_NO_FC
# PEs from 1 to 7 will go to sync_loop and wait. PE0 will reach them
# later after the pos_init_start. Then, they'll set up their stack into
# the L1 and jump to cluster_entry_stub
li t0, 0x10080000
sw x0, 0(t0)
bnez a0, sync_loop
#else
srli a0, a0, 5
#ifdef ARCHI_CL_BOOT
@ -45,7 +53,7 @@ pos_init_entry:
#endif
#endif
# Clear the bss segment
la t0, _bss_start
@ -65,7 +73,14 @@ pos_init_entry:
/* Do all other initializations from C code */
jal x1, pos_init_start
#ifdef ARCHI_NO_FC
csrr a0, 0xF14
andi a1, a0, 0x1f
li t0, 0x10080000
li t1, 0x1
sw t1, 0(t0)
j pe_start
#endif
.section .text
@ -174,3 +189,8 @@ loop:
sw x0, 0(x2)
wfi
j loop
sync_loop:
lw t1, 0(t0)
bnez t1, pe_start
j sync_loop

View file

@ -62,7 +62,9 @@ void pos_init_start()
pos_irq_init();
#ifdef ARCHI_NO_FC
pos_soc_event_init();
#endif
// Initialize first the memory allocators and the utils so that they are
// available for constructors, especially to let them declare