Commit graph

362 commits

Author SHA1 Message Date
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
Simon Shields
c37d137705 python deps: add pyfdt 2019-01-29 12:30:52 +11:00
Simon Shields
8440f0339a hardware_gen: pull interrupts from DTS
This adds support for extracting interrupt numbers from DTS
to the hardware header file generator, so that the majority
of the per-platform interrupt listings can be removed.
2019-01-16 14:46:08 +11:00
Simon Shields
0ac0792339 arm: generate memory region tables from dts
This change adds infrastructure to automatically generate the
physBase macro, the avail_p_regs array, and the dev_p_regs array
based on a device tree. Platforms can opt-in to using this
by adding DTS files to the KernelDTSList variable.

The Python script uses the hardware.yml file to determine which
devices in the device tree are of interest to the kernel and should
be hidden from userspace and instead mapped into the kernel. Note that
currently the kernel mappings are not (yet) generated, however most
of the infrastructure needed to make that happen is present.
2019-01-16 14:38:25 +11:00
Simon Shields
463c1cc211 python deps: add jsonschema
This will be used to validate the kernel's hardware configuration file
against a schema.
2019-01-16 14:37:35 +11:00
Simon Shields
328a021686 Move DTS to the kernel
Move DTS to the kernel in preparation for using them to autogenerate
hardware headers.

This includes DTS that we didn't have previously, extracted from the
Linux kernel. Everything except TX2 comes from Linux v4.20, extracted
with the following commands:

checkout https://github.com/torvalds/linux.git v4.20
./update-dts.sh /path/to/linux/checkout

The TX2 dts is identical to the one that was found in seL4_tools.
2019-01-16 14:34:16 +11:00
Anna Lyons
eceefa883d cmake: add kernel platform helpers.
Add kernel_platforms_string and kernel_platforms_list to tools/helpers.cmake.
kernel_platforms_string: concatenates all platform strings together into a
newline separated string.
kernel_platforms_list: returns a list of all kernel platforms.
2018-12-10 16:36:22 +11:00
Edward Pierzchalski
1283345bfd bitfield_gen: merge clarsimp/simp in generated proofs
The old generated proofs would fail if a simp set change made
`clarsimp` discharge what `simp` simplified.
2018-10-02 14:41:21 +10:00
Anna Lyons
4e910ebfbb python deps: add seL4 tutorial deps 2018-09-14 17:08:05 +10:00
Kent McLeod
02c9895f66 CMake: Add missing dependency to CPPFile function 2018-09-03 11:11:51 +10:00
Adam Felizzi
43b7bca872 CMake: CPPFile EXACT_NAME creates a temp copy
Modified the behaviour of the EXACT_INPUT option within the
CPPFile helper function. Now named EXACT_NAME, the option
copies the input file to a temporary file. The name of the
temporary file is also passed in by the caller. This
step in necessary in getting the CPP step to correctly
depend on the targets given by the caller
(through EXTRA_DEPS). Also updated the CPP generation of the
kernel_all.i file to reflect the change.
2018-08-27 10:18:10 +10:00
Adam Felizzi
2bf255c8a3 tools: Ignore option for circular_includes script
Added an "ignore" argument to the circular_includes script. This
allows the caller to specify files for the script to ignore when
it parses the source file. Rather than creating a special
ignore case for "kernel_all.c" in the script itself, the user
parses the file as an argument (plus others if needed). Updated
the kernels cmake file to reflect the change.
2018-08-27 10:18:10 +10:00
Kent McLeod
880686dd22 bitfield_gen: Improve prune list generation time
Previously this would create a very big regex to parse the input
sources. This didn't scale as well on architectures with more bitfield
objects
2018-08-24 16:57:31 +10:00
Adam Felizzi
a9fe71ea8d tools: Added astyle,pylint and xmllint checks
Added small bash scripts to run astyle, pylint and xmllint
checks over the kernel source. These style checks were ported
from the old Make build system.
2018-08-10 10:38:53 +10:00
Kent McLeod
639b7fbd37 CMake: Add get_absolute_list_source_or_binary
This function checks CMAKE_CURRENT_LIST_DIR and then calls
get_absolute_source_or_binary if the file wasn't found
2018-07-24 15:00:21 +10:00
Adrian Danis
1dd8015da2 tools: State jinja2 version
Provides a graceful error when jinja2 is the wrong version
2018-06-21 14:38:55 +10:00
Kent McLeod
41a4c424f6 Update sel4-deps for tempite->jinja2 2018-06-13 16:01:27 +10:00
Kent McLeod
e281a47b7c Remove references to unused tempita library 2018-06-13 15:43:48 +10:00
Kent McLeod
66149498ff tools: Correct syscall numbers 2018-06-13 10:43:42 +10:00
Kent McLeod
187445000e tools: Fix whitespace differences in header gen 2018-06-13 10:42:35 +10:00
Summer Li
004891f410 libsel4: change tempita to jinja2 2018-06-12 16:54:25 +10:00
Summer Li
992534d87d libsel4: follow style conventions in python scripts
This commit makes some constant variables upper case to follow the style guide.
2018-06-12 16:24:16 +10:00
Corey Lewis
b50c6a86df cmake: Use ABSOLUTE instead of REALPATH
REALPATH was unnecessary and results in resolving symlinks in the target, although
the working directory will not have its symlink resolved. This results in very strange
paths from the base directory (which is the working directory) to the target.
2018-04-04 15:51:45 +10:00
Adrian Danis
ccac858da8 cmake: Remove GenCPPCommand
This helper was ugly when written and simply should not be used over the CPPFile helper.
2018-02-22 14:51:48 +11:00
Adrian Danis
a19a2b3b8d cmake: CPPFile New helper for just pre-processing files
This is a new version of GenCPPCommand that uses an OBJECT library intermediate to get
cmake to do 'arbitrary' compilation (by adding the -E flag) where the result does not
need to be linkable. The advantage of this over the GenCPPCommand version is there is
no need for trying to manually invoke GCC with all the correct arguments lists.
2018-02-22 14:51:48 +11:00
Adrian Danis
118a7869f4 cmake: get_absolute_source_or_binary is a function
As a macro this helper would not operate as expected if output and input were defined
as the same variable. Making a function and explicitly writing into the PARENT_SCOPE
fixes this and also makes the code simpler
2018-02-22 14:51:48 +11:00
Adrian Danis
4b8a3e24d2 config: Reset options to default when enabled
This change makes values take on more intuitive and expected defaults when gradually
configuring the kernel, either programatically or through the graphic interfaces
2018-02-07 11:49:28 +11:00
Kent McLeod
33192cd8ae cmake config_choice: save options in cache var
This is to make it possible to enumerate all config options instead of
just the 'valid' ones that are saved as the STRINGS property.
2018-02-01 15:11:43 +11:00
Matthew Brecknell
fe955b5ba3 Improve generated bitfield proofs
For bitfields requiring sign extension, the generated specs are nicer to
work with in proofs. The proofs also support an updated `sign_extend`
specification (in the l4v repository) which has nicer properties.

