Commit graph

3469 commits

Author SHA1 Message Date
Gerwin Klein
996e1624f3 Manually tag missing 3rd-party licenses
Two files were previously ignored in the license check.
2020-03-09 17:59:07 +08: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
cdd0f99485 license ID for bib file
Bib entry is from Data61 database.
2020-03-09 13:21:49 +08:00
Gerwin Klein
ceb36c2f1b licenseignore: generated file
references.bib is in version control for deterministic builds, but
it is a generated file.
2020-03-09 13:21:49 +08:00
Gerwin Klein
35903f3f4e .gitignore has a license
The .gitignore file doesn't need to be removed from the license check.
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
80d8b02f30 license tagging for manual
provide license info for Doxyfile, README, export.bst
2020-03-06 17:40:15 +08:00
Gerwin Klein
8de579e408 licenseignore: don't ignore the manual
The software license doesn't make much sense for the manual, but
it is for now the only one available.
2020-03-06 17:40:15 +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
Damon Lee
b8768ee0c3 qemu-arm-virt: Fix incorrect timer frequency
The value for the timer frequency was off and this commits corrects it
so that it now contains the correct value.
2020-03-04 10:06:18 +11: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
Luca(Wei) Chen
99c7ff898e fastpath: reorganize the code layout on ARM
fastpath_call and fastpath_reply_recv got inlined into a single
function. This could cause loading unused code in cache and
additional jump instructions required in c_handle_syscall.
2020-03-02 13:32:35 +11:00
Jingyao Zhou
ff7d5556df zynq7000: fix a timer accuracy issue
Re-configure a reasonable timer frequency for zynq7000,
so that it can pass the test SCHED0011.
2020-02-24 16:08:08 +11:00
Matthew
1224e15f86 Set the cross compiler prefix to the triple
By default, clang looks for tools prefixed with the target triple.
Explicitly setting the target triple in the toolchain file allows seL4
tools to do the same.
2020-02-21 14:35:45 +11:00
Alison Felizzi
31a8142553 qemu-arm-virt: Generate dtb based on SMP config
When generating/dumping the dtb for the qemu-arm-virt platform,
pass in a 'smp' configuration variable based on
'KernelMaxNumNodes'.
2020-02-20 12:53:04 +11:00
Anna Lyons
713bbc70e1 arm: Reserve VPPI and VGIC maintenance IRQs on SMP
This commit updates the secondary core initialisation to reserve
the VGIC maintenance and VTimer Event IRQs. This change is
introduced in support of SMP configurations when arm hypervisor
support is enabled.
2020-02-20 12:53:04 +11:00
Anna Lyons
c4fe536984 arm: remote IPI call support for VIRQS
Added support for injecting remote IPI calls towards given VCPU's
on SMP configured systems. This introudcing a new type of
IpiRemoteCall and handlers for updating the vgic state on
incoming/outgoing IPI's.

Co-authored-by: Yanyan Shen <yanyan.shen@data61.csiro.au>
2020-02-20 12:53:04 +11:00
Alison Felizzi
bddd405417 arm: Added define for VMPIDR and VMPIDR_EL2
Added constant definitions for the VMPIDR (arm32) and VMPIDR_EL2
(arm64) registers. These being vcpu registers that can be
written, read, saved and restored. The 'Virtualization Multiprocessor
ID Register' (VMPIDR) is needed to program a vcpu's affinity during
initialisation. This is currently only exposed on SMP configurations.

