Commit Graph

4470 Commits

Author SHA1 Message Date
Gerwin Klein
eb279b5d24 configs: pick imx8mm config from imx8-fpu-ver
Use `ARM_verified.cmake` from branch imx8-fpu-ver as
`ARM_imx8mm_verified.cmake` on master, so both can be used by
verification CI without switching branches.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-05 10:57:20 +10:00
Gerwin Klein
cd8e5c068c configs: turn FPU off for base verification builds
Turn FPU off by default for the verification builds we have so far.
Only the imx8mm branch currently supports FPU for AArch32.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-05 10:57:19 +10:00
Rafal Kolanski
240b53e262 cmake: allow FPU in AArch32 verification configs
Make FPU possible for "ARM" verification targets.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2023-06-05 10:56:51 +10:00
Ivan-Velickovic
305bfafd45 Fix setting of CMake variable in BCM2711 config
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-06-01 17:02:40 +10:00
Ivan Velickovic
96ce215cc7 Add support for other Raspberry Pi 4B variants (#1045)
There are multiple variants of the RPi4B SBC with different sizes of
RAM. There exists 1GB, 2GB, 4GB, and 8GB models. This patch adds the
`RPI4_MEMORY` CMake configuration option in order to be able to specify
the RAM size when building the kernel. Based on the RAM size provided,
an appropriate device tree overlay is selected.

The default memory size of 8GB remains the same as to not introduce
breaking changes.

Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-06-01 15:54:04 +10:00
Gerwin Klein
35c41a822f macros: avoid breaking C subset
__builtin_offsetof is not part of the verification C subset -- avoid
accidental use by not declaring a macro for it and filter out the
single use by explicitly marking it as invisible to verification.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-31 14:55:57 +10:00
Gerwin Klein
94d393418e gic_v3: _Static_assert is not supported
Prefer compile_assert over _Static_assert. The latter is only available
in C11, and the verification demands C99.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-31 13:30:07 +10:00
JorgeMVP
b544529615 generc_timer: enable only once for mcs/non-mcs
Enable the timer only at initialization and since it is always
enabled. It is not needed to be re-enabled.

Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-05-25 20:42:02 +10:00
JorgeMVP
62c8148268 generic_timer: force timer to de-assert irq
Generic Timer IRQs are level-sensitive, when the CNT_TVAL
is updated the trigger condition is de-asserted and the
change is propagated to the GIC in a finite time to clear
the pending state.

However, we have to make sure the timer deasserts before
EOIR/DIR, otherwise the interrupt happens again. Therefore,
we need an isb() to cause the timer to de-assert before EOIR/DIR.

There is also a chance of spurious IRQ. A spurious IRQ can be
generated, in the case we have a level-sensitive IRQ, and its
pending state is cleared at device-level but not yet propagated
to the GIC. In between the IRQ deactivation and IRQ ack of the
new interrupt if the requested change from the timer gets propagated
then it causes a spurious IRQ.

Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-05-25 20:42:02 +10:00
Ivan-Velickovic
8c9cf6c7db Remove VMKernelReadOnly from AArch64 VM rights
In the interest of stability and not breaking
things, the value of VMReadOnly remains the same.

Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-05-25 14:48:37 +10:00
Ivan-Velickovic
ac49331e2a manual: ARM_ParityEnabled is ignored on AArch64
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-05-22 11:57:29 +10:00
Ivan-Velickovic
6dcbcbd320 manual: x86 VM attributes are for IA-32 and x64
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-05-22 11:57:29 +10:00
Ivan-Velickovic
afb6300426 manual: document VM attributes for RISC-V
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-05-22 11:57:29 +10:00
Axel Heider
2826d3b0f4 cmake: define KERNEL_ROOT_DIR
Avoid redundancy.

Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
2023-05-12 12:04:58 +10:00
JorgeMVP
a681fb9755 gic_v3: AP1R for group 1 IRQs
- In non-secure world, group 1 IRQs are used instead of group 0.
Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-05-08 20:46:22 +10:00
Gerwin Klein
f11b2a58ef config typo: KernelMaxNumBootinfoUntypedCap
The verified configs have a typo in the name of the
KernelMaxNumBootinfoUntypedCaps setting, which is then ignored by the
build system and the default is used if not otherwise set.

Remove the instances that have been ignored so far and replace with
the default value if they are not otherwise set. This means there is
no actual config change.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-05 16:46:06 +10:00
Gerwin Klein
07a8263a9d bitfield_gen: add CLI to manual
* describe CLI
* describe pruning
* mention where in seL4 generated code and source are

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-03 09:05:23 +10:00
Gerwin Klein
449c9089ad bitfield_gen: remove obsolete options, add help
* Add help texts for all CLI options.

* Point to the manual in file header.

* Remove obsolete `--multifile_base` and `--c_defs` options. The former
  is unused and the logic for it was removed in the previous commit.
  The latter is not referenced in the code and has no effect. `

* Remove unused `mode` variable.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-01 12:35:48 +10:00
Gerwin Klein
ebea422f86 bitfield_gen: remove unused --multifile_base logic
The `--multifile_base` option is unused in the seL4 build and has
comments indicating that it is broken.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-01 12:35:38 +10:00
JorgeMVP
7a0a4438cb gic_v3: use CNT_CT instead of CNTFRQ
- CNTFRQ is a constant value, and does not work for this case,
while CNT_CT is the one that should be used as 64-bit physical counter.

Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-05-01 09:52:56 +10:00
Gerwin Klein
4b18acaed9 tools: TOC for bitfield generator manual
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-27 13:24:37 +10:00
Gerwin Klein
13f0f035cf tools: add manual for bitfield_gen.py
Add a user manual for the bitfield generator that documents syntax,
semantics and basic concepts. Should also be able to serve as main
spec for what the tool is supposed to do.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-27 13:24:37 +10:00
Gerwin Klein
886fcec2b6 trivial: fix typo
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-27 13:13:13 +10:00
Kent McLeod
8402de52db aarch64: Add option for user cache maintenance
Add a config option, KernelAArch64UserCacheEnable, that enables user
level access to DC CVAU, DC CIVAC, DC CVAC, and IC IVAU which are cache
maintenance operations for the data caches and instruction caches
underlying Normal memory and also access to the read-only cache-type
register CTR_EL0 that provides cache type information. The ArmV8-A
architecture allows access from EL0 as fast cache maintenance operations
improves DMA performance in user-level device drivers.

These instructions are a subset of the available cache maintenance
instructions as they can only address lines by virtual address (VA).
They also require that the VA provided referrs to a valid mapping
with at least read permissions. This corresponds to lines that the
EL0 could already affect via regular operation and so it's not expected
to break any cache-partitioning scheme.

The config option allows this policy to be selected for a particular
kernel configuration, but it is default enabled as this has been the
existing behavior for current aarch64,hyp configurations and have not
been explicitly disabled in non-hyp configurations.

Signed-off-by: Kent McLeod <kent@kry10.com>
2023-04-25 15:49:28 +10:00
Kent McLeod
57ca89d68e trivial: Fix typo of UCT bit in SCTLR_EL1
Signed-off-by: Kent McLeod <kent@kry10.com>
2023-04-25 15:49:28 +10:00
Axel Heider
525d14ccfc python: include config.h first in generated files
Including the configuration first ensure consistent behavior.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-04-24 23:02:12 +10:00
Axel Heider
4d1da1002b libsel4: use sel4/config.h instead of autoconf.h
Make sel4/config.h the only file to eventually include autoconf.h

Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-04-24 23:02:12 +10:00
Axel Heider
8eec7ad207 python: include sel4/config.h and not autoconf.h
Include sel4/config.h instead of autoconf.h in the generated code.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-04-24 23:02:12 +10:00
Axel Heider
55dc30b4a6 boot/risc-v: avoid uncommon fence usage
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
2023-04-23 22:26:19 +10:00
Axel Heider
7988b9baea boot/arm: invert conditional code check on SMP
The cache maintenance is needed on AARCH32, so check explicitly for
this architecture instead of doing this everywhere except AARCH64.

Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
2023-04-23 22:26:19 +10:00
Axel Heider
cd1fbafbb7 boot/risc-v: improve SMP boot documentation
Improve the documentation to describe about the potential pitfall in SMP
boot and the non-recommended barrier that is used.

Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
2023-04-23 22:26:19 +10:00
Axel Heider
9b039f8e37 risc-v/hifive: adapt to post-v0.9 OpenSBI
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
2023-04-23 20:59:48 +10:00
JorgeMVP
b8f1753d64 ipi: add missing barrier and enforce completion
- dmb() no longer works for GICv3, and consequently
a stronger barrier like dsb() has to be used. A weaker
variant of dsb is used to ensure the observability of
complete stores in the same inner-shareable domain.

Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-04-23 15:00:48 +10:00
JorgeMVP
a4b591727a arm64: add required isb() between AT and PAR inst
- "When an address translation instruction is executed,
explicit synchronization is required to guarantee the
result is visible to subsequent direct reads of PAR_EL1."

Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-04-23 14:59:35 +10:00
Mathieu Mirmont
729cc7fdbf gcc.cmake: add more known ARM cross compilers
These are the prefixes used by the official Arm GNU Toolchain [1] It
would be convenient if seL4 would recognise it out of the box.

[1] https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

Signed-off-by: Mathieu Mirmont <mat@parad0x.org>
2023-04-23 14:58:40 +10:00
Axel Heider
62dccc901a boot: add missing line break in error messages
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
2023-04-17 16:32:27 +10:00
JorgeMVP
a7845d297d gic_v3: fix offset for gicd iroutern mem-map reg
GICD_IROUTERn is at the offset 0x6100 for SPI 32.
SGIs and PPIs do not have a target since they are private to CPUs.
Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-04-14 18:18:50 +10:00
Gerwin Klein
fb808f0528 boot: sanity checks for provide_untyped_cap (#1006)
* boot: sanity checks for provide_untyped_cap

Check arguments for alignment, size, and kernel window (if not device
untyped). This provides sanity checks in case any of the memory region
computations are wrong.

Since this code is not performance critical and can return failure,
these are not assertions, but normal conditions with user feedback.
I.e. they are on in release and verified configurations.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-13 17:24:28 +10:00
Gerwin Klein
ca1d5f9226 machine: compile time checks for multikernel
Add compile time checks for conditions on physBase that are necessary
for verification of multikernel builds to succeed -- if these fail, the
proofs will fail.

If these succeed, and nothing else has changed compared to a verified
kernel other than physBase, then the proofs will succeed. This does not
mean that all platform requirements are validated, it just means that
all requirements for the proofs to be consistent are met.

The conditions correspond to those in

    spec/machine/*/Arch_Kernel_Config_Lemmas.thy

in the verification repository.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-12 15:56:26 +10:00
Gerwin Klein
55094c696e boot: document why region overflow is allowed
Document in `create_untypeds_for_region` what makes region overflow for
device untypeds work.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-12 15:07:02 +10:00
Gerwin Klein
51966d4508 boot: document region types
Mention that it can be Ok for regions to overflow. State explicitly
that the end is exclusive.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-12 15:07:02 +10:00
Gerwin Klein
57c46bc8d0 bitfield_gen: comment for original source file
Add a `--form_file <file>` option to the bitfield generator for
printing a `/* generated from <file> */` message in a comment.

Use this option in cmake to provide the original source .bf file before
preprocessing so it's easier to find out where the corresponding
definitions are.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-10 15:46:00 +10:00
Gerwin Klein
ec170f4c21 manual: make sharing more precise
Using the same cap twice on the same slot is possible for remapping,
but using the same cap twice in different tables or VSpaces will result
in an error.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-30 18:36:54 +11:00
Gerwin Klein
a57c38c5fc manual: AArch32 page tables are config dependent
Mention that in hyp mode AArch32 page tables cover more address space.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-30 18:36:54 +11:00
Gerwin Klein
10bb041b15 manual: 3 and 4 level configs in AArch64
Describe the difference in 3 and 4 level configs for AArch64 and point
to the libsel4 macros that abstract from the distinction.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-30 18:36:54 +11:00
Gerwin Klein
1479e3d831 manual: use \obj macro consistently in sect 7
Remove previous mix of \texttt and \obj, use \obj consistently when
referring to kernel objects.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-30 18:36:54 +11:00
Gerwin Klein
aa4ce0840d manual: terminology in ASID Control+Pool sections
- clarify terminology (cap vs object) in ASID Control and ASID pool
- same for page sharing

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-30 18:36:54 +11:00
Gerwin Klein
59e751852c manual: more consistent terminology in sec 7.1
Adjusting for VSpace object clarification and making sure terminology
is used consistently.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-30 18:36:53 +11:00
Gerwin Klein
e4c0e561d6 manual: describe VSpace objects more explicitly
Rework the intro to the VSpace section for slightly improved clarity
and a more explicit definition of the distinctions between VSpace and
VSpace object, and between frame object and page capability.

Addresses #564

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-30 18:36:53 +11:00
Axel Heider
675604e3b6 add compile assert for seL4_UntypedDesc size
This header file is shared by kernel and userland. We can control the
kernel compiler setting, but userland might use an arbitrary setup.
Put a safeguard in place that things works as expected.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-03-28 13:34:35 +11:00