This change also speeds up some bitfield proofs.
2017-12-21 18:01:55 +11:00
Adrian Danis
9a89cbe4c6 cmake: TOPLEVELTYPES declared as target property
TOPLEVELTYPES is not intended to be configurable by the user, rather is a reflection
on the types defined by the source. This changes the TOPLEVELTYPES argument to be
a property, allowing it to be constructed as a generator expression when generating
BF files. By being a property, and not something like a global property, it removes
the need to ensure that additions to TOPLEVELTYPES are done prior to any bitfield
target definitions.
2017-11-15 17:33:13 +11:00
Adrian Danis
a2c8462efb cmake: Expand lists in BF generation
Uses the COMMAND_EXPAND_LISTS flag to allow for generator expressions in parameters
to GenBFCommand. As lists are now being expanded the 'args' variable must also be
quoted.
2017-11-15 17:33:13 +11:00
Adrian Danis
aa3fc06c79 cmake: Make variables show up if previously hidden
Previously if a variable had unmet dependencies and had been hidden, by being made
an internal variable, it would not have been unhidden by the use of `option`. This
emulates the behaviour of `option` that we were wanting, but additionally using `FORCE`
to override the `INTERNAL` setting
2017-11-03 16:39:45 +11:00
Adrian Danis
24a69963e7 cmake: Directly generate configuration files
Uses file(GENERATE) to directly create the contents of generated configuration files instead of
awkwardly using custom commands to echo the contents of multi line strings into files.
2017-11-03 13:49:37 +11:00
Adrian Danis
89fb678db8 cmake: Invoke compilations without echo and xargs
Newer versions of cmake provide a COMMAND_EXPAND_LISTS option that allows a quoted string,
such as "a;b" to be given to a COMMAND parameter and have it expand into multiple arguments.
Using this we can much more nicely generate some of our COMMAND invocations, at the cost of
requiring a more recent cmake version
2017-11-03 13:49:37 +11:00
Gerwin Klein
38cc67e821 slightly more Mac friendly cmake commands
Mac has BSD sed, not GNU sed; tr seems to be more portable.
2017-11-02 13:39:13 +11:00
Adrian Danis
3a48b9fa33 cmake: Unset CACHE variables from the CACHE
These variables were meant to be removed from the cache
2017-10-27 14:13:31 +11:00
Adrian Danis
777f19645b cmake: Correctly set options to their DEFAULT_DISABLED values
The config_option helper was previously using cmake_dependent_option, which supposedly took
a value to set the option to in the case where it was disabled. However, this only sets
the value in the current function context, and not the cache. I do not understand why this
is the case and it seems to make that functionality completely useless. This commit simply
does the dependency checking itself and correctly sets the disabled value.
2017-10-27 14:13:05 +11:00
Gerwin Klein
960881d07e tools bitfield_gen: proof updates for new base + sign-extension mechanism 2017-09-20 22:01:13 +10:00
Gerwin Klein
3b330f9a6a tools bitfield_gen: use hex literals in proofs and specs 2017-09-20 22:01:13 +10:00
Gerwin Klein
38ba9e405b tools bitfield_gen: simplify theory imports; conform to style 2017-09-20 22:01:13 +10:00
Gerwin Klein
0a99d7d4d8 tools bitfield_gen: remove obsolete mask comments
(These masks existed in earlier versions of the bitfield proofs, removed
because the statements were stronger without them.)
2017-09-20 22:01:13 +10:00
Gerwin Klein
c57ea38874 tools bitfield_gen: use generic base instead of word32 in proofs 2017-09-20 22:01:13 +10:00
Adrian Danis
eac4f6bfa2 proof: Defer theory dependencies to isabelle
Instead of explicitly depending on Kernel_C.thy prior to generating proofs, this removes
the dependency check and leaves isabelle to check the dependency upon import.
2017-09-20 14:22:14 +10:00
Anna Lyons
982ad7b2a7 Add missing license to tools/python-deps/README.rst 2017-08-28 17:10:51 +10:00
Adrian Danis
0b73072016 Add a CMake based build system
This commit adds an alternate build system using CMake that operates indepenently of
the existing Kconfig+Kbuild+make based build system
2017-08-22 13:56:26 +10:00
Anna Lyons
64cf2308ac tools: fix licenses 2017-06-22 15:27:30 +10:00
Anna Lyons
07f948331f libsel4: fix licenses
- some were incorrectly marked GPL (libsel4 is BSD)
- update NICTA --> DATA61 etc
- fix tags D61 --> DATA61
- update year to 2017
2017-06-22 15:27:29 +10:00
Matthew Brecknell
943f1ab0ba bitfield_gen: generate more efficient *_new and *_ptr_new functions
For blocks and unions, generate only one write for each word, rather
than an update for each bitfield.

