Commit graph

362 commits

Author SHA1 Message Date
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
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
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
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
elelel
be34e323e5 Fix indexing into an empty array
Signed-off-by: elelel <elelel@3wh.net>
2021-10-18 18:10:59 +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
Kent McLeod
3defbff461 Remove KZM/imx31 platform
The platform was the original verification target of seL4 over 10 years
ago and by now there doesn't appear to be any ways to obtain new
hardware.

Currently, the KZM platform is the only ARMv6 platform and supporting it
requires a few work-arounds for emulating mechanisms that newer hardware
supports. Removing this platform also implies removing armv6 support
soon.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-09-30 18:07:19 +10:00
Axel Heider
77fb21aa90 python: add __str__() for Region
- Provide a nicer string for debugging purposes.
- improve comments about the purpose of __repr__() and __str__()

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-09-27 23:09:24 +10:00
Axel Heider
7d7a404bff python: raise exceptions on errors
- A region can't be created from an invalid range
- A region might be too small to support the change. There is no trivial
  way to fix this.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-09-27 20:49:56 +10:00
Axel Heider
14314983a6 risc-v: clarify PLIC is for SiFive U54/U74
RISC-V defines the concept of a PLIC, but leaves the details open. The
driver is for the PLIC of the SiFive U54/U74 SOC, which is used on
the HiFive Unleashed/Unmatched and Polarfire board.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-09-26 11:31:51 +10:00
Bertrand Virfollet
b32b9568b2 tools: merge adjacent memory regions
Merge memory regions before checking for reserved areas

Co-authored-by: Gerwin Klein <gerwin.klein@proofcraft.systems>

