Commit graph

3983 commits

Author SHA1 Message Date
Ben Leslie
e3eda12d03 Add support for the TQMa8XQP 1GiB module
TQ Group produces a system-on-module family called TQMa8Xx.

The user manual for this SoM is available here:

https://www.tq-group.com/filedownloads/files/products/embedded/manuals/arm/embedded-modul/TQ-Socket/TQMa8Xx/TQMa8Xx.UM.0104.pdf

This SoM comes in a number of different configurations.

The specific NXP SoC used, and the amount of memory are both
configurable.

The TQMa8XQP is the part number for the TQMa8Xx family configured with
the i.MX 8QuadXPlus SoC.

The datasheet for the SoC is available here:

https://www.nxp.com/docs/en/data-sheet/IMX8QXPAEC.pdf

In addition to the SoC being configurable the amount of SDRAM
on the SoM is also configurable.

The support provided in this PR is specifically for the TQMa8XQP
configured for 1GiB of memory. Note: Actual usable memory available
to the ARM application processor is 1022MiB.

System-on-modules rely on an appropriate carrier board.
Testing of this PR has been done on the MBa8Xx carrier board
that is available from TQ Group as part of their starter kit.

To the best of my knowledge there is nothing in this PR
that depends on the carrier board itself; all code is SoM
specific and should support any carrier board.

Note: This support is very specifically for the TQMa8XQP configured
with 1GiB of memory.

This may be a starting point for supporting other boards that
also have the NXP i.MX 8QuadXPlus SoC (as well as the i.MX 8DXP
and possibly other SoC in the i.MX 8 family).

Support is limited to the specific SoM due to the way in which
platform support currently works for seL4. Building a kernel
currently relies on the information from the DTS file (which is
SoM + RAM configuration specific). It would be preferable to
allow more generic support but SoC families but that is beyond
the scope of this PR.

Signed-off-by: Ben Leslie <benno@brkawy.com>
2021-08-31 08:38:25 +10:00
Chang Liu
65f94211cb x86: Mark idle_thread() as NORETURN
Mark the idle_thread() function as NORETURN for better static
analysis and compiler warnings.

Signed-off-by: Chang Liu <chang_liu3@brown.edu>
2021-08-30 10:46:12 +10:00
Chang Liu
604c7c106e x86: Always eliminate prologue for idle_thread()
The idle_thread() cannot perform any stack manipulations since it
runs in the idle thread TCB context. Declare the function with
the naked attribute, to ensure that the compiler always eliminates
the function prologue. Previously we rely on the -O2 optimization
flag for this, which on certain compilers (clang for instance) may
not guarantee that the function prologue gets eliminated.

Signed-off-by: Chang Liu <chang_liu3@brown.edu>
2021-08-30 10:46:12 +10:00
Gerwin Klein
f60875d3c0 fastpath: placate clang-11
clang-11 warns "converting the enum constant to a boolean". The
comparison generates the same code, since the expression can
be evaluated at compile time (I checked the objdump).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-30 09:41:45 +10:00
Axel Heider
da0aad0330 make kernel device frame handling more generic
The structure actually describes kernel frames and not kernel devices.
In most of the cases a peripherals will fit into one page, but some can
need more pages. On some platform there are no kernel devices at all.
Provides the macro NUM_KERNEL_DEVICE_FRAMES as simple way to find out if
there are mapping that hides the corner cases. This eventually allows
implementing a generic handling even on RISC-V without much overhead, so
the hack for HiFive/Spike can be removed.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Axel Heider
cd54bc95e1 inline parameter definition
There is no need to create an explicit helper variable.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Axel Heider
a7d38353a7 use helper variable to avoid redundancy
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Axel Heider
7bff9f4cd1 use BIT() macro instead of explicit shifts
As a side effect, the BIT() macro creates a word_t instead of an int,
so it can can handle even shift that exceed the int limits. This makes
the code more robust and provides the preferred coding pattern.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Axel Heider
0f7135aae4 arm: add sanity check for device mappings
Kernel device frames can never be executable. Even is this is generated
code, having an other assert here is a safe guard to catch potential
inconsistencies in the code generator.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Axel Heider
048c84fb94 use explicit field names in generated code
Using explicit field name in the assignment states more clearly what the
generated code does. It is also more robust and allows the compiler to
catch potential inconsistencies in case the structure details change.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Axel Heider
69204d0d2e trivial: break long lines in comment
Improve readability by breaking the line at around 80 chars.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Axel Heider
fc72f5e957 trivial: remove trailing empty lines
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Axel Heider
3220f3016f trivial: add empty line after include guard
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-27 21:15:11 +10:00
Gerwin Klein
f236ae8935 github: trigger main test on push to master
The trigger action sends repository_dispatch events to all
main test repositories of the manifests this repo is part of.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-27 14:08:23 +10:00
Axel Heider
43667a04f4 boot: print reserved and available memory regions
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-25 18:15:38 +10:00
Gerwin Klein
7892335ca1 tools: more portable shell test
No need for bash style test `[[ .. ]]`, normal POSIX test `[ .. ]`
works fine.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-25 17:56:49 +10:00
Gerwin Klein
00879fa943 tools: use /usr/bin/env for bash/sh invocation
This implements GitHub PR #115 on the current repo state. /usr/bin/env
is already used for other (cmake/python/etc) invocations, and this PR
brings bash/sh into line with that for slightly improved portability.