Co-authored-by: Anna Lyons <anna@gh.st>
2020-02-20 12:52:59 +11:00
Rafal Kolanski
91f8ff706c arm-hyp: check vtimer irq state before masking
Without an invariant, during verification we no longer know that the
virtual timer irq is not inactive in restore_virt_timer, necessitating
an extra check.
2020-02-20 11:41:01 +11:00
Rafal Kolanski
d5294a32b3 arm-hyp: change VPPIEvent irq bitfield to 10bit
Truncation to 10 bits is therefore handled by bitfield generator, making
correspondence with more abstract verified specs easier, as they use a
10-bit word to represent IRQs on 32-bit ARM platforms.
2020-02-20 11:41:00 +11:00
Rafal Kolanski
ebbd5ce97c arm-hyp: rename irq field of VPPIEvent to irq_w
Interferes with C parser variable order, want irq_t irq to be short
name.
2020-02-20 11:41:00 +11:00
Rafal Kolanski
2dbcc842d2 arm-hyp: bound check irq in decodeVCPUAckVPPI
Provide an error if IRQ is outside of valid Arch_checkIRQ bounds.
2020-02-20 11:41:00 +11:00
Rafal Kolanski
221ed2eb9a arm-hyp: thread runnable check before handleFault
At this time verification does not have a provable link between the
current active VCPU and the current thread which would allow concluding
the current thread is runnable when the current VCPU is active. To
handle a fault, the current thread must be runnable.
Added extra checks to VGICMaintenance and VPPIEvent.
2020-02-20 11:41:00 +11:00
Rafal Kolanski
9d5168f09d arm_hyp: return error in decodeVCPUAckVPPI
An invalid VPPI caused out-of-bounds array access due to missing return
statement.
2020-02-20 11:41:00 +11:00
Rafal Kolanski
d9dba5341a arm_hyp: handle VPPI event in Arch_setMRs_fault
The message registers were not previously being set to the contents of
the fault.
2020-02-20 11:41:00 +11:00
Rafal Kolanski
01514662b7 arm-hyp: provide MODIFIES info for DONT_TRANSLATE
C parser cascades up DONT_TRANSLATE blocking modifies proofs, unless
some kind of spec is provided. This makes the claim that the timer
register getters don't modify any global state, and the setters modify
only state verification does not care about.
2020-02-20 11:41:00 +11:00
Kent McLeod
232b0e86b5 arm_hyp: Move PGD definitions out of libsel4
The PGD constants refer to the top level mapping object used by the
kernel for its own private mappings. Userlevel cannot create any PGD
objects and so these constants don't belong in libsel4.
2020-02-20 11:41:00 +11:00
Kent McLeod
2ceeb1df6f VGICMaintenance: Update spurious check
Ignore any VGIC maintenance interrupts that arrive if a VCPU isn't
currently running.
2020-02-20 11:40:59 +11:00
Alison Felizzi
0e05f416ae arm: Configure traps on vcpu WFE/WFI calls
Configure the ability to trap on vcpu WFE/WFI calls. If enabled,
user-level would need to schedule a future interrupt when a given
vcpu invokes a WFE/WFI instruction. This otherwise leaving the
vcpu in a disabled state. An application can choose to
disable the trap if it doesn't want to handle the instruction and
schedule a future interrupt.
2020-02-20 11:40:59 +11:00
Kent McLeod
531d61215e arm: Restrict cache flush operations in hyp mode
Cache flush operations are applied through the kernel window mapping in
hyp mode. This requires an extra check that the frame being provided is
accessible through the kernel window.
2020-02-20 11:40:59 +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
Alison Felizzi
f795e7c0ec arm: New virtual PPI event fault type
This commit introduces a new fault type, seL4_Fault_VPPIEvent.

This change means the kernel can reserve PPI interrupts and virtualise
them via delivering the irq to the active vcpu through a
specific fault. This enables multiplexing PPI IRQs across multiple VCPUS
which requires correctly masking and unmasking the IRQ depending on
which VCPU is running.

A new VCPU invocation, seL4_ARM_VCPU_AckVPPI is also added for
acknowledging the handling of the IRQ. This takes an IRQ as a parameter
but will only accept IRQ numbers that are sent as VPPIEvent faults.

