]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-arm: Don't report presence of EL2 if it doesn't exist
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 2 Feb 2016 18:20:42 +0000 (18:20 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Wed, 3 Feb 2016 13:54:41 +0000 (13:54 +0000)
We already modify the processor feature bits to not report EL3
support to the guest if EL3 isn't enabled for the CPU we're emulating.
Add similar support for not reporting EL2 unless it is enabled.
This is necessary because real world guest code running at EL3
(trusted firmware or bootloaders) will query the ID registers to
determine whether it should start a guest Linux kernel in EL2 or EL3.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-id: 1454437242-10262-1-git-send-email-peter.maydell@linaro.org

target-arm/cpu.c

index 0e582c441009fdd0d7408b82833e0c74fa9e1ad8..7ddbf3d19b770fc2c6ad9acec55b643f6f1c70ad 100644 (file)
@@ -650,6 +650,15 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
         cpu->id_aa64pfr0 &= ~0xf000;
     }
 
+    if (!arm_feature(env, ARM_FEATURE_EL2)) {
+        /* Disable the hypervisor feature bits in the processor feature
+         * registers if we don't have EL2. These are id_pfr1[15:12] and
+         * id_aa64pfr0_el1[11:8].
+         */
+        cpu->id_aa64pfr0 &= ~0xf00;
+        cpu->id_pfr1 &= ~0xf000;
+    }
+
     if (!cpu->has_mpu) {
         unset_feature(env, ARM_FEATURE_MPU);
     }