Co-authored-by: Douglas Wilson <douglas.wilson@gmail.com>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-25 17:56:49 +10:00
Gerwin Klein
7f562e1633 tools: consolidate RISC-V + Arm memory base logic
Co-authored-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
Co-authored-by: Axel Heider <axel-h@users.noreply.github.com>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-24 18:04:43 +10:00
Gerwin Klein
2296484665 tools: add risc-v dtb interrupt parsing
Co-authored-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-24 18:04:43 +10:00
Gerwin Klein
3398c01ee9 umm.py: no memoization
Memoization is not worth it here, the runtime of the entire program
is tiny. Removing the comment to curb temptations in the future.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-24 18:04:43 +10:00
Axel Heider
2836310f9a use ARRAY_SIZE to avoid implicit assumptions
MAX_NUM_FREEMEM_REG is used to define the number of elements of the
array ndks_boot.freemem[]. However, in the code iterating over the
elements, using the macro ARRAY_SIZE() is more straight forward and
avoids pulling in unnecessary dependencies.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-24 16:43:25 +10:00
Axel Heider
c72ecc7dd8 boot: reduce amount of helper functions
The python code generator ensures avail_p_regs always exists.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-24 16:14:26 +10:00
Axel Heider
b64e2deb3a boot: remove obsolete prototypes
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-24 16:14:26 +10:00
Gerwin Klein
02ddcd110a mcs: Remove domain time check from preemptionPoint
This removes the operations that trigger a reschedule or reprogram the
timer from `preemptionPoint` to ensure the relevant state updates in
the proof occur where they are easier to verify.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-24 10:22:33 +10:00
Axel Heider
f04c6c6378 risc-v/polarfire: set KernelOpenSBIPlatform
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-24 10:04:56 +10:00
Axel Heider
d0a3b28005 risc-v: avoid warning about interrupt parsing
Avoid the warning 'WARNING:root:Not sure how to parse interrupts for
"/cpus/cpu@0/interrupt-controller"' when building for platform hifive.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-24 10:04:56 +10:00
Axel Heider
8f9fdd7b41 trivial: fix typo in log message
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-24 10:04:56 +10:00
Axel Heider
fb6c7f143b trivial: fix typos in comment
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-24 10:04:56 +10:00
Axel Heider
1a3bb0156c trivial: add space before operator
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-24 10:04:56 +10:00
Axel Heider
f8d12311ba risc-v: don't add 8 bytes space at end of bss
The additional 8 byte go into a new page and then the rest of the page
is filled with padding. There is no good explanation what the 8 bytes
are used for, could be some copy/paste from another linker script.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-23 17:42:50 +10:00
Curtis Millar
ca34076c44 trivial: Consistent use of NODE_STATE fix
Fix some cases where `NODE_STATE` arguments were parenthesised in a
manner that was inconsistent with other uses (but also surprisingly
still valid?).

Signed-off-by: Curtis Millar <curtis@curtism.me>
2021-08-21 14:11:57 +10:00
Curtis Millar
96b8dca031 mcs: Don't check if old SC is still configured
When we are changing to a new SC, it doesn't matter whether the old SC
is still configured. We should also know statically within
switchSchedContext that whichever SC we will use to execute with next is
both present and configured.

As such, this check can be removed.

