356 Commits

Author SHA1 Message Date
Gerwin Klein
ef94b463bd clarify license for generated headers
Invocation and syscall headers are generated and provided under
BSD-2-Clause for user code and GPL-2.0-only for kernel code. To
facilitate people other than the copyright holder performing this
operation, the master files are provided under both (BSD or GPL, free
to choose).
2020-03-09 13:21:49 +08:00
Gerwin Klein
79da079239 Convert license tags to SPDX identifiers
This commit also converts our own copyright headers to directly use
SPDX, but leaves all other copyright header intact, only adding the
SPDX ident. As far as possible this commit also merges multiple
Data61 copyright statements/headers into one for consistency.
2020-03-09 13:21:49 +08:00
Gerwin Klein
ddad32febd review third-party license tags
Made third-party license tags more precise.
2020-03-06 17:40:15 +08:00
Luca(Wei) Chen
047ab9271a bitfield_gen: explicit branch predications
gcc8 might get wrong branch predications on these condition checks,
and it could break the code layout.
2020-03-02 13:32:35 +11:00
Alison Felizzi
71d636f8b3 arm_hyp: Save and restore vtimer state on switches
Added support for reading and writing additional virtual timer
registers for vcpu hw read and write accesses. These include the
compare value register (CNTV_CVAL) and offset register (CNTV_OFF),
each represented as two 32 bit (high and low) registers on aarch32 and
as single 64 bit registers on aarch64.

Added support for explicitly saving and restoring the virtual
timer registers when the vcpu is enabled and disabled. This
ensures when the vcpu is switched in and out, the virtual timer
registers are restored to a state that is consistent to when
it was last run.

By default the CNTVOFF register will be updated by the kernel to
accumulate the time the VCPU is not running. From the guest this will
result in the VCNT register not increasing when the VCPU is suspended.
This behavior can be turned off by disabling the
KernelArmVtimerUpdateVOffset config option.
2020-02-20 11:40:59 +11:00
Matthew
5ebe5526fd Add the suffix to the bitfield generation
Clang complains about shifting signed numbers so we need to make sure it
knows it is unsigned
2020-02-12 16:08:35 +11:00
Jesse Millwood
01cea266d9 RISCV: Added stdout-path to hifive dts
This sets the first UART as the stdout-path dts setting in the
"chosen" node in the HiFive device tree.

Change-Id: Icb6b9abf999bdd8a278df5a2ba73ad492af06a24
2019-12-23 12:18:34 -05:00
Simon Shields
0f61978058 hardware_gen: add elfloader CPUs output
outputs all CPUs described in the DT to the elfloader
header and also includes any devices in the seL4,elfoader-devices
property.
2019-12-16 14:29:05 +11:00
Simon Shields
7eb4147e43 hardware_gen: add elfloader output
The elfloader is going to start using devices based on the device tree.
Add an output method for hardware_gen.py that generates header files
that the elfloader can use. Currently they contain an array of
"devices", where each device has a compatiblity string and a series of
regions (represented simply as the physical address of the region).

For now, the elfloader only uses the serial device specified by the
stdout-path property in the DTB.
2019-12-11 13:50:26 +11:00
Siwei Zhuang
249bcdab63 riscv: Add support for Rocketchip SoC
Support Rocketchip SoC maps to Xilinx ZC706 board and ZCU102 board
2019-11-26 18:34:50 +11:00
Victor Phan
66bc2b1724 rename KDEV_PPTR/PPTR_KDEV to KDEV_BASE
This is the virtual address for the start of the kernel device mapping
region.
2019-11-21 15:53:11 +11:00
Simon Shields
b5c56244f1 Create device untypeds at boot for all arches
Currently on x86 device untypeds are generated by passing the entire
address space minus any parts that are reserved by the kernel or that
are "real" memory (e.g. kernel image, physical RAM).

On ARM and RISC-V, device untypeds were generated at compile-time from
a device tree. This patch moves ARM and RISC-V to use the same approach
as x86, and moves the code from x86 into a common location that's
shared between the three architectures.

