Commit graph

114 commits

Author SHA1 Message Date
Janne Grunau
128368751c linux.py: use argparse and pathlib
Signed-off-by: Janne Grunau <j@jannau.net>
2021-02-06 12:16:04 +09:00
liv
9019ccf4ab readme: Fix typo
Signed-off-by: lv <~@l1v.in>
2021-02-06 12:14:40 +09:00
Ariel Machado
476182e1f8 utils.h: Fix 'asm-operand-widths' warnings with clang
Signed-off-by: Ariel Machado <ariel@fe.up.pt>
2021-02-06 12:13:29 +09:00
Witold Baryluk
62db38ae91 Fix #! and exec bits for scripts
Signed-off-by: Witold Baryluk <witold.baryluk@gmail.com>
2021-02-06 12:01:15 +09:00
Hector Martin
8691fcee8a kboot: fix fb debug print
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 03:49:20 +09:00
Hector Martin
5970824491 utils.py: add more ID registers
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
19f915b779 aic_test.py: more experiments
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
60665a2ee2 linux.py: spin up secondaries
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
234a511e35 kboot: add spin-table and SMP support
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
aaab2c6ca1 chickens: set WFI mode to clockgate only
This preserves CPU registers.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
64e6595f64 dts update for new kernel
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
e35ef6eb8c smp: fix IRQs on secondary CPUs
Seems one of the registers is some kind of system-level CPU spinup flag,
without which the CPU runs but the rest of the system thinks it's still
dead.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
cb7e7f7918 exception.c: print MPIDR with IRQs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Iris Johnson
7fc52bc799 Fix broken hexdumps in proxy.py
Proxy.py has a few typos that appear if you try to use debug mode and dump a region of memory. This should fix those.

Signed-off-by: Iris Johnson <iris@modwiz.com>
2021-02-05 02:57:36 +09:00
Hector Martin
4c999733da setup.py: restore timeout properly after the baudrate guesswork
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-03 04:52:17 +09:00
Hector Martin
053f2edbc3 proxyclient: handle baud rate switching properly for non-Glasgow UARTs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-03 03:51:41 +09:00
Hector Martin
96d133e854 mmu: map device memory as non-executable
This fixes the random SErrors after returning from a page fault. Turns
out the M1 was randomly deciding to speculate an instruction fetch from
address 0, triggering a fabric error.

Quoting the ARM ARM:

"Hardware does not prevent speculative instruction fetches from a memory
location with any of the Device memory attributes unless the memory
location is also marked as Execute-never for all Exception levels.

This means that to prevent speculative instruction fetches from memory
locations with Device memory attributes, any location that is assigned
any Device memory type must also be marked as execute-never for all
Exception levels. Failure to mark a memory location with any Device
memory attribute as execute-never for all Exception levels is a
programming error."

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-31 13:42:48 +09:00
Hector Martin
b65e2ca0e4 mmu: also set up high-VA translation
Just an alias

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
f247643fe6 chainload.py: shut down mmu and flush caches when chainloading
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
2d5fb878f8 Makefile: build for armv8.2-a
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
b2ef461114 get rid of another warning pragma
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
919e3fb64a exception: use 64bit print types
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
65c0632ae7 exception: do not reboot on SError
This may or may not go well depending on the problem... but let's see
what happens.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
201d7d9a1e exception: also print FAR_EL2
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
040cb9d6fd exception: enable SError
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
bbe47b2f75 Move Apple ARM register definitions to cpu_regs.h
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
7807dad7bc exception: add barriers around stuff
This CPU really likes to speculate...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
1f99c17fef exception: clear L2C error status after exception
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
5dd63e41a1 exception: decode exception type on dumps
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
6dde40b05c exception: introduce recovery from synchronous exceptions
Use this to recover from address faults in the proxy. Also print out L2
subsystem fault info.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
d31eab5f87 chickens: do not disable L2 subsystem errors
These mean real problems, let's actually fix them instead of shoving
them under the carpet.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
4167a18a64 utils: move sys_reg and is_ecore() to utils.h
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
2df212bf5c adt: use ADT_FOREACH macros internally
This fixes some bugs too.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 03:15:00 +09:00
Hector Martin
dc2b7b3bb4 startup: clear bss section
iBoot does this for us, but this is for the benefit of chainload.py and
other dump loaders that may not.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 03:03:03 +09:00
Hector Martin
b673db78c3 minilzlib/xzstream.h: get rid of warning pragma
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 03:03:03 +09:00
Hector Martin
74307af0df kboot: add proper kernel boot & DT manipulation code
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
33d6c311ad malloc.py: fix memalign
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
352c6945d1 chickens.py: fix some brokenness
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
ad93d14ee5 chickens: clear SYS_L2C_ERR_STS
It's unclear why this is necessary, but it fixes some strange crashes

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
c057775ab9 adt: add ADT_FOREACH_PROPERTY
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
891bc5592e utils.h: fix msr/mrs macro expansion
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
46a46da111 string: add memmove, strrchr, strncmp
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
b82c0072e7 utils.h: mark reboot() noreturn
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
d280157289 libfdt: actually add libfdt
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
986c6730e9 Add heapblock and dlmalloc for managing memory
heapblock is a simple `sbrk` style implementation, also useful as an
"endless" decompression buffer. dlmalloc is used on top as a malloc
implementation.

This also changes how the Python side manages its heap. We still use a
python-side malloc implementation (since this is faster), and we put the
Python heap at the m1n1 heap + 128MB, without allocating it.
Hopefully this should never step on anything m1n1 neads, and avoids
having to manage freeing across Python script calls.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-29 16:25:15 +09:00
Hector Martin
f3d0a58f42 proxy: add mmu_shutdown call, use it for linux.py
I saw at least one SError crash on Linux after doing this, but can't
repro; unclear if related to the MMU changes or not...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-29 00:36:46 +09:00
Hector Martin
c3c6e4e8f9 smp: add scaffolding and proxy funcs for cross-CPU calls
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-29 00:36:46 +09:00
Hector Martin
e97b104125 main: do not spin up SMP
This breaks reloads, we shouldn't do this until we need to.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-28 23:48:35 +09:00
Hector Martin
eae3d06e85 smp: fix totally broken stack setup
This worked by accident before...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-28 23:48:35 +09:00
Hector Martin
11753f9983 start.S: probe the stack after init
This makes it obvious when the stack is broken.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-28 23:48:35 +09:00