Commit Graph

309 Commits

Author SHA1 Message Date
Cindy Liu
04dc9675f3 Replace deprecated pkg_resources usage
Use importlib.metadata to check the jinja2 version

Signed-off-by: Cindy Liu <hcindyl@google.com>
2023-12-28 06:05:07 +07:00
Ivan-Velickovic
e959f83962 Add support for Star64 SBC
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-11-08 14:34:18 +00:00
Nick Spinale
2c8bc584da cmake: generate config headers at config-time
Commit 6d439a4646, which added JSON configuration output, caused the
configuration headers to be generated at build-time instead of
configure-time.  This broke CAmkES build systems which depend on
configuration headers in CAmkES files at configure-time.

This commit makes the configuration headers available at configure-time.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2023-10-28 07:36:42 +11:00
Ivan-Velickovic
e1bdd809b6 Output JSON for hardware configuration
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-08-13 08:59:55 +10:00
Ivan-Velickovic
2730e65796 Mark CLINT as reserved device on RISC-V platforms
Without this patch, user-level programs have the ability to
map in the core-local interrupt controller on RISC-V platforms
which contains the memory-mapped registers for the core-local
timer the kernel uses. This is a level of privilege that
user-level programs should not have. Writing to the `mtime`
register is possible which can then affect the timer interrupts
are delivered to the kernel.

Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-06-19 11:05:02 +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
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
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
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
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
Rafal Kolanski
65a1b457a4 make physBase a static inline function
For verification flexible w.r.t kernel placement in physical memory, we
need to relate physBase as a named constant to its abstract equivalent.
Unfortunately, apart from enums, the C programming language does not
have real constants. The C parser follows the C standard and requires
enums constants to be storable as int, meaning without major overhaul
enums are not sufficient for storing word_t-sized memory addresses.

Since the linker scripts can't deal with static inline functions
in the constants they need (KERNEL_ELF_BASE and KERNEL_ELF_PADDR_BASE),
we provide the following preprocessor definitions for the linker
specifically:
* PHYS_BASE_RAW (the numerical value returned by physBase())
* KERNEL_ELF_BASE_RAW
* KERNEL_ELF_PADDR_BASE_RAW

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-07 14:29:14 +11:00
Nick Spinale
c642a398ba cmake: provide gen_config.json
gen_config.json provides a language-independent means of accessing the
kernel configuration. Before, gen_config.h was generated directly in
CMake.  Now, gen_config.yaml is generated directly in CMake, and
gen_config.h and gen_config.json are derived from gen_config.yaml.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2023-03-02 09:31:42 +11:00
Nick Spinale
acba034390 cmake: add missing dependency for autoconf
Declare that autoconf.h depends on each gen_config.h that it references.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2023-03-02 09:31:42 +11:00
Peter S. Housel
8ca4a87c9a Add Quartz64 support
This adds support for the Pine64 Quartz64 and other devices based on
the Rockchip RK3566. The platform support is adapted from the
Rockpro64 code, except that the RK356x has A55 cores, and adjusting
for the fact that the ARM Generic Timer is the only on-chip timer
available.

Signed-off-by: Peter S. Housel <housel@acm.org>
2022-11-21 16:43:20 +11:00
Jesse Millwood
e2ae959ceb polarfire: fix address for timer in dts
Signed-off-by: Alex Pavey <Alex.Pavey@dornerworks.com>
2022-11-06 18:31:54 +11:00
Jesse Millwood
48ee2f07c7 Polarfire: Made timer dts node 4k region
Signed-off-by: Alex Pavey <Alex.Pavey@dornerworks.com>
2022-11-06 18:31:54 +11:00
Joonas Onatsu
8b22630929 kernel,bcm2711: Remove redundant reserved mem
Remove redundant (and incorrect) reserved memory
definition for VideoCore memory. The reserved
memory area is defined in 'overlay-rpi4.dts'.

Signed-off-by: Joonas Onatsu <joonasx@ssrc.tii.ae>
2022-10-26 15:27:19 +11:00
Hannu Lyytinen
0de322929c kernel,bcm2711: remove UART pinmux
Signed-off-by: Hannu Lyytinen <hannux@ssrc.tii.ae>
2022-10-26 15:27:19 +11:00
Hannu Lyytinen
1a9b776e4f kernel,bcm2711: Add RPi4 memory map
Signed-off-by: Hannu Lyytinen <hannu.lyytinen@unikie.com>

kernel,bcm2711: Fix RPI4 address mapping

Fix build error and warnings by removing GPIO mapping
from overlay. Also as a note, don't add 'serial1' or 'ethernet'
here, because 'serial1' is already mapped to sel4 kernel by
'chosen' block in 'overlay-rpi4.dts', and the translation for
the 'ethernet' is done with 'ranges' property.

Signed-off-by: Joonas Onatsu <joonasx@ssrc.tii.ae>

kernel,bcm2711: Fix memory area overlay DTS

First fix is to change the memory area reserved for
the VideoCore from 64 -> 76 MB, as this is the default
value on RPi4. Using other values would require configuration
of the first stage bootloader with 'config.txt' file.

