diff options
author | Dave Martin <dave.martin@linaro.org> | 2012-02-10 21:07:07 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2012-09-19 03:32:50 -0400 |
commit | 424e5994e63326a42012f003f1174f3c363c7b62 (patch) | |
tree | d8ff950676dac0fc3b38d6801423f996f8b20214 /arch/arm/kernel | |
parent | 80c59dafb1a9a86fa996e6e34d06b60567c925ca (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')
-rw-r--r-- | arch/arm/kernel/hyp-stub.S | 18 |
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 @@ | |||
21 | #include <asm/assembler.h> | 21 | #include <asm/assembler.h> |
22 | #include <asm/virt.h> | 22 | #include <asm/virt.h> |
23 | 23 | ||
24 | #ifndef ZIMAGE | ||
24 | /* | 25 | /* |
25 | * For the kernel proper, we need to find out the CPU boot mode long after | 26 | * For the kernel proper, we need to find out the CPU boot mode long after |
26 | * boot, so we need to store it in a writable variable. | 27 | * boot, so we need to store it in a writable variable. |
@@ -59,6 +60,21 @@ ENTRY(__boot_cpu_mode) | |||
59 | strne r7, [r5, r6] @ record what happened and give up | 60 | strne r7, [r5, r6] @ record what happened and give up |
60 | .endm | 61 | .endm |
61 | 62 | ||
63 | #else /* ZIMAGE */ | ||
64 | |||
65 | .macro store_primary_cpu_mode reg1:req, reg2:req, reg3:req | ||
66 | .endm | ||
67 | |||
68 | /* | ||
69 | * The zImage loader only runs on one CPU, so we don't bother with mult-CPU | ||
70 | * consistency checking: | ||
71 | */ | ||
72 | .macro compare_cpu_mode_with_primary mode, reg1, reg2, reg3 | ||
73 | cmp \mode, \mode | ||
74 | .endm | ||
75 | |||
76 | #endif /* ZIMAGE */ | ||
77 | |||
62 | /* | 78 | /* |
63 | * Hypervisor stub installation functions. | 79 | * Hypervisor stub installation functions. |
64 | * | 80 | * |
@@ -174,9 +190,11 @@ ENTRY(__hyp_set_vectors) | |||
174 | bx lr | 190 | bx lr |
175 | ENDPROC(__hyp_set_vectors) | 191 | ENDPROC(__hyp_set_vectors) |
176 | 192 | ||
193 | #ifndef ZIMAGE | ||
177 | .align 2 | 194 | .align 2 |
178 | .L__boot_cpu_mode_offset: | 195 | .L__boot_cpu_mode_offset: |
179 | .long __boot_cpu_mode - . | 196 | .long __boot_cpu_mode - . |
197 | #endif | ||
180 | 198 | ||
181 | .align 5 | 199 | .align 5 |
182 | __hyp_stub_vectors: | 200 | __hyp_stub_vectors: |