Difference between revisions of "R-Car/Virtualization"

From eLinux.org
Jump to: navigation, search
(Improve perfomance using KVM)
(Document building ARM trusted firmware with HYP support)
Line 52: Line 52:
 
during bootup, HYP mode is not available, and KVM cannot be used, unless you first replace the firmware of your board with a version that supports HYP mode.
 
during bootup, HYP mode is not available, and KVM cannot be used, unless you first replace the firmware of your board with a version that supports HYP mode.
  
TODO: Document trusted firmware upgrade, including [https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-renesas-rcar-gen3.git;a=blob;f=meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-Boot-Normal-World-in-EL2.patch;h=6ce9c0f9d36efe99d901511a7675836f5e1562ac;hb=b4664bea0fa3a72f04f1cb42ce5dfeb9cb428f87 0001-Boot-Normal-World-in-EL2.patch]
+
To build your own ARM trusted firmware with hypervisor mode support, download [https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-renesas-rcar-gen3.git;a=blob;f=meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-Boot-Normal-World-in-EL2.patch;h=6ce9c0f9d36efe99d901511a7675836f5e1562ac;hb=b4664bea0fa3a72f04f1cb42ce5dfeb9cb428f87 0001-Boot-Normal-World-in-EL2.patch], and do:
 +
<pre>
 +
$ git clone git@github.com:renesas-rcar/arm-trusted-firmware.git
 +
$ cd arm-trusted-firmware
 +
$ git am .../0001-Boot-Normal-World-in-EL2.patch
 +
$ make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rcar LSI=H3 # or LSI=M3
 +
</pre>
 +
 
 +
Replace the BL2 and BL31 binaries in your firmware package by the generated "build/rcar/release/bl2.srec" and "build/rcar/release/bl31.srec", and follow your normal firmware upgrade procedure.
 +
 
  
 
== Running QEMU with KVM ==
 
== Running QEMU with KVM ==

Revision as of 06:33, 11 January 2018

Virtualization on Renesas R-Car Platforms

Prerequisites

  • QEMU (e.g. "apt-get install qemu-system-arm"),
  • A guest image, e.g. "openwrt-arm64-qemu-virt.Image" from OpenWRT.


Running QEMU

$ qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt -nographic -kernel openwrt-arm64-qemu-virt.Image

and press <ENTER> to enjoy your new ARM64 system!


Using KVM

When using an arm64 platform as the host system, guest performance can be improved drastically by making use of the Kernel-based Virtual Machine (KVM).

Host Kernel Configuration

Make sure your host kernel has the following options enabled:

CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y

"renesas_defconfig" should be fine.


Firmware Support

To use KVM, the firmware on your board must start Linux in hypervisor (EL2 / HYP) mode.

If your host kernel prints:

CPU: All CPU(s) started at EL2
...
kvm [1]: Hyp mode initialized successfully

during boot up, everything is fine.

If your host kernel prints:

CPU: All CPU(s) started at EL1
...
kvm [1]: HYP mode not available

during bootup, HYP mode is not available, and KVM cannot be used, unless you first replace the firmware of your board with a version that supports HYP mode.

To build your own ARM trusted firmware with hypervisor mode support, download 0001-Boot-Normal-World-in-EL2.patch, and do:

$ git clone git@github.com:renesas-rcar/arm-trusted-firmware.git
$ cd arm-trusted-firmware
$ git am .../0001-Boot-Normal-World-in-EL2.patch
$ make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rcar LSI=H3 # or LSI=M3 

Replace the BL2 and BL31 binaries in your firmware package by the generated "build/rcar/release/bl2.srec" and "build/rcar/release/bl31.srec", and follow your normal firmware upgrade procedure.


Running QEMU with KVM

$ qemu-system-aarch64 -enable-kvm -m 1024 -cpu cortex-a57 -M virt -nographic -kernel openwrt-arm64-qemu-virt.Image

and press <ENTER> to enjoy a faster new ARM64 system!