Commit graph

626 commits

Author SHA1 Message Date
Hesham Almatary
3e57e647e9 SELFOUR-501: x86 - Remove PAE support 2017-02-17 13:13:43 +11:00
amrzar
08ecacb013 KZM: add aarch32 config variable to autoconf.h 2017-02-13 07:24:53 +11:00
amrzar
0b2fe8d605 aarch64: Initial implementation 2017-02-10 16:43:55 +11:00
amrzar
149e42bfee aarch64: Check size of unsigned long 2017-02-10 16:43:55 +11:00
amrzar
fac16fe89e aarch64: add preliminary folders and Makefiles 2017-02-10 16:43:55 +11:00
amrzar
1d537ac721 ARM: Move vspace.h to mode specific folder 2017-02-10 16:43:55 +11:00
amrzar
19b89ed119 ARM: Add 32 bit directory for armv8-a 2017-02-10 16:43:55 +11:00
amrzar
acea60e3d6 ARM: Prepare hikey for aarch64 2017-02-10 16:43:55 +11:00
amrzar
40e89b5d67 ARM: Move fastpath_restore to mode specific folder 2017-02-09 15:47:39 +11:00
amrzar
28f09e2e73 ARM: Move timer.h to mode specific folder 2017-02-09 15:47:39 +11:00
Jack Suann
ebf593561c x86: Add missing memory clobber in receivePendingIRQ
In receivePendingIRQ() the global variable x86KSPendingInterrupt may be
updated but compiler was previously unaware of this.
2017-02-08 12:48:46 +11:00
Adrian Danis
f10efc6047 x86: Use lower memory region for AP boot code
Change AP boot code to use a memory region that is lower down, although also
smaller. As long as the boot code can fit in this smaller region booting is
more reliable as depending on the machine, bios, firmware and bootloader
varying amounts of the low memory will be available.
2017-02-08 09:56:06 +11:00
Anna Lyons
45f20d56b4 trivial: print kernel entry reason on halt
It is generally useful to know what operation was occuring
when the kernel halted, as this is usually called from assert.
2017-02-07 16:52:50 +11:00
Adrian Danis
4f52aca5b1 Remove multiple stack definitions
This commit changes the stack so that it is declared a single time in stack.c,
with the correct attributes and alignment, instead of being declared in stack.h
and relying on the linker to collapse the multiple declarations.
2017-02-06 15:42:37 +11:00
Adrian Danis
b40d95ed89 x86: Send explicit TCB when handling remote VMs withs pending notifications
Previously if the `ksCurThread` of the destination core is not the thread that is
receiving the notification in `sendSignal` then the notification would be delayed
until the VMM for that VM next did a `seL4_VMEnter`. This adds a `tcb_t*` parameter
to `VMCheckBoundNotification` instead of having it implicitly talk about `ksCurThread`.
A TCB parameter is safe to send here as the `doRemoteVMCheckBoundNotification`
happens synchronously and so the TCB is guaranteed to still exist.
2017-02-06 15:04:43 +11:00
Amirreza Zarrabi
ff6942570c Merge pull request #642 in SEL4/sel4 from ~AZARRABI/sel4:unify_bf to master
* commit 'efb28fec20ad1b22b4476a25b92ec1f5fb59a41f':
  Unify arch_shared_types.bf from the libsel
2017-02-06 09:35:13 +11:00
amrzar
efb28fec20 Unify arch_shared_types.bf from the libsel 2017-02-06 09:08:35 +11:00
Bamboo
dcaff678db [STYLE_FIX] 2017-02-05 22:03:00 +00:00
Adrian Danis
331e97962b x86: Implement safe rdmsr function
Implements a safe version of `x86_rdmsr` that can return success or failure depending
on if the rdmsr caused a GP fault
2017-02-06 09:02:19 +11:00
Adrian Danis
4fe72d09f5 x86: Mechanism for catching GP faults and returning to an error handler
Provides a mechanism where if af GP fault is potentially expected it can be caught
and the calling code returned to. The GP happening can be detected by setting
a specific return to handler and additionally by the return to handler being
cleared if a GP happened.
2017-02-06 09:02:19 +11:00
Jack Suann
cea45cd1bd x86: Handling pending interrupts in kernel mode
This commit allows x86 to completely handle a pending interrupt without switching
out to user mode. To handle an interrupt on x86 the APIC *must* generate an exception,
prior to you being able to acknowledge it. Previously we only allow exceptions (i.e.
interrupts) to be generated outside of kernel mode when we are in user mode.

This change allows us to 'poll' for an interrupt and transition the APIC whilst in kernel
mode by enabling and taking interrupts at carefully defined points. A pending interrupt
will be stored by the exception handler, allowing us to then handle the interrupt and
acknowledge the hardware APIC. Handling is done by waiting until after we have 'left' the
kernel and are about to switch to user mode and then 'entering' the kernel again by jumping
to the interrupt entry point.

