[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v2 6/6] hw/arm/boot: AArch32 kernels should be started
From: |
Peter Maydell |
Subject: |
[Qemu-arm] [PATCH v2 6/6] hw/arm/boot: AArch32 kernels should be started in Hyp mode if available |
Date: |
Mon, 20 Aug 2018 16:30:20 +0100 |
The kernel booting specification for an AArch32 kernel requires that
it is booted in Hyp mode if available; otherwise the kernel can't
enable KVM. We were incorrectly leaving the kernel in SVC mode.
If we're booting an AArch32 kernel in the Nonsecure state and Hyp
mode is available, start in it.
Signed-off-by: Peter Maydell <address@hidden>
---
hw/arm/boot.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index ca9467e583f..20c71d7d961 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -736,6 +736,17 @@ static void do_cpu_reset(void *opaque)
}
}
+ if (!env->aarch64 && !info->secure_boot &&
+ arm_feature(env, ARM_FEATURE_EL2)) {
+ /*
+ * This is an AArch32 boot not to Secure state, and
+ * we have Hyp mode available, so boot the kernel into
+ * Hyp mode. This is not how the CPU comes out of reset,
+ * so we need to manually put it there.
+ */
+ cpsr_write(env, ARM_CPU_MODE_HYP, CPSR_M, CPSRWriteRaw);
+ }
+
if (cs == first_cpu) {
AddressSpace *as = arm_boot_address_space(cpu, info);
--
2.18.0
- [Qemu-arm] [PATCH v2 0/6] target/arm: Some pieces of support for 32-bit Hyp mode, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH v2 2/6] target/arm: Implement AArch32 HCR and HCR2, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH v2 3/6] target/arm: Factor out code for taking an AArch32 exception, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH v2 5/6] target/arm: Clear CPSR.IL and CPSR.J on 32-bit exception entry, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH v2 6/6] hw/arm/boot: AArch32 kernels should be started in Hyp mode if available,
Peter Maydell <=
- [Qemu-arm] [PATCH v2 4/6] target/arm: Implement support for taking exceptions to Hyp mode, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH v2 1/6] target/arm: Implement RAZ/WI HACTLR2, Peter Maydell, 2018/08/20
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 0/6] target/arm: Some pieces of support for 32-bit Hyp mode, Richard Henderson, 2018/08/20
- Re: [Qemu-arm] [PATCH v2 0/6] target/arm: Some pieces of support for 32-bit Hyp mode, Edgar E. Iglesias, 2018/08/21
- Re: [Qemu-arm] [PATCH v2 0/6] target/arm: Some pieces of support for 32-bit Hyp mode, Luc Michel, 2018/08/22