Commit graph

1458 commits

Author SHA1 Message Date
Oliver Scott
4a6482edeb trivial: separate tk1 smmu from arm smmu
Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Oliver Scott
c66d9cee7a trivial: style and comment
Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
935714a4cb SMMU: TLB coherency between MMU and SMMU
The kernel connects ASID used in MMU and context banks used in
SMMU, and conducts TLB invalidation on context banks if a page
entry is invalidated from MMU is also used in SMMU.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
81f9a88ff7 SMMU: supporting probing fault status
Providing system calls that enquiry the fault status in context
banks and in SMMU overall.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
69c9f55f4d SMMU: supporting deletion on stream ID caps
Providing support to delete stream ID caps and remove any assigned
context banks to deleted stream ID caps.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
1ef6e6c724 SMMU: supporting unbind context banks
Providing system calls on stream ID caps that unbinds its
context banks. Any future transaction using this stream ID
will result on faluts.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
38ed1046e1 SMMU: supporting unassign vspace in context banks
Providing a system call that removes an assigned vspace root from its
context bank. This operation causes the context bank being disabled
as it does not have a valid vspace root after the unassignment.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
1ce46cd439 SMMU: removing mapped attribute from SMMU caps
The mapped attributes in both context bank and stream ID caps
are reundant for maintaining the semantics on those caps.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
b07ea94c0c SMMU: TLB invalidation system calls
Providing system calls for conducting TLB invalidation operations
on all TLB entries or entries in a context bank.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
6e5911172c SMMU: binding stream ID to context banks
Providing system calls that binds context banks to stream IDs.
Once the stream ID is bound, the transaction using that SID is
enabled.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
73e062bd45 SMMU: assigning vspace to context banks
Supporting user-level applications to assign vsapce root to context
banks through system calls. This commit also configures the context
bank according to stage 1 or stage 2 requirement.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
0cf122a040 SMMU: system calls for creating SID and CB caps
Providing system calls on stream ID control cap and context bank
control cap for creating stream ID and context bank caps.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +11:00
Qian Ge
7316bfc676 SMMU: providing master control caps to root task
Adding the master control caps that are used to create transaction
and context banks caps. This commit includes the internal kernel
structure that required to manage any created transaction and
context bank caps.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
2020-10-28 17:30:42 +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
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
Jesse Millwood
721a685aed riscv: Use generated number for max irqs
This reduces an area of duplication of defining constant values

Signed-off-by: Jesse Millwood <jesse.millwood@dornerworks.com>
2020-10-28 08:33:05 +10:00
Jesse Millwood
be2803cbc9 riscv: Renamed PLIC driver
This renames the RISCV PLIC driver file hifive.h to riscv_plic0.h to
better reflect the fact that the driver could be used for a number of
platforms that use the PLIC used by SiFive and SiFive derived platforms.

Signed-off-by: Jesse Millwood <jesse.millwood@dornerworks.com>
2020-10-28 08:33:05 +10:00
Curtis Millar
63432c91d5 trivial: use correct variable name
Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
2020-10-02 15:40:12 +10:00
Miki Tanaka
4ee1f90a7d mcs: add tcb argument to reply_unlink
reply_unlink takes a reply and remove the link between that reply
and its tcb. This link always exists at the call site and the tcb
information is always avaialble, or can be made available.

This commit adds this tcb as an extra argument to aid varification.

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2020-10-02 12:38:39 +10:00
Siwei Zhuang
2ff45c3ca8 zynqmp: Add support for aarch32 hyp
Enable building AArch32 HYP kernel for ZCU102.

Signed-off-by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2020-09-30 13:42:18 +10:00
Jingyao Zhou
9feaba02fe capDL: Add kernel debugging tool for capDL
Add Arm debugging features of capDL Kernel Printing

Signed-off-by: Jingyao Zhou <Jingyao.Zhou@data61.csiro.au>
2020-09-16 19:38:40 +10:00
Jingyao Zhou
7c91c1c88a capDL: Add kernel debugging tool for capDL
Add x86_64 debugging features of capDL Kernel Printing

