Commit Graph

3093 Commits

Author SHA1 Message Date
Anna Lyons
7124449936 mcs: tickless scheduler implementation
This changes the budget/remaining fields in scheduling contexts
to contain timer ticks, not number of abstract sel4ticks.

seL4_SchedControl_Configure now takes microseconds, not ticks.

This commit is plat-independant - the platform and arch specific
timer code follows in later commits.
2019-08-22 11:22:34 +10:00
Anna Lyons
952134d1b8 mcs: Add a scheduling context object
This is the first part of the seL4 MCS. This commit:

    * adds a scheduling context object. Threads without scheduling
      context objects cannot be scheduled.
    * replaces tcbTimeSlice with the scheduling context object
    * adds seL4_SchedControl caps for each core
    * adds seL4_SchedControl_Configure which allows users to configure
      amount of ticks a scheduling context has, and set a core for the
      scheduling context.
    * adds seL4_SchedContext_Bind, Unbind and UnbindObject, which allows
      a tcb to be bound to a scheduling context.
2019-08-22 11:22:34 +10:00
Kent McLeod
caad010a09 CMake: Add KernelIsMCS option
This switches between master and mcs configurations.
This also adds a build system variable KernelPlatformSupportsMCS that
can be used to error on platforms that don't support MCS due to
unimplemented functionality.
2019-08-22 11:22:33 +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
69fa94e7f4 decodeRISCVPageTableInvocation align vaddr
For RISCVPageTableMap, decodeRISCVPageTableInvocation currently does not
check alignment of the user-provided vaddr. If it is not aligned, the
corresponding cap will end up with junk bits in its PTMappedAddress
field.
2019-08-14 15:46:46 +10:00
Kent McLeod
6a8336ee3d tk1: Add SMMU hardware device to overlay
This used to be added automatically but now needs to be explicitly
listed.
2019-08-14 14:45:12 +10:00
Kent McLeod
c8b81c28ba libsel4: Don't use userData for storing IPC buffer
userData is no longer needed to hold a reference to the IPC buffer. The
IPC buffer is now available as a thread local variable.
2019-08-13 15:31:11 +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
929dead3c3 CMake,fvp: Fix typos in FVP CMake config
- Use correct timer header file
- Use correct name for FVP target.
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
3576377b08 CMake: Use unambiguous Python 2 executable name
Use the specific executable name "python2" to distinguish it from
"python" on distributions that install Python 3 as "python".
2019-08-08 10:19:24 +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
G. Branden Robinson
9dc013a034 exynos5: tweak CMake for greppability
Introduce a variable to hold a long expression to prevent the code
styler from line-wrapping the declare_platform() statement.  We want to
keep that on one line so the `griddle` tool (or humans) can easily
`grep` a list of supported platforms.  As of 2019-08-07, this platform
is the only one requiring this workaround.
2019-08-07 16:52:42 +10:00
Edward Pierzchalski
4e06b4982f Add MCS-enabled "verified" kernel config
This allows MCS and non-MCS versions of the kernel to go through the L4V
build process.
2019-08-05 13:39:42 +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
Anna Lyons
d12481652b trivial: style fix 2019-07-30 16:49:53 +10:00
Anna Lyons
cafda66dd6 imx8m: add NUM_PPI
This allows SMP support for the imx8m.
2019-07-30 16:49:53 +10:00
Anna Lyons
6746428a9d arm,gicv3: implement setIRQTarget
This allows SPIs to be routed to different cores.
2019-07-30 16:49:53 +10:00
Anna Lyons
e4562cc2e9 arm,gicv3: implement ipi_send_target
This function enables ipis to be sent between cores.

Co-authored-by: Yanyan Shen <yanyan.shen@data61.csiro.au>
2019-07-30 16:49:53 +10:00
Anna Lyons
0f139e7f6e arm,gicv3: update to use virtual ppi irqs
This commit updates the gic_v3 driver to translate virtual irqs to
hardware irq numbers, which enables PPI support for SMP.
2019-07-30 16:49:53 +10:00
Anna Lyons
794aad98f1 arm,gicv3: consisent sgi/ppi checks
This commit brings the gic_v3 is_sgi and is_ppi checks in line with
gicv2 making the code more consistent.

It also removes unneccessary conditionals in the checks, as is_sgi is
always called before is_ppi so the lower bounds checks are not required.
2019-07-30 16:49:53 +10:00
Anna Lyons
0d3692ede9 arm,gicv3: use SPI_START
This removes a redundant constant to use one from the gic_common header.
2019-07-30 16:49:53 +10:00
Anna Lyons
32952cc390 arm,gic: move gic helpers to gic_common
In order to support gic_v3 SMP, move helpers from gic_v2.h to
gic_common.h
2019-07-30 16:49:53 +10:00
Anna Lyons
0b9aa61a56 arm,gic: refactor constants into gic_common.h
Move common definitions from gic_v2.h and gic_v3.h into gic_common.h
2019-07-30 16:49:53 +10:00
Anna Lyons
21888e6a95 aarch64: add missing dsb
Co-authored-by: Yanyan Shen <yanyan.shen@data61.csiro.au>
2019-07-30 16:09:09 +10:00
Anna Lyons
7d55e2174c arm: CONFIG_L1_CACHE_LINE_SIZE_BITS in cmake
Move definition of L1_CACHE_LINE_SIZE_BITS to cmake where it is set
according to the arm processor family.

