[U-Boot] [PATCH v5 7/8] ARM: extend non-secure switch to also go into HYP mode

Albert ARIBAUD
2013-10-03T06:24:57Z

Hi Andre,

On Thu, 19 Sep 2013 18:06:45 +0200, Andre Przywara
<andre.przywara@linaro.org> wrote:

> For the KVM and XEN hypervisors to be usable, we need to enter the
> kernel in HYP mode. Now that we already are in non-secure state,
> HYP mode switching is within short reach.
>
> While doing the non-secure switch, we have to enable the HVC
> instruction and setup the HYP mode HVBAR (while still secure).
>
> The actual switch is done by dropping back from a HYP mode handler
> without actually leaving HYP mode, so we introduce a new handler
> routine in our new secure exception vector table.
>
> In the assembly switching routine we save and restore the banked LR
> and SP registers around the hypercall to do the actual HYP mode
> switch.
>
> The C routine first checks whether we are in HYP mode already and
> also whether the virtualization extensions are available. It also
> checks whether the HYP mode switch was finally successful.
> The bootm command part only calls the new function after the
> non-secure switch.
>
> Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
> ---
> arch/arm/cpu/armv7/Makefile | 2 +-
> arch/arm/cpu/armv7/nonsec_virt.S | 43 +++++++++++++++++++++++++++++++++++-----
> arch/arm/cpu/armv7/virt-v7.c | 37 ++++++++++++++++++++++++++++++++++
> arch/arm/include/asm/armv7.h | 6 ++++--
> arch/arm/lib/bootm.c | 7 ++++++-
> 5 files changed, 86 insertions(+), 9 deletions(-)
>
> Changes:
> v3..v4: w/s fixes, embed error output
> v4..v5: none

Seems like Christoffer's comment was not addressed here but IIUC, it
was in other files (Christoffer, feel free to comment). Any reason why
the "older asm" comments form was not replaced in here?

Amicalement,
--
Albert.