Signed-off-by: Curtis Millar <curtis@curtism.me>
2021-08-21 14:11:57 +10:00
Axel Heider
7d37990465 use ULL_CONST() for timer value
Enforce the maximum possible integer size in the generated C headers
instead of doing this in CMake.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-21 10:46:54 +10:00
Axel Heider
852ead2e2c merge TIMER_FREQUENCY definitions
There is no need for separate definitions, they define the same value.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-21 10:46:54 +10:00
Axel Heider
d2b38a42d2 risc-v: remove unused L2 cache functions
The L2 cache handling functions were copied from the ARM code in the
initial port, but they are not used on RISC-V. Remove them from the
code base, they can be brought back if a platform has an L2 cache that
needs to be maintained.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-20 17:51:38 +10:00
Gerwin Klein
56098195f2 mcs: sc_active not always true in sc_sporadic
Turns out the invariant 17109eb8c9 refers to is hard to prove
because it is not true, and the runtime check is necessary. This
assertion fails in sel4test SCHED_CONTEXT_0003 (Basic
api_sc_bind/UnbindObject testing).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-20 16:52:12 +10:00
Miki Tanaka
dc9ec49cf2 move scSporadic update
- in decodeSchedControl_ConfigureFlags
- a minor tweak to aid verification.

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-08-20 14:35:15 +10:00
Curtis Millar
17109eb8c9 mcs: Explicitly check that sporadic scs are active
Easier to check this explicitly than prove the invariant.

Signed-off-by: Curtis Millar <curtis@curtism.me>
2021-08-20 13:59:07 +10:00
Gerwin Klein
43b2029d02 github: clearer top-level name for compile action
Previous "Kernel" showed up for the badge and main checks group, which
is not very informative.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-20 13:42:48 +10:00
Gerwin Klein
cc32744ff3 README: adjust CI badge for seL4test
The badge now refers to the combined simulation + hw build + hw test +
deployment workflow.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-20 13:42:48 +10:00
Gerwin Klein
76532c1eae github: more fine-grained concurrency groups
Previously the `concurrency` statement also prevented concurrency
within the build matrix which we do not want.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-20 13:42:48 +10:00
Gerwin Klein
acbc4e6ddf github: separate sel4test for deployment on master
This commit pulls out a separate workflow for sel4test (simulation +
hardware runs) on pushes to master, and deploys a new default.xml to
sel4test-manifest when the test is successful.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-20 12:05:03 +10:00
Axel Heider
7e069b757e boot: improve comments
- Explain why restore_user_context() is not called in init_kernel()
directly.
- describe the parameters that init_kernel() expects.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-20 07:32:24 +10:00
Axel Heider
9ed91573ad boot: remove unsed references
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-20 07:32:24 +10:00
Kent McLeod
b05d681621 cmake: Add seL4Config.cmake include CMakeLists.txt
seL4Config.cmake is responsible for generating a valid
CMAKE_TOOLCHAIN_FILE and setting up platform config options at the start
of the build. The CMAKE_TOOLCHAIN_FILE variable has to be set before the
first cmake `project()` function is processed to take effect.
Previously this file was required to be imported in a CMake script
before the kernel's CMakeLists.txt could be processed. This prevented
the main CMakeLists.txt file from being used without an additional
configuration file:
cmake -G Ninja -C ../configs/ARM_verified.cmake ../

Now it is possible to do:
cmake -G Ninja -DKernelPlatform=imx6 -DKernelARMPlatform=sabre ../

This should make it easier to invoke CMake for building kernel
configurations from other build environments.

Because this file is now imported in the Kernel's CMakeLists.txt
context, there is no longer a requirement to save all the intermediate
settings into the cache and then read them out again.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-08-19 09:24:31 +10:00
Gerwin Klein
82e7a0251d git hw test: enable zynqmp
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-19 08:46:24 +10:00
Axel Heider
2075f0cded ensure assert() macro is an atom
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-08-19 08:28:27 +10:00
Gerwin Klein
dbab25c8d3 github: deploy verification-manifest on preprocess
Automatically keep verification-manifest in sync with
preprocess-equivalent changes.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-18 16:58:57 +10:00
Axel Heider
9c1508d8d9 Enforce '-fno-common'
GCC < 10 and clang < 11 put uninitialized global variables into a
'COMMON' section unless '-fno-common' is specified. The linker will put
anything from 'COMMON' as the end of the '.bss' it nothing else is
specified in the linker script. Besides making the variable placement
look odd, this also tends to waste a page because we puts large aligned
block at the end. Eventually, GCC 10 and clang 11 made '-fno-common'
the default, see
- https://gcc.gnu.org/gcc-10/changes.html
- https://releases.llvm.org/11.0.0/tools/clang/docs/ReleaseNotes.html

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-18 14:41:59 +10:00
Axel Heider
5ff8dce833 trivial: add comments about empty functions
Add a comment to clearly state the functions are empty on purpose, but
they still need to be provided to support the generic code flow.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-18 10:08:06 +10:00