Co-Authored-By: Anna Lyons <anna@gh.st>
2019-11-12 16:20:07 +11:00
Simon Shields
75ee55a8fd hardware: expose rpi3 intc region to userspace
the intc region contains a timer that userspace uses on the MCS kernel.
2019-11-12 16:18:33 +11:00
Simon Shields
294b592bb1 trivial: hardware.yml: clean up indentation 2019-11-12 16:18:33 +11:00
Simon Shields
82084ad92b hardware_schema: simplify and clarify schema
The two interrupt-related 'macros' are rather confusingly different.
Explain them, rename them and simplify interrupt specification while
we're at it.
2019-11-12 16:18:33 +11:00
Simon Shields
cdb6a093d4 hardware: remove executeNever
this is now implicitly true. MMIO regions should always be executeNever.
2019-11-12 16:18:33 +11:00
Simon Shields
7a26d271c3 hardware: change region logic in hardware yaml
- we're going to switch to mapping the whole address space, excluding
parts used by the kernel, to userspace. We trust the root server anyway,
so giving it extra (possibly invalid) MMIO space just simplifies stuff
on the kernel end.
- drop the hacky true/false/null 'user' flag in favour of a saner
true/false one.
- remove support for 'default' regions. By default we will pass unused
regions through to userspace.
2019-11-12 16:18:33 +11:00
Simon Shields
75f2c54b42 tools: rewrite hardware_gen.py
This is almost a complete rewrite from the old hardware_gen.py.

It separates the 'parse DT' stage from the 'generate output'
devices more strictly, and is hopefully easier to understand and
easier to extend.

We also no longer generate the 'devices' list (in YAML)
or the dev_p_regs array (in C), as the kernel will implicitly
expose all non-RAM untypeds as devices.
2019-11-12 16:18:33 +11:00
Siwei Zhuang
6e3606d056 RISCV: Add support for Ariane SoC
Support Ariane SoC platform running on Genesys 2 FPGA board.
2019-11-05 12:15:31 +11:00
Oliver Scott
b5a39a92a9 trivial: update licence 2019-10-25 14:18:20 +11:00
Oliver Scott
9abe8a4f0b add support for rockpro64
Kernel support for 64 bit rockpro board.
Dts was taken from the linux kernel.
2019-10-25 14:18:20 +11:00
Kent McLeod
b785b59930 cmake: Add SEL4_CONFIG_DEFAULT_ADVANCED variable
This directory-scoped varible is now used by config_option,
config_choice and config_string to set a created CMake cache variable as
advanced or not. An advanced variable is hidden by default in the CMake
configuration editors. Setting SEL4_CONFIG_DEFAULT_ADVANCED to ON will
cause variables to be advanced and not show up in the cache. Projects
can set this to limit the amount of options presented in the
config editor. Any cache variable can have this overridden by calling
mark_as_advanced(CLEAR config_name)
2019-09-13 18:42:42 +10:00
Kent McLeod
297d2b63da CMake: Invoke configuration files to build kernel
This leverages #!/usr/bin/env -S cmake -P to invoke a cmake
configuration file as a script that configures and builds a kernel in
the current directory with the configuration that was invoked. It is a
quick way for producing a kernel.elf or kernel_all_pp.c input file to
verification for a particular config.
2019-09-13 18:42:42 +10:00
G. Branden Robinson
2b5c8d3f84 setup.py: depend on 'pyyaml', not 'pyaml'
In the pip namespace, 'pyaml' is "pretty-yaml", a YAML generator (but
not a YAML parser); 'pyyaml' (accessed with "import yaml"), a.k.a.
"PyYAML", is the YAML serialiser and reader we actually use.

Bump the minor version number per semantic versioning rules.  (One could
argue that we are "removing" pyaml (pretty-yaml) from our interface and
therefore a major version bump is required, but we weren't _actually_
using that module so I would argue that the introduction of 'pyyaml' is
the visible change.)

