Commit graph

4019 commits

Author SHA1 Message Date
Axel Heider
1ac1ac9f8d remove unused define KERNEL_ELF_PADDR_TOP
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-17 11:29:36 +11:00
Axel Heider
e542a2a0ea add missing include and improve comments
- Since uint32_t and uint64_t are used, stdint.h needs to be included.
- Improve comments about GCC/LLVM internals.

Co-authored-by: Matthew Brecknell <matthew@brecknell.net>
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-17 11:15:53 +11:00
Axel Heider
afc27201d6 boot: add more error messages
Print detailed error messages to make porting and debugging easier.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-16 18:52:12 +11:00
Axel Heider
e75d22bedd python: align imports
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Axel Heider
88be9c1f7c python: add helper functions
Separate parameter collection from the actual file creation.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Axel Heider
42736a335f python: avoid name conflicts with module name
Also cleanup/align variable naming.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Axel Heider
f4e38b1e5b python: make Region parameter owner optional
Also ensure the description is created correctly.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Axel Heider
a16ec5ef7f python: add type information
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Axel Heider
a0c5020789 python: trivial script cleanup
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Axel Heider
d31019ff0a python: cleanup devices_gen.h template
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Axel Heider
bac15924ad python: clarify includes in devices_gen.h template
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Axel Heider
94963c7bec python: update creator info comment
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-11-14 11:44:00 +11:00
Juan Pablo Ruiz
4be2b2e4ef qemu-arm-virt: fix in cmake for STRIP
Check if QEMU_OUTPUT_MESSAGE is empty before the STRIP
If no error in the previous qemu test command, the output
message is empty (QEMU_OUTPUT_MESSAGE), then the STRIP
will fail on empty input. Then, if it is empty do not
run STRIP.

Signed-off-by: Juan Pablo Ruiz <juanpablo@ssrc.tii.ae>
2021-11-11 10:20:26 +11:00
Indan Zupancic
a6c29549fc budget >= MIN_BUDGET
Signed-off-by: Indan Zupancic <Indan.Zupancic@mep-info.com>
2021-11-03 17:11:55 +11:00
Indan Zupancic
307908347e Custom DTS overlay file support
Add KernelCustomDTSOverlay option to append user provided DTS overlay
files. This way users do not need to modify the seL4 kernel sources
just because they use a hardware module differently. Also useful for
defining VM memory regions.

Signed-off-by: Indan Zupancic <Indan.Zupancic@mep-info.com>
2021-11-03 16:04:36 +11:00
Luca (Wei) Chen
e9bdd85e81 allwinnerA20: switch to the ARM generic timer
The memory mapping for the timer only uses 1K on AllwinnerA20, but
the minimum device mapping is 4K in seL4. Other devices within this
4K page (CCU and PIO) cannot be accessed in the userland.
Replace the kernel timer with the ARM generic timer on AllwinnerA20,
and remove the implementation for AllwinnerA20 specific timer in the
kernel. So we should have user access to those devices now.

Signed-off-by: Luca (Wei) Chen <wei@cvluca.com>
2021-10-28 08:30:41 +11:00
Kent McLeod
f5c60239c1 qemu-arm-virt: Add KernelUserTop option on aarch32
32-bit architectures have to share a small 4GiB address space between
privileged and non-privileged modes. Picking the address to split the
address space at affects how much virtual memory userlevel can use, and
how much physical memory the kernel can turn into untypeds. This is
something that should be configurable policy as different divisions make
sense for different applications.  For now we only add the config
option to qemu-arm-virt to try it out before potentially adding it to
all 32-bit platforms.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-10-28 08:29:29 +11:00
Stephen Sherratt
8a556ab922 Trivial: Style
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
2021-10-27 21:25:39 +11:00
Stephen Sherratt
711a17e4c9 Add whitespace to beaglebone dts to match others
Makes it easeier to eyeball the difference between the beaglebone's spec
and (say) the beaglebone-black's spec.

