Commit graph

972 commits

Author SHA1 Message Date
Adrian Danis
383a6d959f Merge branch zcu102-7.0.0 into master 2017-10-03 12:16:08 +11:00
Adrian Danis
8f4084de8c zynq: User BIT macro 2017-10-03 12:15:57 +11:00
Robbie VanVossen
4ba89d4aa0 Added 64-bit support for the zynqmp.
Split up the bit specific code into new folders and added 64-bit
support. Also, changed the device register sizes to be based off of
PAGE_BITS instead of a hardcoded number.

TIMER_CLOCK_HZ is set to the default clock rate from the ATF,
which is the same for both AARCH32 and AARCH64.It may require changes
to the FSBL to work correctly.
2017-09-27 12:59:07 -04:00
Robbie VanVossen
02ca6a80a4 Added 32-bit support for the zynqmp.
The Zynq UltraScale+ MPSoC (PLAT zynqmp) is a Multi-Processor SOC
made by Xilinx that has a quad-core Cortex-A53, a dual-core Cortex-R5
and an FPGA.

This adds 32-bit, single-core support on the the Cortex-A53 cluster.
2017-09-27 12:58:49 -04:00
Adrian Danis
d26c2951c1 x86: Remove needless restriction on TLS_BASE values
Restricting the value of TLS_BASE does not make sense as ultimately the user is prevented
from accessing the kernel region by virtue of protection levels and paging structures.
Whether the access is constructed by the user using a pointer (which in ia32 means an
implicit usage of `ds` selector) or through an explicit `fs` or `gs` selector does not
matter.
2017-09-21 12:05:22 +10:00
Adrian Danis
09ba9fc887 pc99: Prevent zero sized array when IOMMU disabled
An array is declared of size CONFIG_MAX_RMRR_ENTRIES, and if this is zero (such as
when the IOMMU is disabled), then it becomes a zero sized array, which is a GNU
C extension.
2017-09-14 14:48:01 +10:00
Bamboo
8bd43ab7c1 [STYLE_FIX] 2017-09-12 06:15:34 +00:00
Adrian Danis
128829a919 x86: Rationalize names of paging structures
Changes the name of paging structure entries to more clearly indicate the kind of object
they map to. Generally this is changing a `pde_small` to `pde_pt` to indicate that this
mapping refers to a page table, removing an inconsistency where `pde_large` indicated that
the mapping was for a large page. For the same reason the `ept_pde_4k` type is changed to
`ept_pde_pt` type to reflect what is present in the actual entry.

`pde_large` is left as 'large' and not explicitly given a size as code common between
ia32 and x86-64 manipulates these entities and 'large' is already a used abstraction
over the two potential page sizes so there is need to introduce a formal abstraction layer
and make the names in the structures more specific.
2017-09-12 15:44:17 +10:00
Adrian Danis
08b9265563 x86: Unmap pages when delete non final frame caps
Unlike other paging structure objects, each frame capability can hold a different mapping,
which should be unmapped. Previously we only performed an unmapping if we were deleting
the final frame capability, which meant if frame capabilities were deleting in the correct
order you could delete the final capability without first unmapping all usages of the
frame.
2017-08-30 17:41:35 +10:00
Adrian Danis
2bf586fe3d x86: Correct return type of servicePendingIRQ
This function returns an interrupt_t, and its call sites expect an interrupt_t,
despite the types being written as irq_t.

Closes #66
2017-08-29 10:56:43 +10:00
Bamboo
a990fb3fdd [STYLE_FIX] 2017-08-23 02:57:42 +00:00
Anna Lyons
5627c275ce SMP: add top level migrateTCB
On the MCS kernel, Arch_migrateTCB is called in multiple places.
This commit moves the common code that is required when migrating a TCB
to a top level function to reduce boiler plate.
2017-08-23 11:19:27 +10:00
Adrian Danis
a873611c0f Consistent capitalisation of XSave 2017-08-22 15:40:47 +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
c4d86b9844 Debug: fix ksDebugTCBs for SMP
There is a separate list of tcbs per core.