Thanks to Japheth Lim for identifying this issue.
2019-08-30 16:53:16 +10:00
G. Branden Robinson
fc251b5067 setup.py: add Python dependency on libarchive-c
The `shoehorn` tool in tools/seL4 (the sel4_tools repository) requires
this.

Bump minor version number per semantic versioning rules (interface
extension).  (0.3.1 instead of 0.3.0 because 0.3.0 saw the light of day
with an incorrect dependency on `libarchive` instead of `libarchive-c`.)
2019-08-28 15:54:10 +10:00
G. Branden Robinson
568f509b50 Revert "setup.py: add Python dep[] on libarchive"
This reverts commit a14264336c.

There are (at least) 3 namespaces relevant to Python module names:
Debian package names, PyPI module names, and the name of a module used
by actual Python language imports.  That's one more than my brain could
handle.  I wanted "libarchive-c" in setup.py instead of "libarchive".
2019-08-28 15:49:28 +10:00
G. Branden Robinson
a14264336c setup.py: add Python dependency on libarchive
The `shoehorn` tool in the tools/seL4 (the sel4_tools repository) will
require this in a future commit.

Bump minor version number per semantic versioning rules (interface
extension).
2019-08-26 14:31:18 +10:00
G. Branden Robinson
d09cdc8329 trivial: add trailing comma to list element
Python syntax allows a comma after the last element of a list, and
having one helps avoid surprises in the event the lines of the list
are rearranged.
2019-08-26 14:29:29 +10:00
Anna Lyons
554f812da3 mcs: scheduling context donation over ipc
After this commit, threads blocked on an endpoint can recieve a
scheduling context from the thread that wakes the blocked thread.
2019-08-22 11:22:37 +10:00
Anna Lyons
4db4a3b882 kzm: implement MCS timer driver
- use gpt, so we can have overflow and compare interrupts at the same
time (epit only allows compare)
- set the gpt to use the ipg_highfreq timer, as the standard ipg is too
low and breaks the timer calculations
2019-08-22 11:22:35 +10:00
Anna Lyons
a7fb6b56b7 cortex-a9: tickless global timer driver
- use in sabre (imx6) and zynq7000, the two platforms that were using
  the private timer.