For verification, this speeds up some automatically generated proofs.
2017-06-21 17:47:04 +10:00
Anna Lyons
e98bf73f0b python-deps: add bs4 2017-06-19 13:59:08 +10:00
Stephen Sherratt
7333e97c65 Add pip metapackage for downloading dependencies
Dependencies can now be downloaded with:
pip install sel4-deps

Dependencies can be changed by modifying the setup.py script.

Information on how to update the package is in the setup.py script.

JIRA: SELFOUR-909
2017-06-05 15:52:25 +10:00
Stephen Sherratt
dd352a1ae9 Python3 compatibility in scripts 2017-06-05 14:07:20 +10:00
Stephen Sherratt
2b5e1328c8 style: Add pylintrc with whitelisted lxml module
The lxml module relies on native libraries. When linting, pylint will
not load native libraries for security reasons. Thus, it can't find some
symbols exported by lxml, causing linting to fail. Whitelisting lxml
prevents this.
2017-06-05 13:43:14 +10:00
Adrian Danis
3679b88309 tools: Make circular_includes check more robust
Allows for an arbitrary path to be applied to kernel_all.c in case the build is not
happening in the current working directory
2017-06-01 14:22:56 +10:00
Luke Mondy
85a0e441e7 By not writing a parse.py table, we avoid the parallel build issue of corrupted parse.py files 2017-05-08 10:30:07 +10:00
Stephen Sherratt
8c93b71c1c Import reduce from functools in python scripts 2017-02-22 12:19:58 +11:00
Adrian Danis
4bfa5bb979 tools: Correct case where label numbers will be 0
If `seL4_arch_invocations` is an empty list, this will cause `nSeL4ArchInvocationLabels`
to be declared as 0, rather than `nInvocationLabels` as intented. This change correctly
respects the behaviour of the 'first' variable, and does an explicit assignment to
`nSeL4ArchInvocationLabels` should it be the first (and only) member of the enum.

