Age | Commit message (Collapse) | Author |
|
To enable CPU hotplug the need to provide some boot code at the reset
vector and which survives after the kernel has booted without being
overwritten. We achieve this by the getting the linker script to place
the code in boot.S at address zero. This now means we can delete the
code that relocates the secondary CPU pen code to "a location less
likely to be overridden".
We then modify the boot protocol slightly to allow hot-plugging of any
CPU, including CPU #0, when the system is already booted. This is done
by checking if SYS_FLAGS is already set before the normal check for CPU0
and the boot-or-wait decision made.
This patch is based on work by Nicolas Pitre.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
|
|
We boot the kernel in non-secure mode and by default access to
the CCI device is not enabled for non-secure access, so we must
enable this if we want Linux to manage CPU hotplug on big.LITTLE
models.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
We need to set the flags when checking the feature register.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
The A15xA7 models simulate a Cache Coherent Interconnect (CCI) and this
needs to be initialised correctly for Linux to boot.
To perform this initiation we add the new function configure_from_fdt()
which will look in the fdt for devices to initialise. In this first case
we look for the CCI node and if found then setup this device.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
A subsequent patch will also need to obtain address-cells and
size-cells, so lets factor out this code into a handy function.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
[PMM: fixed some minor style nits pointed out by Dave M]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Check all the CPU affinity fields of MPIDR, so we select only
the first CPU of the first cluster as the one to boot on.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Now that the kernel supports simply being started in Hyp mode,
we don't need to maintain the obsolete SMC interface for setting
HVBAR and switching to NS mode. Drop monitor.S in favour of a
much simpler special-purpose bit of code in boot.S which passes
briefly through Monitor mode to set up HVBAR and drop into
NS state. We also disable SMC in NS mode, so that inadvertent
use of it will UNDEF rather than leaping back into the boot
wrapper later on.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
The bootwrapper is really doubling as firmware, so it doesn't make
sense for it to drop out of the Secure World before getting a
chance to parse its parameters and configuration.
Instead, it is better to delay switching to the Normal World for
as long as possible so that we have a chance to do any required
firmware-level configuration in the Secure World first.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
[PMM: moved enter_hyp for secondary CPUs to just before the WFE
loop to avoid making the loop code that needs relocation bigger]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
* Split Hyp mode entry out into a separate macro.
* hvc now jumps back to the caller in Hyp mode instead of
branching to a fixed label.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Currently, it looks like we rely on luck in order to fall through
to the correct vector when a Hyp Trap exception occurs.
This patch aligns the Hyp mode vector table explicitly to a 32-byte
boundary, as required by the architecture.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
The semihosting and FDT code makes use of libc style string
functions implemented in our string.c, however it relies on the system
providing the string.h header file.
This causes problems on toolchains that don't provide these headers,
like Android toolchains, and it also means that we include declaration
for functions which aren't implemented in the bootwrapper.
Resolve this by providing our own string.h which declares only
the functions we implement and add the base directory to the
include path so this header is found.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Add support for loading initrd images in u-boot image format. The
image header is checked against u-boot image header magic. In
case of a match, the initrd is treated as starting after the u-boot
image header.
Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
Acked-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
ARM board device tree blobs have moved to specifying addresses and
sizes as 64 bit values (2 cells) rather than 32 bit (1 cell); update
bootwrapper so it can handle these rather than stopping with an error.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Dave Martin <dave.martin@linaro.org>
|
|
Fix a bug that meant that the --dtb option was silently ignored.
(The equivalent to this fix has already been applied in the
big.LITTLE bootwrapper which we borrow this file from, so this
brings us back into sync.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Add a short README file describing what the bootwrapper is
and how to run it.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Switch over to the C semihosting code, removing the old assembly
implementation. This allows us to simplify the build process
somewhat: boot.S is now compiled only once, rather than once for
semihosting and once without.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Import the reimplementation in C of the semihosting support
written by Dave Martin for the ARM big.LITTLE bootwrapper.
The main benefit of this switchover (apart from only having
one implementation rather than two) is the fdt support it
includes.
This commit only imports the sources, it doesn't compile them.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Import the sources of the libfdt flattened device tree library,
as a prerequisite for adding fdt support to the bootwrapper.
This commit just pulls in the upstream sources; it does not
cause them to be built.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
There's no need to use a dummy 'true' command to suppress the
default 'try kernel makefile' target for targets with no actual
rules -- you can just list as in .PHONY instead.
Tidy the list of files to remove on clean to remove a duplicate
and use $(KERNEL) instead of uImage.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Add and modify Makefile rules so that it can be used in a Debian
package. Add an explicit 'distclean' target. Add a 'semi' target
that only builds the semihosting binary. Add stub commands to 'all'
and 'semi' so the call doesn't fall through to the default kernel
rule. Update 'clean' to also clean the semihosting files.
Signed-off-by: Michael Hope <michael.hope@linaro.org>
Signed-off-by: Rusty Russell <rusty.russell@linaro.org>
|
|
Move the start address of the initrd up to kernel start + 0xd00000,
so that we can handle large kernels (eg Android) without them
overlapping with the initrd. 0xd00000 is the offset QEMU uses in
its internal ARM bootloader so should be sufficient.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Leave the old monitor stub there for the moment, so we can boot current
Christoffer kernels.
Includes fixes by Dave Martin to make it actually work :)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
We were failing to build linux-system-semi.axf in a clean tree
because even if SEMIHOSTING was defined we still had a spurious
INPUT(boot.o), which is harmless if boot.o exists but fails
if it does not.
In fact the INPUT() commands for the .o files are unnecessary
because ld will pull in the correct .o files because the SECTIONS
command has a non-wildcard reference to them. So just drop the
unneeded INPUT() commands rather than adding more ifdefs.
(The INPUT() commands for the binary blobs are still required.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Implement support in the boot-wrapper for reading our kernel,
initrd and command line arguments using the semihosting ABI
provided by a Fast Model. We build a second AXF file
linux-system-semi.axf which does not depend on or bake in
a kernel binary. Instead when you start the model with it
you pass the model a parameter like:
-C cluster.cpu0.semihosting-cmd_line="--kernel /path/to/uImage
--initrd /path/to/initrd -- console=ttyAMA0 mem=512M ..."
The boot wrapper will interpret the --kernel and --initrd
arguments as taking an option which is a (host system)
path, and pass the tail of the string following '--' to
the kernel as its command line.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Explicitly pass -marm in the CFLAGS when we want to build in ARM mode,
because some compilers will default to Thumb. This has not previously been
a problem in practice because the assembler will compile in ARM mode
anyway unless we told it to use Thumb mode with -Wa,-mthumb. However it
does mean that we end up building boot.S with a cpp that thinks it is
compiling for Thumb (and thus defines __thumb__) but an assembler that
generates ARM code. Passing -marm explicitly avoids this mismatch and
allows us to use the cpp preprocessor defines without fear.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
The kernel command lines are set in the Makefile and config files now
anyway and depend on the board type settings in there, so there should
be no need to have yet another set of ifdefs in boot.S.
Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
|
|
Config files are named config.mk. This file is added to .gitignore,
but a default config file is supplied in config-default.mk.
The default config file creates kernel command boot lines for NFS boots
based on a script obtaining the host IP addres. Naturally users can
change this to a static IP or another script if they wish.
The config file lets users select a system and other config options
depend on this overall setting.
I am no expert on Makefiles, so there could be better ways to accomplish
these things, but I think this suffices for now.
Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
|
|
Add some convenience rules so we pass unknown targets through
to the kernel makefile. This allows you to say 'make menuconfig'
(for instance) from this directory.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Allow the kernel command line to be set in the makefile rather
than forcing the user to edit boot.S every time.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Introduce a USE_INITRD switch so we can avoid requiring the user to touch
a pointless filesystem.cpio.gz if they're not using an initrd.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
ARCH is pretty much always going to be 'arm' so it makes more sense
to default it in the makefile.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
CROSS_COMPILE and ARCH are needed by the kernel makefile, so
export them so they are passed down even if we're using the
defaults in this makefile rather than user specified (command line
or environment) settings.
Signed-off-by: Peter Maydell <peter.maydelL@linaro.org>
|
|
Minor tweaks to the $(KERNEL) target:
* use $(MAKE) so -n &c work better
* depend on the uImage which we use, not the zImage which we don't
* use automatic variables to avoid repeating the path to uImage
* drop unnecessary separate cd
* fix stray direct use of "../linux-kvm-arm"
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
|
The boot wrapper suffers from a few problems when it comes to
setup the secondary CPUs, as only the boot CPU hits the non-secure
setup path.
Move the non-secure setup to the common path, taking care of only
configuring GICD_IGROUPR0 on secondary CPUs.
Also set bit 18 in NSACR to allow the SMP bit to be set in the
Auxiliary Control Register (A15 specific).
Tested on A15 model v6.1.70.
Cc: Christopher Dall <cdall@cs.columbia.edu>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
|
|
Use callee-save by implementing a small stack space in the monitor
instead.
|
|
This API allows only setting the HVBAR and switching to non-secure mode:
The non-secure privileged mode needs only write access to the HVBAR to
configure its own hypervisor state, given that the MMU is disabled in
Hyp mode.
All callers can switch to non-secure mode, but setting the HVBAR
requires VTTBR.VMID==0, otherwise the call simply returns.
Overall API convention:
- r7 == 0xfffffff0
- r0 the new HVBAR value
- r4-r11 are preserved
|
|
|
|
Only set CROSS_COMPILE if it's not already set in the environment and
set it to arm-unknown-eabi- per default.
Set "arch_extension sec" in boot.S code to allow newer compilers to
accept the smc #0 instruction.
|
|
Move the writing of the HVBAR to the top, so we can simply strip off the rest
afterwards.
|
|
|
|
These registers must also be initialized by a hypervisor for it to run code in
HYP mode.
|
|
|
|
|
|
|
|
|
|
|
|
SMC API is this:
- r7: monitor call number
- r0-r3: arguments
- r0-r1: return value
- r4-r11: preserved
SMC Permissions:
- All calls except switching to non-secure mode, requires VTTBR.VMID == 0,
otherwise the calls are essentially no-ops.
SMC API numbers are this:
- 0xffffffff: Switch to non-secure mode, SCR is: 0x31
(controlled by hypervisor to let SMC pass through hyp mode)
- 0xfffffff0: Read HTTBR (same order as mrrc r0,r1)
- 0xfffffff1: Write HTTBR (same order as mcrr r0,r1)
- 0xfffffff2: Read HTCR
- 0xfffffff3: Write HTCR
- 0xfffffff4: Read HMAIR0
- 0xfffffff5: Write HMAIR0
- 0xfffffff6: Read HMAIR1
- 0xfffffff7: Write HMAIR1
- 0xfffffff8: Read HSCTLR
- 0xfffffff9: Write HSCTLR
|
|
|
|
Use 0xf0000000 instead of 0x0 as the monitor base address.
|