arm: disable irqs while holding puts spinlock

Since testing code like this doesn't live up to the stability of ISR
standards in the kernel and printf is a resource expected to always be
available, disable interrupts while holding the puts spinlock.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: Initialize vector address on all cores

Initialize the interrupt vector on all CPU cores by moving the
initializtion code into exceptions_init() which is called by both the
primary and secondary startup paths.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
fixup! arm: Simplify exceptions_init in cstart.S
arm: Rework spin_lock_irqdisable to spin_lock_irqsave

Rework the spin_lock_irqdisable and spin_unlock_irqenable to
spin_lock_irqsave and spin_unlock_irqrestore, respectively.  It is quite
silly and will brak things in crazy ways to enable interrupts on random
processors that happen to take a spinlock during printf.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: Fix include in asm-offsets

Fixes incorrect include path in asm-offsets, which required an arm/
prefix.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: Define wmb() and rmb() to be dsb()

The io accessor functions rely on an arch-specific definition of wmb()
and rmb(), which is defined to a noop by default.  Define these to a
dsb() on ARM in accordance with what the kernel does.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: Fix bug in init_cpu_thread_info

The exception handler init code was overwriting random data in our
program, due to wrongly placed parenthesis.  Reduce the chance of this
happening again by using a temporary pointer that should clarify this
bit of code.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: Remove unnecessecary references to asm-offsets.h

C code does not need access to asm-offsets, and it confuses the
compilation process.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: Restructure MMU code and invalidate TLBs

Restructure the MMU code to not check for maximum CPUs now when we are
sharing the PGDs between all CPUs.  Also invalidate the TLB before
enabling the MMU to ensure there are not invalid stale entries in the
TLB.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: vmexit: Add --oneshot option to vmexit test

Add a --oneshot option to the vmexit tests to only run a given test a
single time.  This is useful for debugging complex vmexit tests.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: vmexit: Remove unnecessary ipi_ready assignment

No need to set ipi_ready = true in loop_test as each handling of an IRQ
should set this value - otherwise something is wrong and we want to
catch it.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arm: vmexit: ipi test changes

Simplify ipi_irq_handler to just write back the returned value from the
ACK to the EOI register.  Also add a timeout to the polling loop for
ipi_received to report an error to testers instead of silently waiting
forever.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>