Commit graph

1573 commits

Author SHA1 Message Date
amrzar
93cc22b289 smp: fix bugs when stalling remote core
- Restart TCB from inside the lock if it is waiting for anything other than IRQ
- Only replace the TCB with idle thread if it is in ThreadState_RunningVM state

Also, this makes the design generic to be shared with arm.
2017-03-30 09:46:43 +11:00
Hesham Almatary
57336507cf ARM/Hyp: vspace - enable nonexecutable (NX) attribute 2017-03-28 16:41:41 +11:00
Adrian Danis
8f7f8502e7 SELFOUR-712: arm: enable user level PMU event counter on v7 2017-03-28 12:10:51 +11:00
Adrian Danis
c104c82f5a arm: Refactor constants from debug API
This removes some duplicated constants and moves some constants into debug.h such that
they are visible without the user debugging API enabled. These constants are useful
for configuring other debugging/performance monitoring features.
2017-03-28 12:10:31 +11:00
Kofi Doku Atuah
941edc0883 SELFOUR-836: Fix build error in verification build 2017-03-23 12:41:59 +11:00
Kofi Doku Atuah
725d0dacfd SELFOUR-836: Disable debug context save/restore between VMs
This patch disables the debug register state save and restore on ARM-hyp,
such that Guest VMs can now interfere with one another and trigger
one another for certain limited scenarios. This will be undone later on.
2017-03-21 15:31:23 +11:00
Hesham Almatary
26c81b9ff4 x86: move pdpte_t to 64/mode and delete it for ia32 2017-03-17 09:50:52 +11:00
Hesham Almatary
2cd909b2e9 ia32: remove unsued ia32KSGlobalPDPT and PDPT defines 2017-03-17 09:50:52 +11:00
Bamboo
6bdad5c890 [STYLE_FIX] 2017-03-16 00:41:36 +00:00
Anna Lyons
6103d8f25f trivial: typos in previous commit 2017-03-16 11:33:14 +11:00
Anna Lyons
f42d63631b refactor: initialise common core state in one place 2017-03-16 11:15:04 +11:00
Kent McLeod
93ddf26893 tk1: Add register clobbers to monitor mode call 2017-03-14 14:12:00 +11:00
Kent McLeod
4de4c5f6b1 Add UNUSED 2017-03-14 12:09:57 +11:00
Adrian Danis
d0d76cd43c x86: Correctly restrict register value in Mode_sanitiseRegister
Restrict the value of the register being set, not the register itself
2017-03-13 14:27:23 +11:00
Adrian Danis
0d307b6fed arm: Remove duplicate cast 2017-03-10 15:25:43 +11:00
Kent McLeod
17093c15f3 tk1: Fix config bug that masked IOMMU interrupts 2017-03-09 16:07:40 +11:00
Bamboo
9601f0fdfe [STYLE_FIX] 2017-03-09 02:36:15 +00:00
Kent McLeod
adeb341f48 tk1: Add missing device regions 2017-03-09 12:40:56 +11:00
Bamboo
cea76d17ab [STYLE_FIX] 2017-03-08 00:46:03 +00:00
Hesham Almatary
733219e34b Merge pull request #710 in SEL4/sel4 from ~HALMATARY/sel4:ARMSMP4 to master
* commit 'e8d3672c9a89c32f8d074d57cfe428fde839eb47':
  SELFOUR-745: ARM/SMP - Add lock/unlock code to kernel entry/exit points
  SELFOUR-744: ARM/SMP - Map kernel window and root task as cache-shareable
  SELFOUR-744: ARM - preliminary booting of other cores
  SELFOUR-744: Add utililty function to read MPIDR register (CPU ID)
  ARM/Stack: Add utililty function to get seL4 top stack pointer from HW register