Second fix is separating the disjunct memory areas
to separate nodes, as the generator Python scripts
in 'kernel/tools/' etc discarded the first area below
1GB limit if all areas were defined in the same node.
The effect of different variations can be observed
during kernel build in the generated
'kernel/gen_headers/plat/machine/devices_gen.h' header.

Third fix is adding the reserved memory area for the
VideoCore memory to avoid any collisions.

Signed-off-by: Joonas Onatsu <joonasx@ssrc.tii.ae>
2022-10-26 15:27:19 +11:00
Ahmed Charles
c92b3b3163 Add __repr__ for WrappedNode
Signed-off-by: Ahmed Charles <acharles@outlook.com>
2022-07-20 16:37:33 +10:00
Bin Meng
3179add042 tools/bitfield_gen: ensure UTF-8 encoding
There are cases that reasonably require non-ASCII characters in the
source code, hence tools/bitfield_gen.py must be able to handle them
correctly. This commit makes sure the bitfield generator consistently
opens all files with UTF-8 encoding.

Co-authored-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2022-06-03 14:19:24 +10:00
Mark Jenkinson
ae7798e319 Update MaaXBoard device tree
Generated from maaxboard-dcss-hdmi.dts (Avnet/linux-imx) for more
comprehensive device support. Updated overlay to align.
Signed-off-by: Mark Jenkinson <mark.jenkinson@capgemini.com>
2022-06-03 09:45:02 +10:00
Stephen Williams
55fde27e10 Add support for the Avnet MaaXBoard
Signed-off-by: Mark Jenkinson <mark.jenkinson@capgemini.com>
Co-Authored-By: Stephen Williams <stephen.williams@capgemini.com>
2022-05-11 17:31:07 +10:00
Axel Heider
83a02a96fc python: use '#paragma once' include guard
Signed-off-by: Axel Heider <axelheider@gmx.de>
2022-03-23 17:28:07 +11:00
matt rice
7eb7cb1f6a fix parenthesis in condition_to_cpp
Signed-off-by: matt rice <ratmice@gmail.com>
2022-03-22 18:33:38 +11:00
matt rice
e863cbe987 remove test_xml_condition.py
Signed-off-by: matt rice <ratmice@gmail.com>
2022-03-22 18:33:38 +11:00
matt rice
0e354b5766 tools: use conditions elem
Signed-off-by: matt rice <ratmice@gmail.com>
2022-03-22 18:33:38 +11:00
matt rice
accccf3dbb add condition elem, test it against condition attr
Signed-off-by: matt rice <ratmice@gmail.com>
2022-03-22 18:33:38 +11:00
Gerwin Klein
0c9952f90a trivial: proof style fixes for bitfield_gen
Bring up-to-date with current proof style, make style consistent,
slightly increase proof parallelism.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-22 11:06:34 +11:00
Gerwin Klein
9f9ceddc18 bitfield_gen: allow non-contiguous tag fields
A tagged union can now optionally use multiple fields to indicate the
tag. These are called "sliced" tags in the code. The tag fields have to
be at the same position and width in each block of the tagged unions,
and all tag fields have to be within the same word.

When sliced tags are used, tag class masks cannot be used at the same
time for this tagged union.

In the `tagged_union` declaration, the values of such sliced tags
become tuples. For instance, if `x` and `y` are tag fields (declared in
blocks not shown here) with width 1 and 2, we can write:

    tagged_union ex exType(x,y) {
        tag ex1 (0,2)
        tag ex2 (1,3)
    }

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-21 17:43:37 +11:00
matt rice
97bb77a116 trivial: update path to syscall.xml
Signed-off-by: matt rice <ratmice@gmail.com>
2022-03-01 07:57:31 +11:00
matt rice
190e004614 move logic out of syscalls jinja template
Signed-off-by: matt rice <ratmice@gmail.com>
2022-03-01 07:57:31 +11:00
matt rice
d742424021 use the loop.first builtin instead of namespaces
this allows the template to be parsed with minijinja
which doesn't support namespaces or set (at this time).

Signed-off-by: matt rice <ratmice@gmail.com>
2022-03-01 07:57:31 +11:00
Axel Heider
6c3c4ac7b4 add comment for conditional section end
Signed-off-by: Axel Heider <axelheider@gmx.de>
2022-01-04 19:26:24 +11:00
Axel Heider
b3fce750d5 use '#pragma once' guard
Signed-off-by: Axel Heider <axelheider@gmx.de>
2022-01-04 19:26:24 +11:00
Alex Pavey
2935150c35 zynqmp/ultra96: Generate smmu node in header
Also make device trees more consistent between zynqmp
and ultra96.

Signed-off-by: Robbie VanVossen <robert.vanvossen@dornerworks.com>
2021-12-21 08:13:14 +11:00
Chris Guikema
8d52ba7d26 ultra96: differentiate between v1 and v2
This commit adds a new device tree for the ultra96v2, adding
additional devices to give to userspace.

Signed-off-by: Robbie VanVossen <robert.vanvossen@dornerworks.com>
2021-12-21 08:13:14 +11:00
Axel Heider
c036e6c676 python: use KernelSel4Arch instead of KernelArch
Drop optional parameter 'arch' and make 'sel4arch' a required parameter
to avoid implicit assumptions.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-12-03 10:26:41 +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