Signed-off-by: Bertrand Virfollet <bvirfollet@silicom.fr>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-08 07:53:53 +10:00
Alexander Fasching
560f215489
tools: Fix regex for ignore pattern (#535)
Signed-off-by: Alexander Fasching <fasching.a91@gmail.com>
2021-09-03 12:54:17 +10:00
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
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
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
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
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
Kent McLeod
379bf5abe3 hardware_gen.py: Address some warning messages
CMake treats any text output that is generated by tools during the
configuration phase as important if it isn't part of a message(STATUS)
command. Output generated by hardware_gen.py often shows up as warnings
about device tree properties that are usually uninformative. Resolving
some of the warning conditions removes these messages for most
platforms.

- Setting kernel_size in hardware.yml to 0x1000 to handle cases where
  the kernel only needs the first page of a device that has a
  device-tree definition larger than that.
- Remove status print about each Interrupt processed as it's usually not
  useful information.
- Only process IRQs for a selected kernel device if the rule for that
  device has any interrupt queries. This prevents warnings for IRQ
  controllers that the script doesn't know how to process when it
  doesn't need to.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-07-29 16:03:01 +10:00
Curtis Millar
76b1de0670 Add ODroid C4 support
This adds support for the ODroidC4. The ODroidC4 is just a beefier
ODroidC2 with some bits moved around. The devices we care about here are
all essentially the same except the cores are A55s instead of A53s.

Signed-off-by: Curtis Millar <curtis@curtism.me>
2021-07-09 14:05:05 +10:00
Axel Heider
ad4ea6cd08 CMake: unify config options define generation
Add disabled options from the build system as comments in the generated
header files.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-07-01 12:05:37 +10:00
Axel Heider
d1fb5c01a7 use '#pragma once' include guards
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-06-20 11:53:58 +10:00
Axel Heider
9a4d3ae51d CMake/autoconf: remove unused AUTOCONF_INCLUDED
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-06-09 09:50:02 +10:00
Ben Leslie
7dc6dffa0f Add support for iMX LP UART
Add support the i.MX low-power UART. This is available on
chipsets such as i.MX8QXP.

Note: This is a preliminary patch in advance of providing
full support for the i.MX8QXP platform.

Note: getchar is not implemented (current) for this platform.

Signed-off-by: Ben Leslie <benno@brkawy.com>
2021-06-02 11:43:48 +10:00
Axel Heider
d486bc0b5a Add i.MX6 Nitrogen6_SoloX board
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
2021-03-31 13:38:25 +10:00
Lukas Graber
2a0e5a2a1f Bring Raspberry Pi 4 (RPi4) support
Signed-off-by: Lukas Graber <lukas.graber@hensoldt-cyber.de>
2021-03-22 11:41:03 +11:00
Alistair Francis
0972c4e9a9 RISC-V: Replace mentions of BBL with OpenSBI
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2021-03-09 11:20:57 +11:00
Axel Heider
0a6e04769e autoconf: use "#pragma once" include guard
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-06 02:24:41 +01:00
Damon Lee
05222c2288 exynos5: Update device definitions
The max IRQ and devicetree definitions are slightly outdated. This
commit updates these definitions.

Signed-off-by: Damon Lee <Damon.Lee@data61.csiro.au>
2021-03-05 15:04:41 +11:00
Axel Heider
a5c2d51386 CMake: add include guard to auto-generated files
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-03 11:49:07 +01:00
Axel Heider
36ebac4fb4 trivial: fix typo in comment
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-03 11:47:23 +01:00
Axel Heider
f46df2ad6d CMake: remove unused macros
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-02-01 18:44:20 +01:00
Axel Heider
651fb65017 CMake: inline set_kernel_32() and set_kernel_64()
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-02-01 18:23:42 +01:00
Gerwin Klein
b5e48eb787 bitfield_gen: prep for Isabelle2021
Isabelle2021 sometimes gets further with mask_simps, so this commit
makes them optional. Also removes a duplicate simp-rule warning.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-01-24 18:42:27 +11:00
Damon Lee
2d9881065b zynqmp: Remove duplicate interrupt entries
There are duplicate interrupts in some of the devices in the devicetree.
This commit removes these duplicate interrupt entries to avoid errors
with some of our tools (CAmkES, etc).

Signed-off-by: Damon Lee <Damon.Lee@data61.csiro.au>
2021-01-22 16:02:53 +11:00
Curtis Millar
ab3d8c44cb
riscv: Map devices with large pages on 32 & 64-bit
For 64-bit, this adds a 2nd-level page table for mapping devices using
2MiB frames instead of 1GiB frames.

The boot mapping and hardware header generator have also been fixed to
correctly report the number of large frames needed for devices rather
than only reporting the first. The frame size is also specified
correctly (rather than assuming mapping with 4KiB frames).

This likely fixes an issue whereby only the first 4KiB frame of a device
was reserved but the remaining region of that kernel device could be
mapped at user level.

Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
2020-12-03 10:31:16 +11:00
Nils Wistoff
cd96ee330f ariane: update PLIC and dts
add PLIC driver for Ariane and update dts

Signed-off-by: Nils Wistoff <nwistoff@iis.ee.ethz.ch>
Reviewed-by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2020-11-16 11:43:28 +11:00
Oliver Scott
73b0773d90 tk1-smmu: corrections
Fix tk1 smmu cmake config variables.
Fix platforn_gen for tk1.
Add separate hardware.yml for tk1.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-11-06 15:21:25 +11:00
Qian Ge
1a9756f65b SMMU: basic driver for init and probing
Introducing the driver in kernel for detecting SMMU features
and initialise the hardware.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Gerwin Klein
4fd7cb0360 unify license tags
The tags now all conform to REUSE version 3.0

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-28 16:03:11 +11:00
Jesse Millwood
b77c9b2051 PolarFire SoC: Initial support for platform
Signed-off-by: Jesse Millwood <jesse.millwood@dornerworks.com>
2020-10-28 08:33:05 +10:00
Stefan O'Rear
a91e979c5a clang: Fix errors on zero kernel devices
"const TYPE *ptr" creates a non-const pointer to const data; for the
pointer itself to be rodata requires "TYPE *const ptr".

Taking the size of the pointer is caught by -Werror by default; suppress
that.

Signed-off-by: Stefan O'Rear <sorear@fastmail.com>
2020-08-26 14:21:35 +10:00
Matthew Brecknell
5362c6b26a bitfield_gen: update proofs to support RISC-V MCS
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-12 16:31:13 +10:00
Matthew Brecknell
a09d6f023a bitfield_gen: emit fields in visible order
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-12 16:31:13 +10:00
Edward Pierzchalski
4c0f16c7b8 bitfield_gen: fixups for MCS
Changes the 'size suffix map' to be useful in more places. In general,
when we use the 'short name' of a variable in these generated proofs, we
run the risk of a change in variable declaration order breaking the
resulting proofs (since declaration order is how the C parser chooses
which variables get the short name). Best practice is to use the long
names whenever possible.

Uses the suffix map for some generated proofs.

Removes an unnecessary simp step.

Signed-off-by: Edward Pierzchalski <ed.pierzchalski@data61.csiro.au>
2020-07-28 17:49:19 +10:00
Matthew Fernandez
cf1428630e tools: BSD compat for changed.sh
On e.g. FreeBSD, Bash lives at /usr/local/bin/bash. This change
makes the script find Bash wherever it may be hiding.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-18 12:39:46 +10:00
Axel Heider
fb71ef926a tools: fix brackets in format parameters
Signed-off-by: Axel Heider <axelheider@gmx.de>
2020-06-02 23:41:15 +02:00
Gerwin Klein
f16411a518 review Linux-derived dts file license
These files are derived from the output of the device tree compiler in
the Linux kernel. The licenses of the input files do all have to be
compatible with at least GPL-2.0-only to be part of Linux.
2020-03-09 17:59:07 +08:00
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
Siwei Zhuang
8b4ed9941a RISCV: Add Hifive unleashed platform
This change adds support for Hifive unleashed board. It also removes the
outdated hifive suport from the spike platform.
2019-06-26 15:11:47 +10:00
Siwei Zhuang
efda335b8c RISCV: Add DTS for 32bit spike platform
There is a different DTS file for 32bit spike platform.
2019-06-26 11:38:08 +10:00
Siwei Zhuang
375a98c8b3 CMake: Generate device headers from DTS for spike
The DTS compilation was arm platforms only. Moving it to the top level
config file, making it available to RISCV platforms. The generated files
are almost identical with minor differences. A new argument(--arch) is
added to the hardware_gen.py for the differences.
2019-06-26 11:38:08 +10:00
James Ye
ff418649c1 am335x: add BeagleBone Blue support
BeagleBone Blue is a BeagleBone variant aimed at robotics applications.
Device Tree generated from Linux 4.20.17
2019-06-24 11:28:20 +10:00
James Ye
b7950aa332 tools/dts: use correct dts for am335x-boneblack
Device Tree generated from Linux 4.20.17
2019-06-24 11:28:20 +10:00
James Ye
33fd7b0423 Rename am335x to am335x-boneblack
There are other am335x boards which require different platform
configurations, such as the BeagleBone Blue.
2019-06-24 11:28:20 +10:00
Kent McLeod
664ac2288c python,sel4-deps: Pin versions for style tools
These tools sometimes style differently across different versions.
2019-06-18 15:33:36 +10:00
cvluca
24131333ac trivial: disable YAML loading warning
Use of PyYAML's yaml.load function without specifying the Loader=...
parameter, has been deprecated.
2019-06-14 10:17:10 +10:00
Anna Lyons
28c3dfe187 hardware_gen.py: Add YAML output support
We need other tools to be able to gather information about the kernel
memory reservation areas and device memory regions.  Add mandatory
parameter --yaml for specifying the name of the output file to receive
this information.  Write it.

Committed by G. Branden Robinson <Branden.Robinson@data61.csiro.au>.
2019-05-14 15:37:52 +10:00
G. Branden Robinson
d3446bc534 hardware_gen.py: List required paramaters first
In the usage message, identify all the required parameters before the
optional ones.
2019-05-14 15:37:52 +10:00
G. Branden Robinson
2ee6496af3 hardware_gen.py: Defer module import attempt
Move module imports that are not absolutely required into a function
instead of at the top level so that we don't spew the diagnostic message
in scenarios like `--help` or usage errors.
2019-05-14 15:37:52 +10:00
G. Branden Robinson
8d0950ff4f hardware_gen.py: Give tool a description
Nothing said what this tool actually _does_.
2019-05-14 15:37:52 +10:00
Kent McLeod
3707f65c6f CMake: Refactor DTS compilation step in CMake
- Minimise calls to external_process as this is more expensive than
using built-in CMake file operations.
- Update check_outfile_stale to also save the list of files it checks
for stale checks so if a config changes the list of files then the
output file will still be stale even if the input list of files are
older than it.
2019-05-07 10:15:54 +10:00
Kent McLeod
9db06db088 CMake: Remove unused cmake module import
While some functionality in helpers.cmake is based on
CMakeDependentOption, this module isn't actually used.
2019-05-07 10:00:08 +10:00
Kent McLeod
c75a270f56 hardware_gen.py: memoize should_parse_regions
should_parse_regions performs a lot of repeated recursive calls on
immutable inputs. Memoizing it to cache previous calls leads
to a noticible reduction in execution time.
2019-04-23 09:16:09 +10:00
James Ye
a16cc57e21 Add Odroid-C2 support
Add support for the Hardkernel Odroid-C2 board.

Co-Authored-By: Anna Lyons <Anna.Lyons@data61.csiro.au>
2019-04-18 11:14:17 +10:00
Anna Lyons
fa60ebabc6 tools: add autopep8 dependency 2019-03-27 10:50:26 +11:00
Anna Lyons
cf57914c7f style: run autopep8 on python files 2019-03-27 10:43:58 +11:00
Anna Lyons
305b5f9c3d tools: add guardonce python dependency 2019-03-25 16:02:51 +11:00
Luke Mondy
715e595193 Fix cmake-format dep name 2019-03-22 14:38:04 +11:00
Anna Lyons
ffa9fda8f0 style: use consistent styling for all cmake files
Add .cmake-format.yaml which defines custom functions with kwargs to
style nicely
2019-03-22 11:52:06 +11:00
Anna Lyons
86ed25b8c0 cmake: use snake_case for RegisterDriver & CPPFile
Our upcoming cmake styling tool requires any custom functions you want
styled nicely to be lower case. We only need to style these two nicely,
as they have kwargs we would like aligned.
2019-03-22 11:50:04 +11:00
Anna Lyons
dad3b8ba56 python-deps: add cmake-style 2019-03-22 11:47:07 +11:00
Kofi Doku Atuah
16f55f8e4b Device-generation: Add __ASSEMBLER__ guards 2019-03-21 12:31:25 +11:00
Anna Lyons
76267c410e Remove kernel_astyle.sh
Instead style.sh from seL4_tools should be used
2019-03-19 14:02:29 +11:00
Kent McLeod
0cc4997a16 cmake: add check_outfile_stale macro
This checks if a file is older than other files during CMake configure
phase. This is to prevent unnecessary long running execute_process
calls.
2019-03-12 08:55:05 +11:00
Kent McLeod
b7550ca830 hardware_gen.py: Write compat strings to file
This reduces chances of other parts of the script printing to stdout and
allows the compatibility strings file to be inspected or manually
changed for debugging purposes.
2019-03-12 08:55:05 +11:00
Adam Felizzi
e3c7e391c1 hardware_gen: Use logging.warning for import error
Updated YAML validation error message to use logging.warning,
forwarding the output to stderr. This would otherwise end up
in the CMake dts compatibility string.
2019-03-08 16:11:39 +11:00
Oliver Scott
96c63a4b55 serial-refactor: Fixed circular includes
Modify hardware_gen script to only include chosen
serial path. Added newlines to serial drivers to fix
concat issues when compiling. Move cmake macro RegisterDriver
 up a level to support timer refactor. Modify arm cmake to reflect
this.
2019-03-08 10:51:01 +11:00
Kent McLeod
2943f042a7 hardware_gen: Remove build path from output file
This was causing errors with a reproducible build check in the binary
verification toolchains.
2019-03-07 16:11:31 +11:00
Oliver Scott
34ce52e283 serial-refactor: Refactor kernel serial drivers
Have added a drivers/serial folder to kernel, where all serial drivers
will be kept. The point is to have the the dts parsed and generate cmake
to include the right uart.c file prefixed with the compatibility.
Have removed all io.c from plat and includes from plat/config.cmake and
updated CHANGES file.
2019-02-21 16:11:37 +11:00
Simon Shields
ca53350a71 hardware_gen: Add support for /reserved-memory node
Parse the /reserved-memory node per the Linux spec[1].
Ignore regions marked as 'no-map', but keep other regions
as they should be OK to use as RAM.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt?h=v5.0-rc6
2019-02-15 14:05:06 +11:00
Simon Shields
16d98d852f hardware_gen: use full node path in dictionaries
it's not guaranteed that node names will be globally unique,
so use the full path to the node instead.
2019-02-15 14:05:06 +11:00
Simon Shields
cbe6e4c651 hardware_gen: include linker.h in generated header
this is needed for the BOOT_RODATA attribute
2019-02-15 14:05:06 +11:00
Yanyan Shen
f7749ed54c dts: Add Arm FVP device tree file.
This file is based on foundation-v8-gicv3.dts.
2019-02-13 17:16:42 +11:00
Yanyan Shen
8f433d7dbc hardware_gen: Add GICv3 support. 2019-02-13 16:09:53 +11:00
Simon Shields
e9fc74b5a2 hardware_gen: support specifying size of kernel device
This allows for mapping of consecutive pages for a single device in the
kernel.
2019-02-13 11:13:05 +11:00
Simon Shields
21993d8bbc hardware_gen: generate kernel_devices
This change fixes support for instances where we have
multiple kernel devices in the same page, or kernel devices
which aren't at page-aligned addresses.

Also use seL4_UserTop to pick the right address to start
putting the kernel device pages.
2019-02-05 14:58:17 +11:00
Simon Shields
b45de78546 hardware_gen: use "ranges" property for cpu-addressable buses
This removes the need for the buses array in the hardware YAML
2019-02-05 12:14:28 +11:00
Simon Shields
d9b399ff27 hardware_gen: improve region-merging logic
Merge overlapping regions to ensure that we don't expose
the same paddr more than once.
2019-02-04 12:57:15 +11:00
Simon Shields
09e6fbb1c4 hardware_gen: don't merge regions that are conditional
If one region is conditional and another isn't, we shouldn't merge them.
This fixes a problem where some regions wouldn't be exposed to
userspace when they were merged with a conditional region which would
cause userspace apps to fail in unexpected ways.
2019-02-01 16:46:22 +11:00
Simon Shields
4269c70800 hardware_gen: simplify file handling logic
Argparse supports file arguments, use this for all files.
2019-01-31 11:44:42 +11:00
Simon Shields
4700696846 hardware_gen: fix python3 support
This commit stops using FdtNodes as dict keys, as those aren't hashable
with python3. It also opens the DTB in binary mode to prevent decoding
errors under python3.
2019-01-31 11:44:38 +11:00
Anna Lyons
fe67d88c57 Update pydeps version
This is due to the new dependency, pyfdt
2019-01-29 17:10:29 +11:00