Co-authored-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
Co-authored-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-02-20 11:40:59 +11:00
Kent McLeod
4cb3414def aarch64: Add missing faults to seL4_getArchFault
seL4_getArchFault is a libsel4 helper that constructs fault messages out
of the IPC buffer message registers. Aarch64 was missing a few types.
2020-02-20 11:40:59 +11:00
Alison Felizzi
7409fa1de5 arm64: Added define for CNTPCT + CNTVCTL register
Added constant defintion for the "cntpct_el0" and " cntv_ctl_el0"
register. This being consistent with the 32bit mode definition
of the same registers.
2020-02-20 11:40:58 +11:00
Kent McLeod
6e63a4832c arm_hyp: Update ArmV8 vcpu register operations
Update the register save and restore functions to use the provided
wrapper functions that are now in scope.
2020-02-20 11:40:58 +11:00
Kent McLeod
16bedb98e4 arm_hyp: Remove some vcpu_* wrapper functions
These functions have entirely arch specific implementations so remove
function wrapping indirection to ease maintainability.
2020-02-20 11:40:58 +11:00
Kent McLeod
94c7800e7e arm_hyp: Refactor code into arch headers
Move vcpu functions that are specific to a particular Arm architecture
version into the relevant header files. Also move some generic functions
into the generic vcpu header file for use by arch specific headers.
2020-02-20 11:40:58 +11:00
Matthew
56a19e05dc Kernel-Vtx: Use clang compatible inline assembly
Specifying a function name prefixed with 'm' is not compatible with
clang.

For 32 bit, call vmlaunch_failed explicitly from within the assembly.
Requires adding the USED attribute to vmlaunch_failed as it is only
referenced in a string literal.

For 64 bit, move the address of vmlaunch_failed into rax as an integer
rather than loading it as the address of a function (lea).
2020-02-18 13:25:17 +11:00
Luca(Wei) Chen
4a09c94b77 ARM: move handle unknown syscall into slowpath
This reduces the instruction size for fastpath.
2020-02-14 11:01:46 +11:00
Luca(Wei) Chen
2dd4a59a94 fastpath: force inline fastpath_restore
This inline function doesn't get inlined with -O3.
It affects the cold cache performance, so use always_inline
attribute to tell compiler always get it inlined.
2020-02-14 11:01:45 +11:00
Luca(Wei) Chen
feb3717e50 fastpath: fix branch predications
All jump instructions to slowpath are unlikely executed
in fastpath, and this prevents polluting i-cache by pushing
it away.
2020-02-14 11:01:45 +11:00
Matthew
62fcb7c9c4 Error if clang is used with riscv
Riscv is not yet supported with clang so error in
the llvm toolchain file and exit early.
2020-02-12 16:08:35 +11:00
Matthew
8a87015a7c Define region in undefined way for clang only
Initializing an empty array is undeined in the C standard
so would impact verification. Only do this for clang
as to not break verification on gcc
2020-02-12 16:08:35 +11:00
Matthew
b043dbde84 Add ccache to the clang builds
Ccache increases compilation speeds dramatically
Add this to the clang toolchain
2020-02-12 16:08:35 +11:00
Matthew
5a2251a56d Explicit casts between enum types in IPI
Depending on the platform, IPI has a slightly different interface.
Explicitly cast from the more speific enum type to the generic
and vice versa when calling in and out of generic code.

Another possibility would be to typedef a specific enum on RISCV
platforms that aliases the one currently used. Then casting would only
have to take place when passing args to function calls.
2020-02-12 16:08:35 +11:00
Matthew
680ce96b59 Keep consistent definitions of sections for boot
Clang complains when this is set to null.
'Causes a section type conflict'. Use the same structure
as the other objects in the same section
2020-02-12 16:08:35 +11:00
Matthew
faaef077d6 Do not use clangs builtin assembler
The builtin assembler in clang is not intended for
hand written assembly. Only that generated by clang.
Disable this and use the default one
2020-02-12 16:08:35 +11:00
Matthew
ce71d1fccc Move to and from 64 bit system registers
Clang requires explicitly identifying a move is to a 64 bit
register (x<reg>), not just half (w<reg>).
2020-02-12 16:08:35 +11:00
Matthew
497d3c66c5 Specify 32 bit to the clang assembler
If using clang, pass the -m32 flag to the assembler
2020-02-12 16:08:35 +11:00