Skip to content

Commit ba9ed10

Browse files
Merge pull request #205 from smartobjectoriented/200-so3-boot-is-blocking-on-rpi4-64bits
200 so3 boot is blocking on rpi4 64bits
2 parents 5044652 + 652e450 commit ba9ed10

File tree

7 files changed

+33
-10
lines changed

7 files changed

+33
-10
lines changed

so3/arch/arm64/exception.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ ENTRY(pre_ret_to_el1_with_spin)
226226
// Set the CPU in EL1 mode to proceed with
227227
// the bootstrap of the domain
228228

229-
mov x2, #PSR_MODE_EL1t
229+
mov x2, #PSR_MODE_EL1h
230230

231231
// Make sure no interrupt coming from CPU #0 is
232232
// interferring with other CPU bootstrap
@@ -271,7 +271,7 @@ ENTRY(pre_ret_to_el1)
271271
// Set the CPU in EL1 mode to proceed with
272272
// the bootstrap of the domain
273273

274-
mov x2, #PSR_MODE_EL1t
274+
mov x2, #PSR_MODE_EL1h
275275

276276
// Make sure no interrupt coming from CPU #0 is
277277
// interferring with other CPU bootstrap

so3/arch/arm64/head.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ install_el2_stub:
424424
msr vbar_el2, x0
425425

426426
/* spsr */
427-
mov x0, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT | PSR_MODE_EL1t)
427+
mov x0, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT | PSR_MODE_EL1h)
428428
msr spsr_el2, x0
429429
msr elr_el2, lr
430430
mov w0, #BOOT_CPU_MODE_EL2 // This CPU booted in EL2

so3/arch/arm64/mmu.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@
2222
#include <sizes.h>
2323
#include <string.h>
2424
#include <process.h>
25-
#include <log.h>
2625

2726
#include <device/ramdev.h>
2827
#include <device/fdt.h>
2928

3029
#include <asm/mmu.h>
3130
#include <asm/cacheflush.h>
3231

32+
#undef LOG_DEBUG
33+
#define LOG_DEBUG(fmt, ...)
34+
3335
void *__current_pgtable = NULL;
3436

3537
void *current_pgtable(void)
@@ -603,6 +605,7 @@ void reset_root_pgtable(void *pgtable, bool remove)
603605
*/
604606
void mmu_configure(addr_t fdt_addr)
605607
{
608+
/* clang-format off */
606609
int i;
607610

608611
icache_disable();
@@ -691,6 +694,8 @@ void mmu_configure(addr_t fdt_addr)
691694

692695
icache_enable();
693696
dcache_enable();
697+
698+
/* clang-format on */
694699
}
695700

696701
/*

so3/arch/arm64/traps.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ typedef void (*vector_fn_t)(cpu_regs_t *);
117117

118118
void trap_handle(cpu_regs_t *regs)
119119
{
120+
int ret = 0;
121+
120122
#ifndef CONFIG_AVZ
121123
syscall_args_t sys_args;
122124
#endif
@@ -140,7 +142,9 @@ void trap_handle(cpu_regs_t *regs)
140142
switch (ESR_ELx_EC(esr)) {
141143
case ESR_ELx_EC_DABT_LOW:
142144

143-
dabt_handle(regs, esr);
145+
ret = dabt_handle(regs, esr);
146+
if (ret == -1)
147+
goto __err;
144148
break;
145149

146150
/* SVC used for syscalls */
@@ -246,6 +250,7 @@ void trap_handle(cpu_regs_t *regs)
246250
#endif
247251

248252
default:
253+
__err:
249254
lprintk("### On CPU %d: ESR_Elx_EC(esr): 0x%lx\n", smp_processor_id(), ESR_ELx_EC(esr));
250255
trap_handle_error(regs->lr);
251256
kernel_panic();

so3/kernel/schedule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ void schedule(void)
444444
LOG_DEBUG("Now scheduling thread ID: %d name: %s PID: %d prio: %d\n", next->tid, next->name,
445445
((next->pcb != NULL) ? next->pcb->pid : -1), next->prio);
446446
if (prev)
447-
LOG_DEBUG("Previous was threadID: %d name: %s PID: %d\n", prev->tid, prev->name);
447+
LOG_DEBUG("Previous was threadID: %d name: %s PID: %d\n", prev->tid, prev->name,
448+
(next->pcb != NULL) ? next->pcb->pid : -1);
448449

449450
/*
450451
* The current threads (here prev) can be in different states, not only running; it may be in *waiting* or *zombie*

so3/mm/memory.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ static uint32_t kernel_size;
5454
/* Current available I/O range address */
5555
struct list_head io_maplist;
5656

57+
/**
58+
* @brief This function is called early during the bootstrap by head.S
59+
* There is no MMU activated and all adresses are physical.
60+
* DO NOT PRINT ANYTHING IN THIS FUNCTION.
61+
*
62+
* @param fdt_paddr
63+
*/
5764
void early_memory_init(void *fdt_paddr)
5865
{
5966
int offset;
@@ -64,9 +71,6 @@ void early_memory_init(void *fdt_paddr)
6471
#ifndef CONFIG_AVZ
6572
__fdt_addr = (void *) __va(fdt_paddr);
6673
#endif
67-
68-
if (offset >= 0)
69-
LOG_DEBUG("Found %d MB of RAM at 0x%08X", mem_info.size / SZ_1M, mem_info.phys_base);
7074
}
7175

7276
uint32_t get_kernel_size(void)

usr/lib/libc/exit/exit.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,16 @@ weak_alias(libc_exit_fini, __libc_exit_fini);
2727

2828
_Noreturn void exit(int code)
2929
{
30+
#warning exit() issue
31+
/*
32+
* Currently, the following code leads to data abort fault randomly. The effect
33+
* is visible on RPi4 (64-bit) more rarely on virt64
34+
*/
35+
#if 0
3036
__funcs_on_exit();
31-
__libc_exit_fini();
37+
__libc_exit_fini();
3238
__stdio_exit();
39+
#endif /* 0 */
40+
3341
_Exit(code);
3442
}

0 commit comments

Comments
 (0)