R-Car/Virtualization

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  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, and you can skip the next section.

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.

Enabling HYP Support
To build your own ARM Trusted Firmware with hypervisor mode support: $ git clone git@github.com:renesas-rcar/arm-trusted-firmware.git $ cd arm-trusted-firmware $ make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rcar RCAR_DRAM_SPLIT=3 RCAR_BL33_EXECUTION_EL=1 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  to enjoy a faster new ARM64 system!

Note that the above command requires running on a Cortex-A57 CPU core. When running on a Cortex-A53 CPU core in a big.LITTLE configuration, the command will fail with: kvm_init_vcpu failed: Invalid argument Just retry, or force your luck by disabling all Cortex-A53 cores: echo 0 > /sys/devices/system/cpu/cpuN/online for all "cpuN" representing Cortex-A53 cores.