Closes #53
2017-01-04 10:40:25 +11:00
Jeff Waugh
803dd5c2ae libsel4: Optional public symbols for external interfaces
CONFIG_LIB_SEL4_PUBLIC_SYMBOLS=y will disable inlining for external
interfaces (except deprecated functions), thereby providing public
symbols for easy linkage with other languages.
2016-12-06 18:08:39 +11:00
Stephen Sherratt
79610f4c2b Bitfields generated with ply rather than yacc 2016-11-30 16:09:06 +11:00
Thomas Sewell
13ad834ace Generated bitfield proofs: use hrs_mem_update.
This is a technical change to the proof mode of the bitfield
generator included in the seL4 source.

The postconditions of the generated specifications of the
*_ptr_set and *_ptr_new functions now describe the entire new
heap via (new_heap = hrs_mem_update (...) old_heap).
Previously they described the contents of various projections
of the heap, which is less precise.
2016-11-01 16:18:02 +11:00
Stephen Sherratt
71d02cbf4c Replace circular includes perl script with python 2016-10-24 10:53:36 +11:00
Adrian Danis
2bdc2941be Check for circular includes
Adds a tool that checks for pre-process kernel_all.c_pp for any
circular include chains, and runs this as part of the kernel
compilation process
2016-10-21 12:05:03 +11:00
Hesham Almatary
2ab27839a1 Debug: avoid syscall_names unsued Werror when debug mode is enabled 2016-10-20 09:06:57 +11:00
Anna Lyons
3a185a5c32 debug: generate list of syscall names 2016-10-18 14:05:41 +11:00
amrzar
ee75f086f3 update #ifdef to #if in auto generated files 2016-10-17 12:18:58 +11:00
Japheth Lim
c517dba449 bitfield_gen: write output files atomically 2016-06-19 21:32:49 +10:00
Adrian Danis
cf8be6639f tools: Remove arithmetic in invocation generation
If invocations are hidden behind config guards the count of how
many invocations there are will be wrong. The C compiler will
correctly assign the value with enum auto numbering, so there's
no need to override that here
2016-06-16 15:36:00 +10:00
Anna Lyons
9fca296f8a tools: emit error if first invocation conditional
Placing a config condition on the first define
in sel4arch.xml will fail as currently the first define
must start at the last define + 1 of the previous
invocation enum.