This removes duplication in the hardware.h header files and makes adding
a new processor family require less lines changed.
2019-07-30 16:09:08 +10:00
Kent McLeod
7bc76e8275 gicv2: Don't translate irqInvalid into array index
This also adds a check that translating a core + irq doesn't result in
an index that is irqInvalid.
2019-07-29 13:33:02 +10:00
Kent McLeod
51ee24fd59 trivial, gic_v2: Use CURRENT_CPU_INDEX() 2019-07-29 13:00:08 +10:00
Kent McLeod
77b838dd4c arm, smp: Correctly transform irq index into ID
Under SMP configurations, getActiveIRQ doesn't directly return an IRQ
ID, but an encoding of the ID and core due to the existance of per core
interrupts. This fixes some remaining locations where the result is
still interpreted as an IRQ.
2019-07-29 12:59:57 +10:00
Kent McLeod
aee7d51682 arm,smp: setIRQState for each core timer
Setting the IRQState to IRQTimer for each per core timer prevents the
interrupts from getting masked the first time that they are received.
2019-07-25 16:56:50 +10:00
Kent McLeod
f38f5b386d CMake: Fix KernelArmPASizeBits* settings
Need to explicitly set these to either ON or OFF rather than simply
setting them.
2019-07-25 12:27:39 +10:00
Chris Guikema
4a37703c03 cortex-53: enable virtualization extensions
This is possible now that the kernel supports 40 bit PAs.
2019-07-25 10:30:48 +10:00
Anna Lyons
b1788e02d5 aarch64: add support for 40-bit PA
This commit adds support for using a 40-bit physical addresses in
aarch64-hyp mode.

40-bit PA support is implemented by using a 3-stage translation, with a
13 bit page upper directory as the vspace root. PageGlobalDirectories
are not used in this configuration.

To use 40-bit PAs, platforms should set KernelArmPASizeBits40 to ON.

Co-authored-by: Yanyan Shen <yanyan.shen@data61.csiro.au>
Co-authored-by: Chris Guikema <chris.guikema@dornerworks.com>
2019-07-25 10:30:45 +10:00
Anna Lyons
d1153fbed8 aarch64: abstract vspace in libsel4
Depending on the physical address range the top level translation table
may be a page upper directory or a page global directory. Rename in
libsel4 the invocations on top level structures to be on an
seL4_ARM_VSpace rather than an seL4_ARM_PageGlobalDirectory.
2019-07-25 09:59:17 +10:00
Anna Lyons
8af1aa77f6 aarch64: abstract vspace_root in vspace code
On aarch64-hyp the virtual address translation structure can differ
depending on the physical address range. This commit prepares to support
more than a single physical address range by removing the assumption
that the top-level structure in a vspace is a PGD, replacing it with the
concept of a vspace_root.

Specifically:
    - add and use macros to refer to vtable bitfield generator functions
    - use the existing vspace_root_t type rather than pgde_t
    - pull performASIDPoolInvocation into header
    - add and use VSPACE_PTR rather than PGDE_PTR
    - rename decodeARMVPageGlobalDirectoryInvocation to refer to VSpace
    - update comments/error messages
    - rename variables
2019-07-25 09:59:17 +10:00
Kent McLeod
e0887c9629 CMake: Set KernelArmPASizeBits* based on Arm CPU
The physical address range supported by each aarch64 platform is defined
by which Arm CPUs it has. We therefore configure KernelArmPASizeBits*
based on which CPU is selected.
2019-07-25 09:25:22 +10:00
Anna Lyons
dfd8641c85 aarch64-hyp: check PA and granule sizes
Check that the configured physical address range is supported by the
processor and that the granule size (4KiB) is supported.
2019-07-25 09:19:34 +10:00
Chris Guikema
86a22fd343 trivial: properly mask vtcr macros 2019-07-25 09:19:00 +10:00
Sylvain Gauthier
decd4f87bb trivial: required style changes 2019-07-19 16:37:03 +10:00
Sylvain Gauthier
121943c3c7 [SMP] Added PPI support for gic_v2
Correctly defined the macros to translate between virtual and hardware
IRQs such that PPIs can be properly handled on gic_v2. It is now
possible to create a per-core handler for PPIs on platforms using this
GIC.
2019-07-19 16:37:03 +10:00
Sylvain Gauthier
a6157d5d8e [SMP] Abstracted IRQ indexing to handle PPIs
irq_t is now a "virtual" interrupt type that encapsulates the
information of the core in case of a private interrupt. There is a
couple of macros that need to be defined on the interrupt controller
level to translate between virtual and hardware IRQs.
2019-07-19 16:37:03 +10:00
Sylvain Gauthier
1deb1d2696 [SMP] New IPI call to unmask remote IRQ
Added a new IPI on ARM to unmask a remote private interrupt.
2019-07-19 16:37:03 +10:00
Sylvain Gauthier
49d3f2202d [SMP/Debug] New syscall to send arbitrary SGIs
Created a new syscall, seL4_DebugSendIPI for ARM to send arbitrary SGIs
(software generated interrupts) to arbitrary cores. As SGIs are
specifically PPIs (private interrupts), this syscall effectively allows
to trigger PPIs on arbitrary cores, for debug/testing purposes.
2019-07-19 16:35:57 +10:00