Changed with `sed -re 's/<(.*)>/< \1 >/`

Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
2021-10-27 21:25:39 +11:00
Stephen Sherratt
0e91b09a2f Update cmake config to add beaglebone
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
2021-10-27 21:25:39 +11:00
Stephen Sherratt
86abcd33a1 Add device tree spec for bone
Generated by:
- clone linux from https://github.com/torvalds/linux.git
- checkout v4.20
- run update-dts.sh script

Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
2021-10-27 21:25:39 +11:00
Stephen Sherratt
5888e3a9a6 Add beaglebone to update-dts.sh script
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
2021-10-27 21:25:39 +11:00
Kent McLeod
4821bf0a2c nitrogen6sx: Select correct serial when using mcs
When KernelIsMCS is set a different timer device is used by the kernel
which is selected by an MCS specific device tree overlay. This overlay
now sets the correct serial device for the nitrogen6sx board.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-10-27 17:28:40 +11:00
Axel Heider
9a93cd3b52 riscv: fix typo in comment, Sv38 is Sv39
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-10-27 17:17:17 +11:00
Axel Heider
ed39a40457 arm/zynqmp: fix comment about arm core
ZnyqMP uses Cortex-A53 not an A57.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-10-27 17:17:17 +11:00
Axel Heider
7337b515eb arm/bcm2711: remove check for HAVE_AUTOCONF
HAVE_AUTOCONF is always set nowadays, checks are deprecated.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-10-27 17:17:17 +11:00
Indan Zupancic
561c6e65be tqma8xqp1gb: Remove Linux specific memory regions
seL4 can use those memory regions however it likes,
it's just normal memory.

Signed-off-by: Indan Zupancic <Indan.Zupancic@mep-info.com>
2021-10-26 20:00:22 +11:00
Kent McLeod
6c3bde8fd8 imx8mm-evk: Don't use symlink for constants.h
Not using a symlink means that ninja install now works for this
platform.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-10-26 09:31:12 +11:00
Gerwin Klein
51d3b824b8 manual: fix explanation of CNode_Mutate
Mutate cannot be used to badge endpoints (many years ago, before the
first public release, this was possible, but was removed).

Also explain why Mutate is not always replaceable with Mint+Delete.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-19 15:50:47 +11:00
Gerwin Klein
3a7764c033 manual: more precision on retype and revoke
The concept of untyped object was confusing the description here, esp
when it comes to the CDT and what is derived from what. Also explain
when memory is actually zeroed, because that is important for where you
want to make sure that no confidential data remains in memory, for
instance.

This commit only affects the retype/revoke explanation and does not
attempt to clear up the concept of untyped object more generally.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-19 15:50:47 +11:00
elelel
be34e323e5 Fix indexing into an empty array
Signed-off-by: elelel <elelel@3wh.net>
2021-10-18 18:10:59 +11:00
Gerwin Klein
526206aabe libsel4 idl: error conditions of SchedContext bind
Add error conditions for the lazy bind of SchedContexts to
notifications or TCBs (introduced in e18e32e28e).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-18 18:08:32 +11:00
Gerwin Klein
e5791a76cb github: run actions with secrets only in seL4 org
Some of the Github actions in this repository require secrets for
access to hardware test or other compute infrastructure, or for
deployment. When these are run in a fork on GitHub they are safe,
but generate annoying error messages.

This commit adds tests in the relevant actions whether they are run
from the seL4 org or not, and skips the action when they are run
outside. This should make the remaining actions more useful on forks.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-18 14:47:07 +11:00
Jimmy Brush
85bf4bb280 libsel4: idl: Document additional error codes
- seL4_FailedLookup in X86IOPageTableMap
- seL4_FailedLookup in ARM page invalidation operations
- seL4_FailedLookup in ARMASIDPoolAssign

Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
9b5b0e9c8a manual: Swap API description and error code table
Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
45344a9503 libsel4: idl: Fix more punctuation in errors
Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
062eb3cb45 libsel4: idl: Fix punctuation in errors
Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
9890b78c2b manual: Remove some extra spaces after texttt
Extra spaces are inserted after texttt tags when generating doxygen
comments in order to ensure that xmlonly tags are readable by doxygen.