2017-03-08 11:45:43 +11:00
Hesham Almatary
e8d3672c9a SELFOUR-745: ARM/SMP - Add lock/unlock code to kernel entry/exit points 2017-03-08 09:31:32 +11:00
Hesham Almatary
a9f57e09bf SELFOUR-744: ARM/SMP - Map kernel window and root task as cache-shareable
Default user PTEs/PDEs are also default to be shared. Later, we can
provide an option to allow the user not to map frames as shared.
2017-03-08 09:31:32 +11:00
Hesham Almatary
5972401527 SELFOUR-744: ARM - preliminary booting of other cores 2017-03-08 09:31:25 +11:00
Adrian Danis
ddc58f3f82 manual: document bootinfo register 2017-03-08 09:25:47 +11:00
Adrian Danis
099b45074f libsel4: Deprecate bootinfo management 2017-03-08 09:25:47 +11:00
Adrian Danis
56cc374839 x86: Consider all IO port caps to be the same object
There is no 'object' backing an IO port capability, rather it represents the
authority to use an IO port range. The derived authority for ranges is checked
by `Arch_sameRegionAs`, but currently `Arch_sameObjectAs` always considers
two IO port caps to not be from the same object. Whilst this is true, it is
also true to say that all IO ports are from the same object (since there is
no object).

As it is easier to reason about IO port caps being from the same object, and
then restriction by region, this changes `Arch_sameObjectAs` to consider all
IO port caps to be from the same object.
2017-03-07 15:51:31 +11:00
amrzar
24c6a7e521 tx1: add fpu config variable 2017-03-07 08:59:32 +11:00
Adrian Danis
413b01644e arm-hyp: Disable active VCPU when switching to the idle thread
`vcpu_switch` is used in `setVMRoot` to switch the active VCPU, or to enable/disable
certain virtualization if going to/from using a VCPU. When running the idle thread
we do not leave kernel mode and having a VCPU active or not is almost irrelevant,
except that interrupts are enabled and the VGIC can generate interrupts. Whilst the
VGIC should not generate an interrupt whilst the idle thread is running, this is
problematic for verification
2017-03-06 16:12:25 +11:00
Hesham Almatary
d5bd84e00f SELFOUR-744: Add utililty function to read MPIDR register (CPU ID) 2017-03-06 15:00:11 +11:00
Hesham Almatary
33da2e0f37 ARM/Stack: Add utililty function to get seL4 top stack pointer from HW register 2017-03-06 15:00:11 +11:00
Adrian Danis
ccd9020b6a Pass tcb_t to sanitiseRegister instead of arch_tcb_t 2017-03-06 13:42:33 +11:00
Kofi Doku Atuah
dc8e101aa8 Add gitignore for parsetab.py 2017-03-01 10:49:37 +11:00
Kofi Doku Atuah
f12f0477c0 Add PL0 debug-API support for hyp-mode kernel
This patch enables the hype-mode kernel to intercept non-secure PL0
debug exceptions. Since it uses the HDCR register to do this (and not the SDCR),
it consequentially has no effect on any secure-monitor that may be executing
alongside the hypmode kernel.

For native seL4-hyp user threads, when the CPU sees a need to raise a debug
exception that was taken from PL0 (user), it will naturally try to raise that
exception to PL1 (supervisor).

But since seL4 is in PL2 and not PL1, seL4 has not set up an exception vector
table (VBAR) for PL1. So when the CPU attempts to vector into the PL1 VBAR,
it just gets a data abort, which it then delivers to PL2.

This patch causes the PL2 seL4 hypervisor to directly catch the debug exception
straight from PL0 and process the debug exception directly, for native threads.

Guest VM VCPUs are unaffected by this change. Their debug exceptions are delivered
to the Guest VM's PL1 VBAR as per usual.
2017-03-01 10:49:27 +11:00
Kofi Doku Atuah
469bdd6156 ARM-HYP: Add support for save/restore of debug registers
As things are now, the Guest VMs can modify the debug registers at will
from non-secure PL1, and the kernel does nothing to ensure that guest VM
debug coprocessor registers are preserved.

This is a preliminary patch that simply hooks into vcpu_save and saves the
CPU's debug coprocessor registers when saving VCPU state.

For restoring the debug registers on switching to a VCPU, we just re-use
restore_user_debug_context, which is already called in restore_user_context.
(Restore_user_context is called by c_handle_vcpu_fault()). Specifically,
we modify the used_breakpoints_bf so that restore_user_debug_context()
will always pop all the debug context.