Signed-off-by: Jingyao Zhou <Jingyao.Zhou@data61.csiro.au>
2020-09-16 19:24:34 +10:00
Jingyao Zhou
a403d0d66c capDL: Add kernel debugging tool for capDL
Add general debugging features of capDL Kernel Printing

Signed-off-by: Jingyao Zhou <Jingyao.Zhou@data61.csiro.au>
2020-09-16 18:01:36 +10:00
Jingyao Zhou
658e110622 capDL: Remove the old version capDL debugging tool
Remove the old version capDL debugging tool of x86 and arm32

Signed-off-by: Jingyao Zhou <Jingyao.Zhou@data61.csiro.au>
2020-09-15 15:27:13 +10:00
Mitchell Buckley
036ffc1895 mcs: update commitTime
It is possible for consumed time to be larger than domain time.

Signed-off-by: Mitchell Buckley <mitchell.buckley@data61.csiro.au>
2020-09-08 19:49:38 +10:00
Michael Yoo
5fc7346c3e riscv: copy dtb as extra bootinfo
- This commit largely copies the ARM way of handling
  device tree blobs on to RISC-V, as they work pretty
  similarly.

Signed-off-by: Michael Yoo <Michael.Yoo@data61.csiro.au>
2020-09-08 11:43:04 +10:00
Matthew Brecknell
4522d895d7 mcs: return pointer from refill_head and others
A previous commit produced some build errors, since it converted the
`REFILL_HEAD` and `REFILL_TAIL` macros to functions returning
`refill_t`, and the results were used as lvalues. This commit returns
pointers instead, and also converts `REFILL_INDEX` to a function.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-09-03 18:56:49 +10:00
Edward Pierzchalski
b181184d75 mcs: change REFILL_HEAD, REFILL_TAIL to functions
SimplExportAndRefine can't handle the level of pointer arithmetic being
performed by `REFILL_INDEX` if it's literally inlined into a function,
however it *can* handle that arithmetic if it's in a separate function.

Signed-off-by: Edward Pierzchalski <ed.pierzchalski@data61.csiro.au>
2020-09-01 16:47:21 +10:00
Sylvain Gauthier
0c32e252d4 fix TCB_PTR_DEBUG_PTR debug macro
The base pointer is wrong, and it creates some nasty corruption down the
line (only affects debug builds).

Signed-off-by: Sylvain Gauthier <sylvain.gauthier@data61.csiro.au>
2020-08-31 16:23:32 +10:00
Stefan O'Rear
e1c5674d36 riscv: sbadaddr -> stval
This was renamed a few days after priv-1.10 was released and llvm only
understands the new name.

Signed-off-by: Stefan O'Rear <sorear@fastmail.com>
2020-08-26 14:21:35 +10:00
Mitchell Buckley
cc4b86d098 Check for reschedule on sched context return
The current state of MCS seL4 verification makes use of an invariant
that whenever the scheduler action is set to "resume current thread"
the current thread and the current sc are bound together. Since
maybeReturnSchedContext may unbind a thread from a scheduling context,
it should perform a check on whether it is unbinding from the current
thread, and in that case call rescheduleRequired which will (among
other things) change the scheduler action.

Signed-off-by: Mitchell Buckley <mitchell.buckley@data61.csiro.au>
2020-08-12 10:10:31 +10:00
Kent McLeod
09d42ac0ed mcs: Return bound notification SC before ep recv
If a thread is running on the SchedContext of it's bound notification,
when it next does a blocking recv/wait operation on an ep the SC is
removed. This allows the thread to return to being a passive thread to
receive the next notification or ep message.