Handling interrupts entirely in kernel mode provides two advantages
 * It will allow, in the future, the ability to handle kernel interrupts in situations
   where we need to handle the interrupt before actually performing the hardware switch
   back to user mode. This case happens where the user thread is using vt-x and so
   pending interrupts do not generate an interrupt exception, but rather cause an exception
   to be generated telling the system that there is a pending interrupt
 * Where there are multiple pending interrupts it is more efficient to avoid additional
   switches in and out of the user thread

Whilst this change does not enable pre-emption points to handle the interrupt before
returning out of `handleSyscall` it should be easily implementable with what is provided.
2017-02-01 12:44:14 +11:00
Kofi Doku Atuah
3cfcb676bc hikey: Add the rest of the dual timers for hi6220 2017-02-01 11:17:46 +11:00
Kofi Doku Atuah
6f953bf826 hi6220: Add RTC0 and RTC1 device UTs 2017-02-01 06:58:37 +11:00
Adrian Danis
d492e767f4 arm: save/restore banked registers in VCPUs
Adds space in the vcpu_t struct for the registers from the different operating modes
and saves/restores these registers as part of saving and restoring the VCPU
2017-01-30 09:47:51 +11:00
Adrian Danis
f709e49481 arm: SELFOUR-781: Only allow threads with VCPU to run outside user mode
Previously any thread could be set to run in any mode (except HYP mode).
Whilst this causes no security issues for the kernel, different execution
modes in ARM have different banked registers. These registers are not
currently saved and restored allowing for threads to manipulate registers
that will be seen (or potentially are being actively used) by other threads.

Saving and restoring these banked registers for all threads is a performance
cost (even if only done for the actual mode the thread runs in) for no real
benefit, as there is no clear reason to run a thread in other modes if you
do not have a vcpu. Therefore this commit restricts being in modes other than
user to threads that have a vcpu. When multiple VCPUs are properly supported
the switching of VCPUs will then save/restore these banked registers.
2017-01-30 09:47:51 +11:00
Adrian Danis
4cfbb68c62 x64: Correct ASID pool definition after f6d367e8df 2017-01-27 15:11:18 +11:00
Adrian Danis
f6d367e8df x64: Allow full 48bits of virtual address space to be used
Prior to this commit virtual addresses in the bitfield were considered
to be 48-bits, with sign extension to 64-bits. This meant that we were
actually sign extended bit number 47. Whilst this gives correct cannonical
addresses it prevents a portion of the address space from being used.

This commit changes the bitfield to use 49-bit virtual addresses, so that
after the bit 48 is used for sign extension there is still 48-bits of
usable address.
2017-01-27 12:21:07 +11:00
Adrian Danis
8da27f40c6 arm: Always restore TPIDRURW register if it exists
This register should be restored even if we are not using it at as the IPC buffer
location
2017-01-23 09:45:49 +11:00
Adrian Danis
d5bafdc74b arm: SELFOUR-779: Remove ARM_MPCORE config
The ARM_MPCORE configuration was added to capture which systems have the additional
ThreadID registers. This was an unneeded indirection as any arm version from v7 and
beyond has these registers. For the purposes of seL4 this means any arm version
except v6. This change scrubs ARM_MPCORE and replaces it with negated usages of
ARCH_ARM_V6. Additionally the IPC buffer config defaults were updated as the
ARM_MPCORE config was explicitly selecting the optimal one.
2017-01-23 09:45:34 +11:00
Hesham Almatary
668a04630e Merge pull request #616 in SEL4/sel4 from ~HALMATARY/sel4:ARMStackRefactor to master
* commit '6803155e1777b93b17b9aa30827783daf296efc2':
  ARM: discard 4K-alignment constraint
  ARM: Refactor how we get/set seL4 kernel stack
2017-01-20 14:38:22 +11:00
Kent McLeod
80d32b1609 SELFOUR-780: Add reserved entry to TK1 SMMU struct
This missing entry caused later entries to be offset from the actual
registers in hardware.
2017-01-20 10:20:28 +11:00
Hesham Almatary
6803155e17 ARM: discard 4K-alignment constraint 2017-01-19 19:38:14 +11:00
Hesham Almatary
5d14646343 ARM: Refactor how we get/set seL4 kernel stack
This commit makes seL4 hold the stack address on TPIDRPRW register (PL1 only
Thread ID Register, VMSA, see B4.1.150 section of ARMv7-A and ARMv7-R
edition reference manual).

Originally, the kernel stack was (re-)mapped to a fixed kernel virtual address and
on traps sp is loaded with this virtual address. Reason is to shave up some
cycles/instructions on (fast) traps path instead of having two instructions
(loading global variable pointer and then memory-load stack address from
it).

