Commit graph

41 commits

Author SHA1 Message Date
Hector Martin
5eed8f674d hv_vm: Fix guest SError handling
This was broken, but somewhat masked by another bug in hv_vm.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 22:17:52 +09:00
Hector Martin
4f92a77efd exception: Allow guarding SError exceptions
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
098d394a5c exception: Handle Fast IPIs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:33:23 +09:00
Hector Martin
ffacef41ee iodev, exception: Remove gratuitous UART usage
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-19 22:33:20 +09:00
Hector Martin
c93f856c92 exception: Only enable IRQs on the primary core
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:28:43 +09:00
Hector Martin
920ff59483 exception: Unbork EL1 stack
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 21:14:58 +09:00
Hector Martin
3e1ea2d503 memory: Add separate mappings for EL0 data access
This unborks stack and constant pool accesses from el0_call.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 17:36:02 +09:00
Sven Peter
1c604a77c5 gxf: add support for guarded exception levels
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-11 15:48:40 +09:00
Hector Martin
0e987f031b utils: Add flush_and_reboot() to do the iodev flush dance
Use this for exceptions, asserts, etc.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 03:21:48 +09:00
Hector Martin
d35fa5e0fc iodev: Add iodev_console_kick()
This is used prior to rebooting in exception handlers, to make sure all
the exception dump data gets sent to USB if we are connected via that.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 00:28:39 +09:00
Hector Martin
45a0054f63 Add build-time printf() argument checking and fix warnings
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 18:23:44 +09:00
Hector Martin
882610b50e cpu_regs.h: s/SYS_APL/SYS_IMP_APL/ to match Linux
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-29 15:45:44 +09:00
Hector Martin
9fc3f0c230 exception: Print exception context for FIQ
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-14 17:48:02 +09:00
Hector Martin
0df6db324b timer_test.py: More exhaustive tests
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-14 17:48:02 +09:00
Hector Martin
efa4452a47 Fix libc header dependencies
Turns out we had a bunch of silly dependencies on libc headers that are
not included with freestanding compilers. Fix all this and change the
CFLAGS to exclude libc headers and only include the built-in compiler
path.

Add our own versions of assert.h, errno.h, limits.h, and move malloc.h
and string.h together into a new path used as -isystem, so these headers
can be included using #include <>.

Remove a bunch of other dependencies in third-party code.

Add a strnlen function.

Disable building the libfdt overlay code for now, as it needs a strtoul
implementation. We can throw that in if/when we decide to use overlays.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-03-08 01:31:14 +09:00
Hector Martin
b8349819fe Implement calling code as EL1
This works by clearing HCR_EL2.TGE, and then doing essentially the same
thunk/return dance as for EL0 calls. However, since most EL1 exceptions
are not routed to EL2, we install hypercall vectors in EL1 to forward
them to EL2, and then short circuit the exception return to whatever
triggered the original exception.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-03-04 22:10:37 +09:00
Hector Martin
16cff51bd4 exception,memory: s/EL2/EL1/
Since we're in VHE mode, we can pretend to be in EL1 - but this will
allow us to really run in EL1 if we want to in the future.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-03-04 20:31:36 +09:00
Hector Martin
4282cd0578 exception: size tables properly, work around overeager clang-format
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-03-04 19:52:53 +09:00
Hector Martin
3872b1a7da exception: implement el0_call to run code as EL0
This lets us test register access and other features from EL0.

No serious attempt at security is made, but at least EL0 runs off of a
separate stack and can return to EL2 at any time with `brk`; we can
easily implement a guard mode to break straight to EL2 on exception
later if needed.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-24 21:48:12 +09:00
Hector Martin
b5cbf7360e exception: handle PMC FIQs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-18 17:55:55 +09:00
Hector Martin
86a7d9c0f3 cpu_regs.h: s/SYS_/SYS_APL_/
This synchronizes the register naming convention with Linux

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-18 17:55:55 +09:00
Hector Martin
d46d51d7ed exception: fix vtimer FIQ masking
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-11 01:35:23 +09:00
Hector Martin
063b9a1d27 exception: Add GUARD_SILENT feature to suppress logs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-11 00:55:59 +09:00
Hector Martin
0cd328214c exception: handle all 4 available timer FIQs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +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
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
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
344c84da17 clang-format everything
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-28 16:06:12 +09:00
Ariel Machado
51bf5c870a adt: replaces int to u32 and size_t for unsigned values.
Makefile: increases compiler warnings

Signed-off-by: Ariel Machado <ariel@fe.up.pt>
2021-01-25 19:18:30 +09:00
Hector Martin
674a82a2bb aic_test: UART IRQ testing stuff
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-23 22:42:59 +09:00
Ferdinand Bachmann
afc5813635 exceptions: fix clang warning for msr arg
Signed-off-by: Ferdinand Bachmann <theferdi265@gmail.com>
2021-01-23 22:09:22 +09:00
Hector Martin
31b6af14b2 exception.c: fix sp calculation in print_regs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-18 01:57:27 +09:00
Hector Martin
81aaf2ed35 Basic exceptions, irq, cache mgmt support
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-17 00:49:22 +09:00