- migrate between debug lists when setting affinity
- use the correct core when removing
2017-08-22 07:27:42 +10:00
Bamboo
9de5e2aa65 [STYLE_FIX] 2017-08-21 07:34:03 +00:00
Adrian Danis
f85fb62fe5 SELFOUR-1062: Hide all VT-x related code behind #ifdef guards
The VT-x implementation is not going to be verified at the moment, and so the code for
it needs to be hidden from verification, which we do by #ifdef'ing it out if the VT-x
is not enabled. As a result the VT-x configuration depends on a non verification target
2017-08-21 16:44:58 +10:00
Adrian Danis
a9e1f51713 SELFOUR-1062: Hide all IOMMU related code behind #ifdef guards
The IOMMU implementation is not going to be verified at the moment, and so the code for
it needs to be hidden from verification, which we do by #ifdef'ing it out if the IOMMU
is not enabled. As a result the IOMMU configuration depends on a non verification target
2017-08-21 16:44:58 +10:00
Adrian Danis
8c8b53a5f7 pc99: Define PCI helpers in a pci header instead of iospace header
These helpers are generic PCI and are used outside of the iospace code
2017-08-21 16:44:58 +10:00
Hesham Almatary
57fa0e0f85 Share linker.h between architectures 2017-08-10 08:38:36 +10:00
Adrian Danis
ae9fe9b5d1 aarch64: Use tpidrro_el0 for IPC buffer instead of tpidr_el0
Changing the register used for the IPC buffer is useful as the standard TLS model for
aarch64 is to use tpidr_el0 for the thread pointer, which we are presently using
for the IPC buffer. This therefore paves the way for implementing proper TLS support
on aarch64.

Since we are not using tpidr_el0 for the IPC buffer we need to save/restore (or at
least clear) this register on thread switch to prevent it being a user channel. Saving
and restoring of it is achieved by ensuring CONFIG_IPC_BUF_TPIDRURW is not set, which
as we are no longer using this strategy this will be the case. To that end as aarch64
only has one IPC buffer strategy this commit makes the choice of IPC buffer strategy
dependeont on aarch32.
2017-08-07 22:52:46 +10:00
Adrian Danis
f799645a95 arm: fix license tag 2017-08-04 18:24:49 +10:00
Adrian Danis
c2f6d48bcf ia32: Set sensible defaults for FS and GS selectors
99.99% of the time this is what the user will want these set to in every thread, so
we might as well just set the sensible default here. Nothing stops the user overriding
this default later. This change will be unobservable to any existing (non broken) system
2017-08-03 23:55:07 +10:00
Hesham Almatary
1d4cdde1a4 ARM/SMP: Guard FPU operations 2017-07-20 11:21:20 +10:00
Hesham Almatary
9783de7af2 Verification: Run idle thread with global PD all the time 2017-07-10 11:53:43 +10:00
Hesham Almatary
ee28936d48 SMP: Introduce ENABLE_SMP_SUPPORT
- Make it more readable and less confusing compared to the 'CONFIG_MAX_NUM_NODES > 1' check
2017-06-29 16:23:39 +10:00
Hesham Almatary
586bb8ef49 SELFOUR-806: ARM/SMP/FPU - Support remote FPU switch 2017-06-29 13:42:11 +10:00
Hesham Almatary
bc01fbfe86 Trivial: include config.h in fpu.c 2017-06-29 13:42:11 +10:00
Hesham Almatary
64d576fb47 SELFOUR-806: aarch32 - Implement lazy FP save/restore
This commit implements lazy FP save/restore mechanism, required for user threads
when they use the FPU. The following caveats take place:

* Only support synchronous exceptions. No support for asynchronous ones.
* VFP opcodes are used instead of normal instructions to discard compiler warnings/errors.
* Support is limited to specific ARM subarchitectures we support and tested this commit on.
* Disable the FPU by default if users are not using it to avoid channels.
* FPU support is not verified yet.
* Will not work properly if using a VM that's running besides other VMs/threads that are using the FPU.
2017-06-29 13:42:10 +10:00
Hesham Almatary
13e32a295d trivial: fixes to popcountl implementation 2017-06-29 10:43:48 +10:00
Hesham Almatary
4baa8482b5 SELFOUR-746: IPI Handler for ARM 2017-06-29 10:15:00 +10:00
Hesham Almatary
2499f87216 ARM/SMP: rename/add IRQ macros to match with x86 2017-06-29 10:14:59 +10:00
Adrian Danis
dc24cdea04 SELFOUR-291 Reschedule when changing own registers
Previously if you wrote to TCB of the current thread and
changed the TLS_BASE this would not immediately take
affect, as the kernel only updates this register in
Arch_switchToThread. This change forces Arch_switchToThread
to get called, even if we would switch back to the original
thread.
2017-06-26 16:16:39 +10:00
Adrian Danis
a0c6b3e1cd SELFOUR-30 Reschedule when changing own IPC buffer
Previously if you invoked the TCB of the current thread and
changed the IPC buffer frame this would not immediately take
affect, as the kernels view of the current IPC buffer is
updated in Arch_switchToThread. This change forces Arch_switchToThread
to get called, even if we would switch back to the original
thread.
2017-06-26 16:16:39 +10:00
Hesham Almatary
e5ed942887 x86/SMP: Convert IRQ number to vector number when sending an IPI
ipi_send_mask is defined as:

void ipi_send_mask(irq_t ipi, word_t mask, bool_t isBlocking);

It expects an IRQ IPI number, not an interrupt number in the case of x86.

This commit:

1- Removes the confusion between IRQ and interrupt numbers by explicitly
converting IRQ to interrupt numbers in x86 implementation.

2- Makes the smp/ipi.c more generic to be shared with ARM, which only has
IRQ numbers for IPIs (send/receive).
2017-06-26 10:54:53 +10:00
Bamboo
502fb2e514 [STYLE_FIX] 2017-06-23 01:09:52 +00:00
Hesham Almatary
40970c300e SMP: allow an architecture to provide its own optimised IPI send function 2017-06-23 10:36:36 +10:00
Hesham Almatary
cac1348f20 SMP/ARM: include generic smp/ipi.h and move ipi.c to smp/ 2017-06-23 10:36:36 +10:00
Hesham Almatary
8f713ab44f SELFOUR-747: SMP/x86: generalize arch-independent IPI code 2017-06-23 10:36:36 +10:00
Anna Lyons
c61bc76cfe kprintf: support trailing spaces in format strings
ie %20s, %4lu will now work. Leading spaces won't though.
2017-06-23 10:28:54 +10:00
Adrian Danis
3a46037c6e Merge branch master into unused-function 2017-06-23 10:00:14 +10:00
Jonas Claeson
7f2eedf140 Removed unused static function set_irq_active 2017-06-22 13:06:14 +02:00
Anna Lyons
40c61e5c18 Fix licenses (the rest) 2017-06-22 15:29:12 +10:00
Hesham Almatary
6f52cd3db2 SMP/x86: convention - put all ipi.* files under smp/ directory
This follows the convention of other higher-level ipi.* smp.* files
put under smp/. Also upcoming ARM files.
2017-06-22 12:07:35 +10:00
Bamboo
3939511d22 [STYLE_FIX] 2017-06-22 01:32:13 +00:00
Hesham Almatary
0a6f9a5ddb SELFOUR-748: ARM - Support local/remote TLB invalidation operations 2017-06-22 10:55:38 +10:00
Matthew Brecknell
b0c744b248 SELFOUR-881: add ghost state updates for x86-64 2017-06-21 17:47:04 +10:00
Adrian Danis
2038316358 x86: Split large structs into portions
The C parser does not enjoy parsing structs with many fields
2017-06-21 17:14:48 +10:00
Adrian Danis
4f3f89bc21 x86: Avoid taking reference to local variable in apic_enable 2017-06-21 16:57:28 +10:00
Adrian Danis
126ff30675 x86: Avoid taking reference to local variable in init_pat_msr 2017-06-21 16:57:28 +10:00