Skip to content

Commit

Permalink
target-arm: powerctl: Enable HVC when starting CPUs to EL2
Browse files Browse the repository at this point in the history
When QEMU provides the equivalent of the EL3 firmware, we
need to enable HVCs in scr_el3 when turning on CPUs that
target EL2.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20181011021931.4249-10-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
edgarigl authored and pm215 committed Oct 16, 2018
1 parent 357aa01 commit 86278c3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions target/arm/arm-powerctl.c
Expand Up @@ -103,6 +103,16 @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state,
} else {
/* Processor is not in secure mode */
target_cpu->env.cp15.scr_el3 |= SCR_NS;

/*
* If QEMU is providing the equivalent of EL3 firmware, then we need
* to make sure a CPU targeting EL2 comes out of reset with a
* functional HVC insn.
*/
if (arm_feature(&target_cpu->env, ARM_FEATURE_EL3)
&& info->target_el == 2) {
target_cpu->env.cp15.scr_el3 |= SCR_HCE;
}
}

/* We check if the started CPU is now at the correct level */
Expand Down

0 comments on commit 86278c3

Please sign in to comment.