The extra spaces cause a description like this:

```
Testing <texttt text="1"/>, 2, 3
```

To be rendered like this:

```
Testing 1 , 2, 3
```

This change identifies text runs that start with extra spaces and either
a period or a comma and removes the extra spaces, allowing at least
common punctuation to be rendered correctly.

Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
33212ab556 libsel4: idl: Fix incorrect errors
Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
1740abff65 libsel4: idl: Add ASID errors
Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
73180e0e8d libsel4: Document errors in IDL
Also, remove any detailed discussion of error codes from method
descriptions.

Fixes #499

Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
02a5f761f7 manual: Add returned error codes table to API
Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
ae197ad146 libsel4: Generate doxygen tag for error element
Translate "error" elements into "retval" doxygen comment tags when
generating object invocation stubs.

Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush
238c6b8da2 libsel4: Add error element to IDL
This documents the error values that can be returned by each kernel
object method.

Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Gerwin Klein
bb5efc43b1 trivial: fix missing semicolon
This was accidentally removed in a previous commit

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-14 17:07:15 +11:00
Axel Heider
aff1402f59 boot/risc-v: align with arm implementation
- pass DTB as paddr/len and check location
- Fail boot if DTB region is invalid. Logging error messages requires
  reordering the code.
- Do not copy the whole DTB region, but only the actual DTB data to
  bootinfo.
- Align the ARM and RISC-V implementations.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-10-14 10:56:59 +11:00
Axel Heider
6d9d15c397 boot/arm: pass DTB as paddr/len and check location
- Pass on the DTB as paddr/len.
- Fail boot if DTB region is invalid. Logging error messages requires
  reordering the code.
- Do not copy the whole DTB region, but only the actual DTB data to
  bootinfo.
- Align the ARM and RISC-V implementations.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-10-14 10:56:59 +11:00
Viktor Sannum
e22089d0cc rpi3: Mark first memory page as reserved
When the kernel is built the build system is responsible for finding
a suitable physical memory location where the kernel can be put on
the given target platform.
This is recorded into the kernel.elf file and read by the elfloader
program when it loads the kernel to that memory address.

In order to find memory blocks to avoid, the build system looks for
the /reserved-memory node in the target platform's device tree dts,
along with other device memory blocks.

The bcm2837 / Raspberry Pi 3 bootloader uses the first memory page
at address 0x0 to load a so called armstub which is used to set up
the ARM processor's initial state. It is also used to "park" the
secondary cores by putting them in a spin loop located within the
armstub from which the boot core can release them when ready.

The rpi3.dts already contains a /memreserve/ node reserving this
page, however as the build system only looks for the standardized
reserved-memory node it promptly disregards it and allow the kernel
to be loaded at physical address 0x0, overwriting the armstub.

A side effect of this is that the spinloop code also is overwritten,
potentially releasing the secondary cores to execute whatever kernel
code is written in the place of their spinloops, causing all kinds
of undefined behavior dependent on both race conditions and kernel
elf layout. It also implies that the kernel SMP boot code would not
be able to release the cores if implemented for the platform.

This patch adds the /reserved-memory node to the overlay-rpi3.dts
file and a child node reserving the memory region for the first
memory page. This in effect causes the kernel to instead be loaded
to 0x1000000 (aligned to a supersection).

Co-authored-by: Axel Heider <axelheider@gmx.de>
Signed-off-by: Viktor Sannum <sannum.viktor@gmail.com>
2021-10-14 10:45:15 +11:00
Kent McLeod
fc167441f0 boot: Don't round create_device_untypeds region
The bitfield generated accessor would only return an error if the region
being turned into an untyped was seriously wrong and would have already
been caught by earlier error checking in the region setup code.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-10-03 10:10:43 +11:00
Kent McLeod
18a3fb3bae hardware.py: Create smaller UT at end of addresses
At the end of the physical address range, the last address isn't turned
into an UT object. The scripts generating the memory regions
unnecessarily round down to a small page size when they could instead
round down to the smallest UT size and this memory could be used for
smaller kernel objects.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-10-03 10:10:43 +11:00