With ARM pipelining getting smart/complex (from ARMv7 onwards), there is
no noticeable difference in performance between the two implementations.
Furthermore, this change makes it easy for SMP to load different stacks
for each core and do CPU ID arithmetic efficiently. It also avoids the
issues involving (re-)mapping stacks for different cores if we
followed the original design.

Note: the main side-effect to this change is that the kernel stack for
ARM is no longer mapped with execute-never attribute.
2017-01-19 19:38:10 +11:00
Hesham Almatary
1d8be141af Fix compilation error when benchmark utilisation enabled for KZM/ARMv-6 2017-01-19 10:16:48 +11:00
Hesham Almatary
c156c9dddd Merge pull request #607 in SEL4/sel4 from ~HALMATARY/sel4:KernelStacks to master
* commit 'be77963e5bb4c5c28ad3ebd8746c292e7b5876f6':
  Define CONFIG_MAX_NUM_NODES and CONFIG_KERNEL_STACK_BITS in plat/autoconf.h
  Unify kernel stack definition/declaration and share it between architecures/modes
2017-01-18 12:43:34 +11:00
Adrian Danis
f653dfaa64 x86: Support 52-bit physical addresses in IOMMU when in 64-bit mode
Defines the vtd structures to be their full 52-bit size when in 64-bit mode by
making the hardware.bf per mode in the pc99 platform.

Updates some variables in iospace.c that were hard defined to be 32-bit
2017-01-18 10:48:20 +11:00
Adrian Danis
ce96b41db1 pc99: Remove unused PCI definitions 2017-01-18 10:48:20 +11:00
Hesham Almatary
be77963e5b Define CONFIG_MAX_NUM_NODES and CONFIG_KERNEL_STACK_BITS in plat/autoconf.h
For the sake of verification and standalone kernel builds
2017-01-17 17:03:07 +11:00
Hesham Almatary
e9922b7456 Unify kernel stack definition/declaration and share it between architecures/modes
Rather than defining a kernel stack in random places for each
architecure for each mode (32/64) and for single/SMP modes, make the
stack definition shareable between all of the above. This is also useful
for the future ARM SMP work.
2017-01-17 15:52:58 +11:00
Hesham Almatary
dcc0c0f785 Merge pull request #611 in SEL4/sel4 from ~HALMATARY/sel4:VER/FIX to master
* commit 'd5f8fe01274ffb70eeb2964ab5afd9a6c71f1468':
  SMP: guard arch_pause() with #ifdef for verification purposes
2017-01-17 15:52:02 +11:00
Kent Mcleod
76f83bd4f5 Merge pull request #609 in SEL4/sel4 from ~KMCLEOD/sel4:tk1-interrupts to master
* commit 'c2b9d7b3e4a07c9b78d540992692fe6ee8987c52':
  SELFOUR-775: Fix tk1 interrupt off-by-one error
2017-01-17 14:58:29 +11:00
Hesham Almatary
d5f8fe0127 SMP: guard arch_pause() with #ifdef for verification purposes 2017-01-17 14:49:31 +11:00
Kent McLeod
c2b9d7b3e4 SELFOUR-775: Fix tk1 interrupt off-by-one error 2017-01-17 12:01:22 +11:00
Bamboo
5845659ea0 [STYLE_FIX] 2017-01-16 22:32:08 +00:00
Hesham Almatary
ffc18fe880 SMP: use C++11 __atomic builtins instead of legacy __sync buitins 2017-01-16 16:27:16 +11:00
Hesham Almatary
af02927b69 SMP: move lock.h to architecture-independent include/smp
s/__sync_lock_test_and_set/__atomic_exchange_n in lock.h
2017-01-16 15:21:50 +11:00
Hesham Almatary
4bd07b9d2f Merge pull request #601 in SEL4/sel4 from ~HALMATARY/sel4:SMP to master
* commit '53c6b52438ea29241c8a75a4c4cb5de99313022f':
  SMP: Abstract architecture/platform independent parts of smp.h  and ipi.h
2017-01-13 17:22:10 +11:00
Hesham Almatary
53c6b52438 SMP: Abstract architecture/platform independent parts of smp.h and ipi.h
This commit is a re-arrangement of SMP directory structure to make it
easier for other architectures/platforms (in general) and ARM (in
particular) to add SMP support.

* new include/smp directory to act as a centralised container of
"shared" architecture-independent SMP headers.
This makes it clearer what's needed for other architecture/platform to
support SMP.
* Each platform can define its own unique ipi.[h|c] that make sense,
since ipi implementation is SoC/platform dependent.
2017-01-13 15:35:41 +11:00
Adrian Danis
654e92e37c pc99: Update autoconf.h to have stack size definition 2017-01-13 15:22:34 +11:00
Adrian Danis
5037717cde x86: Explicitly define kernel stack size
This commit changes the previous hard coded 4K kernel stack size
to being a configurable power of 2 sized stack
2017-01-13 15:20:14 +11:00