Signed-off-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-07-24 16:48:48 +10:00
Curtis Millar
0fbf2f7da3 mcs: Don't pass capacity through calls
The capacity does not need to be passed as an argument to
refill_check_budget as all information that it was being used for can be
dertermined from the usage directly.

Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
2020-07-24 12:29:06 +10:00
Anna Lyons
c06a6c9a93 mcs: add MAX_BUDGET_US
We need to bound the time the user provides to configure scheduling
contexts to avoid malicious or erraneous overflows of the scheduling
math. Make the max period/budget 1 hour.

1 hour is sufficiently small that it will fit in a 32-bit error message.

1 week is sufficiently small for 64-bit platforms.

Signed-off-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-07-24 12:28:58 +10:00
Kent McLeod
15e615ada5 tcb_t: Add ascii diagram of tcb object layout
Now that debug_tcb_t is also located in a tcb object, add a diagram for
clarity.

Signed-off-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-07-22 00:32:27 +10:00
Kent McLeod
9d9bb994e5 debug: create debug_tcb_t struct
Special debug variables that were previously stored at the end of the
tcb_t struct often cause the struct to get too large for the power-of-2
sized untyped object definition. This change moves these variables into
a new structure named debug_tcb_t that is located between the TCB CNode
and the tcb_t struct within a tcb kernel object. Because tcb_t needs to
be stored on a power-of-2 aligned boundary and the TCB CNode only
contains < 5 slots, there is easily > 512 bytes of unused data in every
tcb object. The kernel verification needs to be sure that objects don't
overlap in memory and so this space can't be easily used in a release
build at the moment, but for debug configurations using it shouldn't be
an issue.

Signed-off-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-07-22 00:31:18 +10:00
Kent McLeod
88a7d138c4 KernelBenchmarksTrackUtilisation: Add more stats
For each thread also track number of times scheduled, number of kernel
entries and amount of cycles spent inside the kernel.  Also add
core-wide totals for each.

Signed-off-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-07-15 15:15:27 +10:00
Kent McLeod
8e358332bf KernelBenchmarksTrackUtilisation: refactor reset
Change benchmark_track_reset_utilisation to take a tcb object parameter
so that the function is more widely applicable.

Signed-off-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-07-15 15:15:20 +10:00
Kent McLeod
4eccea54e5 KernelBenchmarksTrackUtilisation: Fix for SMP
Create per-node global definitions for utilization variables.
This enables the tracking to more cleanly work on SMP configurations.
As resetting and starting the counters via SysBenchmarkResetLog only
updates the counters of the current thread and idle thread on the
current node it was not possible to accurately record utilization
statistics across multiple nodes. Now each node can have its tracking
independently started, stopped and queried. It is possible to add
additional syscalls in the future for doing this for all nodes in a
single syscall.

Signed-off-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-07-14 14:13:27 +10:00
Kent McLeod
d436eb8635 Move CONFIG_ARM_ENABLE_PMU_OVERFLOW_INTERRUPT def
This definition is intended to select functionality for processing a PMU
cycle counter overflow interrupt while using the thread utilization
benchmarking feature. Instead of forcing for all Arm platforms, only set
it if KERNEL_PMU_IRQ is defined and the IRQ has been configured
properly.

The consequence of this change is that aarch64 platforms that
have a 64bit counter that is unlikely to overflow do not need an
overflow interrupt to be defined.

Signed-off-by: Kent McLeod <Kent.Mcleod@data61.csiro.au>
2020-07-14 14:13:27 +10:00
Yanyan Shen
6be18012c3 vtd: Fix VTD_CTE_SIZE_BITS and VTD_CT_BITS
VTD context table entry is 16 bytes, and there are 256 entries
in a context table.

The commit is based on PR #185 by laokz

Co-authored-by: laokz <laokz@foxmail.com>

Signed-off-by: Yanyan Shen <yshen@cog.systems>
2020-06-23 19:13:30 +10:00
Yanyan Shen
30e2568fcf x86: Fix pointer casts for PT and PD caps
The commit is based on PR #185 by laokz.

Co-authored-by: laokz <laokz@foxmail.com>

