aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-12-07bootwrapper: CPU hotplug aware boot protocolHEADmasterJon Medhurst
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>
2012-12-04bootwrapper: Enable non-secure access to the CCIJon Medhurst (Tixy)
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>
2012-12-04bootwrapper: Fix check for architected timerWill Deacon
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>
2012-10-09bootwrapper: Initialise CCI device if found in the fdtJon Medhurst
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>
2012-10-09bootwrapper: Factor out parsing of fdt #address-cells and #size-cellsJon Medhurst
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>
2012-10-09bootwrapper: Allow for multiple clusters in boot CPU detectionJon Medhurst
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>
2012-09-27bootwrapper: Drop now-obsolete SMC interface supportPeter Maydell
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>
2012-09-26bootwrapper: Delay switch to Hyp mode until kernel entryDave Martin
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>
2012-09-26bootwrapper: Refactor entry into Hyp mode to be more reusableDave Martin
* 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>
2012-09-26bootwrapper: Fix misaligned Hyp mode vector tableDave Martin
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>
2012-09-04bootwrapper: Use local definition of string.hJon Medhurst (Tixy)
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>
2012-08-30semi_loader: Ignore u-boot image header in initrd if existGuodong Xu
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>
2012-08-17semi_loader: Handle dtbs with 64 bit addressesPeter Maydell
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>
2012-05-10semi_loader.c: make --dtb actually work rather than be ignoredPeter Maydell
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>
2012-04-26bootwrapper: Add READMEPeter Maydell
Add a short README file describing what the bootwrapper is and how to run it. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-04-26bootwrapper: Switch to C semihosting codePeter Maydell
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>
2012-04-26bootwrapper: Import C semihosting codePeter Maydell
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>
2012-04-19bootwrapper: Import libfdt flattened device tree libraryPeter Maydell
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>
2012-04-04Makefile: Use .PHONY target, not dummy commands; tidy clean listPeter Maydell
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>
2012-03-28boot-wrapper: tidy the Makefile to help with packaging.Michael Hope
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>
2012-03-16model.lds.S: Move initrd address up to allow for large kernelsPeter Maydell
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>
2012-02-27Boot kernel in hyp mode.Rusty Russell
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>
2012-02-21Fix linux-system-semi.axf build failure from cleanPeter Maydell
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>
2012-02-05boot-wrapper: Support reading kernel/initrd via semihostingPeter Maydell
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>
2012-02-05config-default.mk: Explicitly pass -marm when we want to build ARM modePeter Maydell
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>
2011-12-09boot.S: Factor out kernel cmd-line from boot-loaderChristoffer Dall
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>
2011-12-09Makefile: Introduced super-simple config fileChristoffer Dall
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>
2011-12-08Makefile: Pass unknown targets through to the kernel makePeter Maydell
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>
2011-12-08Makefile, boot.S: Allow kernel command line to be set in makefilePeter Maydell
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>
2011-12-08Makefile: Don't require filesystem.cpio.gz if building non-initrdPeter Maydell
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>
2011-12-08Makefile: default ARCH to 'arm'Peter Maydell
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>
2011-12-08Makefile: export CROSS_COMPILE and ARCHPeter Maydell
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>
2011-12-08Makefile: Improve $(KERNEL) targetPeter Maydell
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>
2011-11-24Merge branch 'master' into kvm-smpMarc Zyngier
2011-11-17KVM-A15: boot-wrapper: fix non-secure SMP bootMarc Zyngier
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>
2011-05-11Use monitor stack to avoid caller-saveChristoffer Dall
Use callee-save by implementing a small stack space in the monitor instead.
2011-05-08Use simpler monitor-hypervisor APIChristoffer Dall
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
2011-05-06Set the generic timer frequency (normally done by the firmware).Catalin Marinas
2011-05-06Conditionally set CROSS_COMPILE and use sec. ext.Christoffer Dall
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.
2011-05-05Change the Hyp API to prepare for simpler versionChristoffer Dall
Move the writing of the HVBAR to the top, so we can simply strip off the rest afterwards.
2011-05-05Make variable for kernel source locationChristoffer Dall
2011-05-01Add functionality to initialize the Hyp_SP and HVBARChristoffer Dall
These registers must also be initialized by a hypervisor for it to run code in HYP mode.
2011-04-28Allow co-processor access from non-secure modeChristoffer Dall
2011-04-28Set interrupts to be non-secureChristoffer Dall
2011-04-19Init GIC priority mask field to 0x80 in secure modeChristoffer Dall
2011-04-19Remove API test codeChristoffer Dall
2011-04-18Add more built files to .gitignoreChristoffer Dall
2011-04-07First shot at SMC hypervisor APIChristoffer Dall
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
2011-03-28Change the license to BSD (required by ARM's legal team).Catalin Marinas
2011-03-17Fix change to non-secure modeChristoffer Dall
Use 0xf0000000 instead of 0x0 as the monitor base address.