2019-08-22 11:22:35 +10:00
Anna Lyons
fad8781c81 mcs: Add reciprocal.py
Used for calculating constants for reciprocal division.
2019-08-22 11:22:34 +10:00
G. Branden Robinson
940b43b767 setup: add versioned dependency on pyaml
In commit 24131333ac ("trivial: disable
YAML loading warning"), an assumption was made that the version of pyaml
present was 5.1 or later; see https://msg.pyyaml.org/load .

Version the dependency.
2019-08-20 12:04:27 +10:00
Kent McLeod
2890188994 hardware_gen: Correctly set default kernel_size
kernel_size has a default value of 0x1000 according to
hardware_schema.yml.
2019-08-13 14:54:39 +10:00
Kent McLeod
d764d5f183 hardware_gen: Refactor script after recent changes
- remove add_build_rules() and replace with shorter inline impl.
- Remove nested for looping from Config.get_irqs() and .split_regions()
as we already know that a rule exists and have a reference to it via the
kernel device.
- Don't allow multiple rules for a single compatibility string. There
currently aren't multiple rules for a single string without any
motivating examples it is unclear whether this should be supported.
2019-08-13 14:54:39 +10:00
Kent McLeod
cf997974a8 hardware_gen: Always specify kernel devices
The kernel device IRQs and Frame mappings generated by this script will
only come from nodes specified in the seL4,kernel-devices property of
the chosen node.  Previously these devices were inferred by the script
but this led to false matching and didn't support easily overriding
which devices to match under different configurations or across
different platforms.

Explicitly specifying which devices from the device tree will be used in
the kernel makes it easier to check which devices the kernel is actually
using and makes it easier to change on a per platform or per
configuration basis.
2019-08-13 14:54:35 +10:00
Kent McLeod
44fce7ddf1 hardware_gen: Refactor calculating device regions
- Device.regions() now just calculates memory regions without splitting
them into user and kernel groups.
- Config.split_regions() now calls Device.regions() and performs the
splitting if the device is a kernel device, otherwise returns the
original regions.
- Config.split_regions() is now only used in a context when dealing with
kernel devices, otherwise Device.regions() can be called to return only
informatioin extracted from the device tree.
2019-08-13 14:52:01 +10:00
Kent McLeod
1bd86aabc6 hardware_gen: Refactor calculating kernel IRQs
- directly return IRQs from Device.get_interrupts(): Previously, these
IRQs were then mutated by Config.get_irqs() based on driver definitions
in hardware.yml. Inverting this order makes get_interrupts more general.
- Config.get_irqs() uses the Device it gets passed to call
get_interrupts() only when it needs to extract interrupts for a device.
- Use Config.get_irqs() for building kernel's IRQ list instead of
calling Device.get_interrupts() due to the new inversion.
2019-08-13 14:52:01 +10:00
Kent McLeod
ad45ffc1e4 hardware_gen: Remove unused method is_compatible
Not used and it is unlikely that it will be needed in the near future.
2019-08-13 14:52:01 +10:00
Kent McLeod
51f55342ca hardware_gen,Device: extract get_affinities method
Returns an array of interrupt affinities corresponding to an array of
interrupts for a Device.
2019-08-13 14:52:01 +10:00
Kent McLeod
a603c7f811 CMake: Correct allwinnerA20 platform name
This name is case sensitive
2019-08-13 14:51:57 +10:00
Edward Pierzchalski
cfc544ab49 bitfields: Specify iteration order over dicts
In Python 3, dict value iterators aren't deterministic between runs,
which causes nondeterministic definition output order. Some L4V proofs
are sensitive to this order.

Use sorted keys to guarantee order when iterating over values.
2019-08-08 10:19:24 +10:00
Anna Lyons
bc61a7f3bd python2 --> python3
Update all scripts and build system to call python3, given python2's
upcoming doom. Use sys.maxsize instead of sys.maxint in one script
(maxint does not exist in python3).
2019-08-08 10:19:24 +10:00
Kent McLeod
158ab9a3eb python-deps: Add pyelftools to sel4-deps package
This dep is required by the elfloader for loading Arm and RISC-V
platforms.
2019-07-31 11:32:34 +10:00
Kent McLeod
9b1877de21 Add initial i.MX8M Mini evk 64-bit Support
This adds support for the 64-bit i.MX8M Mini evaluation kit.
Currently only AArch64 EL1 is supported.
2019-07-19 14:32:53 +10:00
Yanyan Shen
d6d3aa4c32 trivial: dts: Change the DTS for FVP 2019-07-10 06:59:13 +10:00
Simon Shields
55ad2c4dca GICv2: map VCPU region as execute never
This matches the other GIC regions.
2019-07-02 16:04:39 +10:00
Kent McLeod
051d32beab Add initial i.MX8M Quad evk 64-bit Support
This adds support for the 64-bit i.MX8M Quad evaluation kit.
Currently only AArch64 EL1 is supported.
2019-07-01 23:31:47 +10:00
Kent McLeod
0d60f6f298 arm: Rename gic_pl390 to gic_v2
This is to reflect that this driver provides support for features that
are newer than gic_pl390 such as virtualisation.
2019-07-01 23:30:39 +10:00
Kent McLeod
82f2d1fc9c helpers.cmake: Add FORCE to all INTERNAL sets
INTERNAL implies FORCE but in some versions of CMake if a config option
has been passed in via a -D option the INTERNAL set doesn't override the
value when it should.

See: https://gitlab.kitware.com/cmake/cmake/issues/19015
  INTERNAL does not imply FORCE for CACHE
2019-06-27 18:29:55 +10:00