Signed-off-by: Yanyan Shen <yshen@cog.systems>
2020-06-23 19:13:30 +10:00
jonas
fe1278326f Repair barriers in clh_lock_acquire
Strengthen the clh_lock_acquire to use release on the atomic_exchange
that makes the node public. Otherwise (on ARM & RISCV), the store to
the node value which sets its state to CLHState_Pending can become
visible some time after the node is visible.
In that window of time, the next thread which attempts to acquire the
lock will still see the old state (CLHState_Granted) and enters the
critical section, leading to a mutual exclusion violation.

Signed-off-by: jonas <s9joober@gmail.com>
2020-06-22 11:53:08 +10:00
jonas
8ba22dcdc5 Repair barriers in sel4_atomic_exchange
The implementation of try_arch_atomic_exchange does not correctly pass
RELEASE memory ordering (or stronger) to the exchange operation.
To acknowledge this, try_arch_atomic_exchange is replaced by a relaxed
try_arch_atomic_exchange_rlx which does not apply any memory ordering.
Instead, the memory ordering is now added manually by
sel4_atomic_exchange. This provides better latency for interrupts as no
barriers are evoked inside the loop which performs the relaxed exchange
and checks for interrupts.
Furthermore, the new manual application of barriers ensures the memory
ordering passed to sel4_atomic_exchange.

Signed-off-by: jonas <s9joober@gmail.com>
2020-06-22 11:49:22 +10:00
Nick Spinale
a631ee42d8 aarch64: add missing vcpu cases
Adds missing vcpu cases for some aarch64-specific functions on
capabilities.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2020-05-27 19:15:17 +00:00
Curtis Millar
6fbee8ba05 Invert address mapping diagrams
This makes all daigrams have their first address at the end of the
diagram and their last address at the start of the diagram.

Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
2020-05-22 12:26:13 +10:00
Curtis Millar
301f36359c trivial: Use UL_CONST in assembler macros
Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
2020-05-22 12:26:13 +10:00
Curtis Millar
96456c6ae7 trivial: fix header files
Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
2020-05-22 12:26:13 +10:00
Curtis Millar
4466c7c9b0 Remove references to kernelBase
kernelBase was used inconsistently between different architectures to
refer to the either of the first kernel address or the first address of
the mappings of the kernel ELF region specifically.

These have been replaced with more consistent use of constants
explicitly describing which region is being referenced.

Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
2020-05-22 12:26:13 +10:00
Curtis Millar
fba7c896b0 Consolidate kernel virtual memory regions
Each architecture now only needs to describe the bounds of the three
memory regions: the 1:1 mapped physical memory region, the kernel ELF
region (which may or may not overlap the physical memory region) and the
device / kernel page table region.

The physical base address of the 1:1 mapped physcial memory region and
the kernel ELF region must also be specified.

The top of user addressable memory (where in the same virtual address
space as the kernel) is defined by USER_TOP.

The physic memory virtual mapping is described by PPTR_BASE and
PPTR_TOP. The base physical memory address is PADDR_BASE and is the
physical address used to map PPTR_BASE.

Don't use kernelBase when referring to the base of the 1:1 mapped
physical memory window.

The kernel ELF virtual address region is described by KERNEL_ELF_BASE
and extends until the virtual address of the symbol `ki_end` which is
created by the linker. KERNEL_ELF_PADDR_BASE is the base address of
the physical memory region used to map the kernel and is the address to
which KERNEL_ELF_BASE maps.

KERNEL_ELF_BASE and KERNEL_ELF_PADDR_BASE do not need to be aligned to a
page size boundary as they are approriately truncated during boot by the
`map_kernel_window` function.

KDEV_BASE describes the base virtual address of the kernel device region
and the region is assumed to extend to the end of virtual memory.

Note: The offset between PPTR_BASE and PADDR_BASE is used to translate
the virtual address of all untyped objects to physical addresses. This
includes device untyped objects or frame objects where the virtual
address does not fall within the 1:1 mapped physical memory region.

Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
2020-05-22 12:26:13 +10:00