If this is ever required, autoconf.h will need to be passed
to the script so it can check config variables itself.
2016-06-16 10:43:56 +10:00
Anna Lyons
73837c8ace tools: add conditional invocation label defines 2016-06-16 10:38:29 +10:00
Matthew Fernandez
7a9b81d237 Revert "bf gen: Add a backend for AutoCorres."
This reverts commit 5ee3971563. This backend was
previously used in an experiment towards libsel4 verification. That project has
since adopted a different strategy and this backend is now unused. Meanwhile
the backend has lagged behind breaking changes to AutoCorres. This commit
removes the backend to avoid confusion from users who believe it to be
functional.
2016-06-06 16:55:41 +10:00
Thomas Sewell
bea92de3b9 Verification: adjust use of new bf proof features.
Apologies, some final adjustments got lost in the previous pull
request round. This version actually works.
2016-03-21 18:14:40 +11:00
Thomas Sewell
13715658aa Verification: bf: use new proof features.
The plan here is to move some of the proof script complexity embedded
in the text of the bitfield_gen utility into generic proof helpers in the
l4v repository that bitfield_gen can use more modularly. This is a simple
first step.
2016-03-21 10:45:41 +11:00
Corey Richardson
4b043d767f
tools: syscall_header_gen: print an error to stderr that wasn't 2016-01-25 15:56:34 +11:00
Corey Richardson
41d98e45c0
tools: bitfield_gen: use six to access range (py3) or xrange (py2) 2016-01-25 15:56:33 +11:00
Corey Richardson
8ab5e037d5
tools: bitfield_gen: use itertools.chain instead of concatenating lists
This isn't efficient in Python, and moreover in python3 these methods
return iterables, not lists.
2016-01-25 15:56:33 +11:00
Corey Richardson
486aefc266
tools: bitfield_gen: use integral (//) instead of duck-typed division (/) 2016-01-25 15:56:32 +11:00
Corey Richardson
6ad2273005
tools: bitfield_gen: iterable->list for optparse 2016-01-25 15:56:31 +11:00
Corey Richardson
22a1c15aa9
tools: bitfield_gen: use '... in ...' instead of dict.has_key 2016-01-25 15:56:30 +11:00
Corey Richardson
424e74e83a
tools: bitfield_gen: use print_function 2016-01-25 15:56:18 +11:00
Corey Richardson
703dcaca32
tools: bitfield_gen: remove trailing whitespace 2016-01-25 15:56:16 +11:00
Corey Richardson
141290eb48
tools: yacc: fix broken python3 compatability hack
This module seems to be extracted from a larger package that expects
some structure to be in place that isn't here. Patch up the check
slightly to work here, and also maybe elsewhere?
2016-01-25 15:56:15 +11:00
Corey Richardson
d71b7ae5c6
tools: yacc: remove trailing whitespace 2016-01-25 15:56:15 +11:00
Corey Richardson
90ac09c23e
tools: syscall_header_gen: python3 compat 2016-01-25 15:54:41 +11:00
Corey Richardson
9fa4457a84
tools: syscall_header_gen: remove trailing whitespace 2016-01-25 15:54:40 +11:00
Corey Richardson
db3c54ec07
tools: bf_autocorres: python3 compat 2016-01-25 15:54:39 +11:00
Corey Richardson
36e8b1d494
tools: invocation_header_gen: python3 compat 2016-01-25 15:42:06 +11:00
Corey Richardson
1234892209
tools: invocation_header_gen: remove trailing whitespace 2016-01-25 15:42:05 +11:00
Corey Richardson
9d6edfa286
tools: umm: python3 compat 2016-01-25 15:42:04 +11:00
Corey Richardson
e8665db6d8
tools: umm: remove trailing whitespace 2016-01-25 15:42:03 +11:00
Adrian Danis
2dd0a4d5e1 libsel4: Explicitly generate number of invocation labels to handle case where there are no invocations 2016-01-13 14:08:22 +11:00
Adrian Danis
44a522dce2 libsel4: Generate libsel4 definitions from the current ARCH as well as the SEL4_ARCH 2016-01-08 10:16:30 +11:00
Anna Lyons
7758899844 SELFOUR-244: symlink duplicated files from libsel4 into kernel rather than duplicating them, remove sanity target as a result 2016-01-05 08:33:39 +11:00
Adrian Danis
0e3afb487b libsel4: use seL4_Word for object types and update the sanity script to match word_t to seL4_Word 2015-12-10 16:08:39 +11:00
Joel Beeren
94b0216258 conversion: fixed bitfield generator, clz spec 2015-12-10 10:45:22 +11:00
Adrian Danis
6474aceaf0 Change types from uint32_t->word_t to be 32/64bit agnostic 2015-12-10 10:45:18 +11:00
Adrian Danis
63ee2b127b Modify sanity script to be ignostic over the difference between
seL4_UintXX types and uintXX_t types
2015-12-02 15:37:42 +11:00
Anna Lyons
9f19b8668a Add a sanity check to make sure constants shared between kernel and user are the same 2015-12-02 15:37:42 +11:00
Adrian Danis
7d3622f098 bitfield: Correct assertions when using sign extended bases 2015-12-02 11:45:45 +11:00
Anna Lyons
259f0a47f9 Merge pull request #140 from ssherratt/features2
Added support for using multiple tracepoints at the same time.
2015-09-08 11:20:58 +10:00
Matthew Fernandez
47c1bee590 tools: Remove some unnecessary Python imports. 2015-09-04 15:58:44 +10:00
Stephen Sherratt
bea651d6c2 Config sections in syscall.xml files take a condition which is passed to #if. 2015-09-03 11:39:31 +10:00
Wink Saville
e653f8f65a Streamline libsel4 and remove its libc dependencies.
There are now separate libs for benchmark, assert, printf, putchar
start/stop:

      libs/libsel4benchmark
      libs/libsel4assert
      libs/libsel4printf
      libs/libsel4putchar
      libs/libsel4startstop

The primary changes are introducing sel4/sel4.h and removing std* types
plus porting assert and IO code from the kernel to libsel4assert,
libsel4printf, libsel4putchar.

This means the code within libsel4 and the newlibs do not overload any
typical libc entities. Instead the libraries use types like
seL4_Uint32 ... instead of uint32_t. And printf is now seL4_Printf and
assert is seL4_Assert ....

Finally, the only file modified that effects kernel code is
kernel/tools/bitfield_gen.py. It needed to be modified as it generates
files for both kernel and user space. And for user space the generated code
(types_gen.h) needed to use the new types and asserts. The changes should
not change what is generated for the kernel and I did a comparison of
kernel_final.{c|s} before and after my change and the only differences
were time stamps.

Bug: #15 Streamline kernel/libsel4 and remove its libc dependencies
2015-07-09 18:03:46 -07:00