Xen ARM with Virtualization Extensions/Lager

From Xen
Jump to navigationJump to search

The Lager board based on Renesas R-Car H2 SoC is now supported in Xen upstream.

Prepare U-boot

Get u-boot sources

Clone sources from: git://git.denx.de/u-boot.git Checkout on commit, hash: f7ca1f7, net: sh-eth: Add cache writeback control after setting bit of DMA descriptor

Apply additional patches

Download archive with needed patches (renesas_uboot_patches.tar) from: [1]

Apply patches from renesas_uboot_patches.tar

Build u-boot

Build u-boot with "lager_xen_defconfig" configuration:

# make lager_xen_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

Flash u-boot

Flash u-boot to QSPI as described in Start-Up Guide fot Renesas Lager board.

Check u-boot environment variables

bootargs=console=ttySC6,38400
bootcmd=tftp 0x70007fc0 xen-uImage;tftp 0x70f00000 uImage-r8a7790-lager.dtb;tftp 0x72000000 zImage-uImage;tftp 0x74000000 xenpolicy;bootm 0x70007fc0 – 0x70f00000

or just reset the configuration:

env default -a -f
env set baudrate 38400
env set ethaddr 2e:09:0a:00:6d:c9
env set ipaddr 192.168.0.5
env set serverip 192.168.0.15
env set gatewayip 192.168.0.15
env set netmask 255.255.255.0
env set dnsip
env set dnsip2
env set hostname lager
env set bootargs console=ttySC6,38400
env set bootcmd tftp 0x70007fc0 xen-uImage\;tftp 0x70f00000 uImage-r8a7790-lager.dtb\;tftp 0x72000000 zImage-uImage\;tftp 0x74000000 xenpolicy\;bootm 0x70007fc0 - 0x70f00000
env save; reset

where:

  • xen-uImage – Xen image
  • uImage-r8a7790-lager.dtb – device tree blob
  • zImage-uImage – Dom0 kernel image
  • xenpolicy – Xen policy binary

Prepare Xen

Get Xen source

Clone sources from upstream: git://xenbits.xen.org/xen.git

Checkout on branch: stable-4.5 , and apply three patches from [xen-devel]: http://markmail.org/message/houjwx7vima3a53i

- OR -

Checkout on branch: stable-4.6 , where the above patches are already committed.


Configure Xen

# XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y XSM_ENABLE=y CONFIG_EARLY_PRINTK=lager ./configure

Build Xen

Build Xen with command with earlyprintk support:

# make xen XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y XSM_ENABLE=y CONFIG_EARLY_PRINTK=lager

Build Xen with command without earlyprintk support:

# make xen XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y XSM_ENABLE=y

Make uImage for Xen

Make uImage for Xen with command:

# mkimage -A arm -C none -T kernel -a 0x90000000 -e 0x90000000 -n "XEN" -d xen/xen xen-uImage

Build xenpolicy

Build xenpolicy binary:

# make -C tools/flask/policy


Prepare Dom0 / Device Tree

This might be close to a working solution:

Get a LAGER board Device Tree for re-basing from:

# git clone git://xenbits.xen.org/people/ianc/device-tree-rebasing.git
# cd device-tree-rebasing

Add Xen-specifics, for example via a new DTS file ( src/arm/r8a7790-lager-xen.dts ) that includes the existing one for the LAGER board:

/*
 * Device Tree Source for the R-CarH2 LAGER board
 *
 * Adding Xen4.6 configuration to boot some Linux as Dom0
 *
 */

#include "r8a7790-lager.dts"

/ {
	chosen {

		/* bootargs are present and used for native Linux without Xen, see
		 * http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/arm/device-tree/booting.txt
		 */
		xen,xen-bootargs = "console=dtuart dom0_mem=1G";

		/* Dom0 kernel */
		xen,dom0-bootargs = "console=hvc0 vmalloc=384M video=HDMI-A-1:1920x1080-32@60 ip=192.168.0.5:192.168.0.15:192.168.0.15:255.255.255.0:lager:eth0::: root=/dev/nfs rw nfsroot=192.168.0.15:/nfsroot rootwait clk_ignore_unused";

		modules {
			#address-cells = <1>;
			#size-cells = <1>;

			module@0x72000000 {
				compatible = "multiboot,kernel", "multiboot,module";
				/* reg = <0x72000000 0x2fd158>; */
			};

			/* XSM Xen Security Policy */
			module@0x74000000 {
				compatible = "xen,xsm-policy", "multiboot,module";
				/* reg = <0x74000000 0x2559>; */
			};
		};
	};

	/* add required 'ranges;' to all PCI devices */
	pci0: pci@ee090000 {
		usb@0,1 {
			#address-cells = <3>;
			#size-cells = <2>;
			ranges;
		};
		usb@0,2 {
			#address-cells = <3>;
			#size-cells = <2>;
			ranges;
		};
	};
	pci2: pci@ee0d0000 {
		usb@0,1 {
			#address-cells = <3>;
			#size-cells = <2>;
			ranges;
		};
		usb@0,2 {
			#address-cells = <3>;
			#size-cells = <2>;
			ranges;
		};
	};
};

Before giving the device tree to U-Boot, convert the DTS into a DTB:

# make src/arm/r8a7790-lager-xen.dtb

Please note that the Makefile does not know about DTB-include dependencies!

(TBD: Prepare Dom0)

Prepare other domains

(TBD)