[U-Boot] [RFC PATCH 0/6] ARMv7: Add HYP mode switching support

Andre Przywara andre.przywara at linaro.org
Fri Apr 26 15:14:53 CEST 2013

ARM CPUs with the virtualization extension have a new mode called
HYP mode, which allows hypervisors to safely control and monitor
guests. The current hypervisor (KVM and Xen) implementations
require the kernel to be entered in that HYP mode.

This patch series introduces a new U-Boot command called "hypmode"
which can be used at any time at the U-Boot command prompt to
switch the CPU into HYP mode - ideally this would be done before
starting the kernel. Since U-Boot does not use the MMU, it runs fine
in HYP mode, so you could as well enter HYP mode earlier.

The process of switching into HYP mode requires the CPU to be in
non-secure state, which requires the GIC to be programmed properly
first. Explanations about the details are in the commit messages
of the respective patches.

The code aims to be as generic as possible, though currently it has
only been tested on the Versatile Express TC-2 board. The last patch
thus enables the feature for that board and relies on the Versatile
Express updates patches sent out lately[1]. 

I would like to get some feedback on the patches, especially about:
1) Is the code in the right places? I used arch/arm/lib/ and
arch/arm/cpu/armv7/ as directories for the ARM code and
common/ for the actual command.
2) Is a command to switch to HYP actually the right thing? Should
HYP be entered automatically instead? Or provide an option to skip
HYP mode if requested by the user?
3) Does it make sense to provide a "nonsec" command also? I cannot
name any usecases by now, but the implementation would be rather
easy with basically all the functionality already there.

In general I appreciate any comments about coding style, patch
layout or the actual implementation.

Thanks for watching!


[1] http://lists.denx.de/pipermail/u-boot/2013-April/151366.html

Andre Przywara (6):
  ARM: add secure monitor handler to switch to non-secure state
  ARM: add assembly routine to switch to non-secure state
  ARM: add U-Boot command "hypmode" to switch to non-secure state
  ARM: add SMP support for non-secure switch
  ARM: extend non-secure switch to also go into HYP mode
  ARM: VExpress: enable ARMv7 virt support for VExpress A15

 arch/arm/cpu/armv7/start.S          | 116 ++++++++++++++++++++++++++++---
 arch/arm/include/asm/armv7.h        |   2 +
 arch/arm/lib/Makefile               |   2 +
 arch/arm/lib/virt-v7.c              | 132 ++++++++++++++++++++++++++++++++++++
 common/Makefile                     |   1 +
 common/cmd_virt.c                   |  65 ++++++++++++++++++
 include/configs/vexpress_ca15_tc2.h |   3 +
 7 files changed, 311 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/lib/virt-v7.c
 create mode 100644 common/cmd_virt.c


More information about the U-Boot mailing list