This patch only covers the breakpoint and watchpoint registers,
and it doesn't cover the entire debug coprocessor, which is another
conversation.
2017-03-01 10:23:29 +11:00
Kofi Doku Atuah
903a02dbef Don't enable secure-non-invasive debugging unnecessarily
The SDER (Secure Debug Enable Register) has two bits that control the enabling
of debug exceptions at PL0 for secure-world. They enable respectively,
invasive debugging and non-invasive debugging. We were indiscriminately
enabling both when we only needed to enable invasive debugging at PL0.

This patch disables non-invasive secure-PL0 debugging because it's not
needed.

Also add a comment for DBGAUTHSTATUS.
2017-03-01 10:23:29 +11:00
Bamboo
bb2800107c [STYLE_FIX] 2017-02-28 23:08:42 +00:00
Hesham Almatary
ecb54e09e6 Merge pull request #708 in SEL4/sel4 from ~HALMATARY/sel4:SELFOUR-746 to master
* commit '5253dca8b1e6a5cda3b6c7adce55f398ee3274fe':
  SELFOUR-746: ARM/SMP - Reserve the first two SGI IDs for seL4 IPI
  SELFOUR-746: ARM/GIC - Provide IPI support
  SELFOUR-746: ARM/GIC - bank active_irq for each core
2017-03-01 10:07:46 +11:00
Hesham Almatary
bf9d02f3ca Merge pull request #709 in SEL4/sel4 from ~HALMATARY/sel4:ARM/IRQ to master
* commit 'b8f9dcac64603debc2d1e235f8032ee504cd4845':
  ARM/IRQ: add a function to initialise local IRQ controller for CPUs
2017-03-01 09:55:44 +11:00
Adrian Danis
256c30ae02 x86: Pass VBE information from multiboot through bootinfo 2017-02-28 16:35:50 +11:00
Hesham Almatary
5253dca8b1 SELFOUR-746: ARM/SMP - Reserve the first two SGI IDs for seL4 IPI 2017-02-28 15:56:27 +11:00
Hesham Almatary
b8f9dcac64 ARM/IRQ: add a function to initialise local IRQ controller for CPUs
Similar to initIRQController(), cpu_initLocalIRQController() has to
be implemented for each platform. For those that are gonna support
SMP, it should be implemented proprely (if required), otherwise
it can be stubbed for single core implementations.
2017-02-28 13:39:49 +11:00
Hesham Almatary
b95dec2f7b SELFOUR-746: ARM/GIC - Provide IPI support 2017-02-28 10:13:43 +11:00
Hesham Almatary
8f859a7d32 SELFOUR-746: ARM/GIC - bank active_irq for each core 2017-02-28 10:03:15 +11:00
Hesham Almatary
db15ec7c46 Merge pull request #704 in SEL4/sel4 from ~HALMATARY/sel4:ARMSMP3 to master
* commit '03c323c18ef5ecf82fa962bc9e441870e6ed290f':
  ARM/Boot: initialise private timer, user access and benchmark in CPU context
2017-02-28 09:47:42 +11:00
Adrian Danis
c43954252c Remove assumption on 32-bit memory offsets
On 64-bit platforms physical address could be >2^32 offset from a virtual address. This
changes offsets to match the word size of the target architecture
2017-02-28 08:28:01 +11:00
Bamboo
4d54476621 [STYLE_FIX] 2017-02-27 06:26:58 +00:00
Hesham Almatary
03c323c18e ARM/Boot: initialise private timer, user access and benchmark in CPU context
In SMP context, init_cpu is meant to be called for each CPU, where
initialising private timer, user access and benchmarks (basically CCNT)
are per-CPU operations and involve per-CPU hardware
resources/interrupts.
2017-02-27 15:05:21 +11:00
amrzar
dea3d9819d X64: add CONFIG_HAVE_FPU to autoconf.h 2017-02-27 14:25:08 +11:00
amrzar
b595d71f12 x86: initialize ksActiveFPUState for APs 2017-02-27 14:25:08 +11:00
amrzar
8610061aa9 aarch64: FPU lazy context switch 2017-02-27 14:25:01 +11:00