summaryrefslogtreecommitdiff
path: root/arch/arm/kernel/hyp-stub.S
diff options
context:
space:
mode:
authorDave Martin <dave.martin@linaro.org>2012-02-10 18:07:07 -0800
committerMarc Zyngier <marc.zyngier@arm.com>2012-09-19 08:32:50 +0100
commit424e5994e63326a42012f003f1174f3c363c7b62 (patch)
treed8ff950676dac0fc3b38d6801423f996f8b20214 /arch/arm/kernel/hyp-stub.S
parent80c59dafb1a9a86fa996e6e34d06b60567c925ca (diff)
ARM: zImage/virt: hyp mode entry support for the zImage loader
The zImage loader needs to turn on the MMU in order to take advantage of caching while decompressing the zImage. Running this in hyp mode would require the LPAE pagetable format to be supported; to avoid this complexity, this patch switches out of hyp mode, and returns back to hyp mode just before booting the kernel. This implementation assumes that the Hyp mode view of memory and the PL1 view of memory are coherent, providing that the MMU and caches are off in both, as required by the boot protocol. The zImage decompression code must drain the write buffer on completion anyway, and entry into Hyp mode should flush any prefetch buffer, avoiding hazards associated with local write buffers and the pipeline. Signed-off-by: Dave Martin <dave.martin@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm/kernel/hyp-stub.S')
-rw-r--r--arch/arm/kernel/hyp-stub.S18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
index b03e9244e5ad..70609417deaf 100644
--- a/arch/arm/kernel/hyp-stub.S
+++ b/arch/arm/kernel/hyp-stub.S
@@ -21,6 +21,7 @@
#include <asm/assembler.h>
#include <asm/virt.h>
+#ifndef ZIMAGE
/*
* For the kernel proper, we need to find out the CPU boot mode long after
* boot, so we need to store it in a writable variable.
@@ -59,6 +60,21 @@ ENTRY(__boot_cpu_mode)
strne r7, [r5, r6] @ record what happened and give up
.endm
+#else /* ZIMAGE */
+
+ .macro store_primary_cpu_mode reg1:req, reg2:req, reg3:req
+ .endm
+
+/*
+ * The zImage loader only runs on one CPU, so we don't bother with mult-CPU
+ * consistency checking:
+ */
+ .macro compare_cpu_mode_with_primary mode, reg1, reg2, reg3
+ cmp \mode, \mode
+ .endm
+
+#endif /* ZIMAGE */
+
/*
* Hypervisor stub installation functions.
*
@@ -174,9 +190,11 @@ ENTRY(__hyp_set_vectors)
bx lr
ENDPROC(__hyp_set_vectors)
+#ifndef ZIMAGE
.align 2
.L__boot_cpu_mode_offset:
.long __boot_cpu_mode - .
+#endif
.align 5
__hyp_stub_vectors: