Xen ARM with Virtualization Extensions/OMAP5432 uEVM
The OMAP5432 uEVM board is now supported in Xen upstream.
1. Prepare U-boot
Xen hypervisor requires to be booted in HYP mode by the bootloader. Make sure that the U-boot you use would keep staying in HYP mode when switching the control to Xen.
2. Build Xen and Linux Dom0
2.1 Build Xen hypervisor
Build Xen:
# git clone git://xenbits.xen.org/xen.git # cd xen # make dist-xen XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- CONFIG_EARLY_PRINTK=omap5432
Create uImage for Xen:
# mkimage -A arm -T kernel -a 0x80200000 -e 0x80200000 -C none -d "xen/xen" xen-uImage
2.2 Build Linux Dom0 kernel
Get the linux kernel source from upstream:
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Use the default ‘omap2plus' as the base config:
# make omap2plus_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
Before adding the XEN related kernel configs, disable old omap SoCs support by unselecting the TI OMAP2/3/4 in the ‘System Type’ section of kernel configuration menus (by running ‘make menuconfig ARCH=arm’).
Adding the following config entries in .config and run ‘make olddefconfig ARCH=arm’:
CONFIG_XEN_DOM0=y CONFIG_XEN=y CONFIG_XEN_BLKDEV_FRONTEND=y CONFIG_XEN_BLKDEV_BACKEND=y CONFIG_XEN_NETDEV_FRONTEND=y CONFIG_XEN_NETDEV_BACKEND=y CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y CONFIG_HVC_XEN=y CONFIG_HVC_XEN_FRONTEND=y CONFIG_XEN_DEV_EVTCHN=y CONFIG_XEN_BACKEND=y CONFIG_XENFS=y CONFIG_XEN_COMPAT_XENFS=y CONFIG_XEN_SYS_HYPERVISOR=y CONFIG_XEN_XENBUS_FRONTEND=y CONFIG_XEN_GNTDEV=y CONFIG_XEN_GRANT_DEV_ALLOC=y CONFIG_XEN_PRIVCMD=y
OMAP kernel still uses hwmod to describe its on-chip hardware blocks. Thus, we need to disable the UART3 used by Xen serial console by directly modifying the kernel source. Besides, there are also other modules that are disabled in DT while enabled in hwmod. Here is a hack to bypass the problem.
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index 8923172..bf7d988 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c @@ -2425,7 +2425,9 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = { &omap54xx_mpu__mpu_private, &omap54xx_l4_wkup__counter_32k, &omap54xx_l4_cfg__dma_system, +#if 0 &omap54xx_l4_abe__dmic, +#endif &omap54xx_l4_cfg__mmu_dsp, &omap54xx_mpu__emif1, &omap54xx_mpu__emif2, @@ -2445,9 +2447,11 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = { &omap54xx_l3_main_2__mmu_ipu, &omap54xx_l4_wkup__kbd, &omap54xx_l4_cfg__mailbox, +#if 0 &omap54xx_l4_abe__mcbsp1, &omap54xx_l4_abe__mcbsp2, &omap54xx_l4_abe__mcbsp3, +#endif &omap54xx_l4_abe__mcpdm, &omap54xx_l4_per__mcspi1, &omap54xx_l4_per__mcspi2, @@ -2456,8 +2460,10 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = { &omap54xx_l4_per__mmc1, &omap54xx_l4_per__mmc2, &omap54xx_l4_per__mmc3, +#if 0 &omap54xx_l4_per__mmc4, &omap54xx_l4_per__mmc5, +#endif &omap54xx_l4_cfg__mpu, &omap54xx_l4_cfg__spinlock, &omap54xx_l4_cfg__ocp2scp1, @@ -2474,7 +2480,9 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = { &omap54xx_l4_per__timer11, &omap54xx_l4_per__uart1, &omap54xx_l4_per__uart2, +#if 0 &omap54xx_l4_per__uart3, +#endif &omap54xx_l4_per__uart4, &omap54xx_l4_per__uart5, &omap54xx_l4_per__uart6,
Build the kernel:
# make zImage ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
2.3 Build FDT
Apply the patch below to the upstream linux kernel and build the device tree blob.
commit 7d6802fe562710d296881d5d9aeb5cfeff76354f Author: Chen Baozi <baozich@gmail.com> Date: Tue Apr 29 09:24:15 2014 +0800 arm: dts: OMAP5: Add Xen support in DTS of OMAP5432 uEVM diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts index 3b99ec2..18caa26 100644 --- a/arch/arm/boot/dts/omap5-uevm.dts +++ b/arch/arm/boot/dts/omap5-uevm.dts @@ -15,6 +15,27 @@ model = "TI OMAP5 uEVM board"; compatible = "ti,omap5-uevm", "ti,omap5"; + chosen { + bootargs = "dom0_mem=256M console=dtuart dtuart=serial2 earlyprintk=xen"; + xen,dom0-bootargs = "console=hvc0,115200n8 earlyprintk=xen debug ignore_loglevel root=/dev/mmcblk0p2 rw rootwait fixrtc"; + modules { + #address-cells = <1>; + #size-cells = <1>; + + module@0 { + compatible = "xen,linux-zimage", "xen,multiboot-module"; + reg = <0xa0000000 0xa00000>; + }; + }; + }; + + psci { + compatible = "arm,psci"; + method = "smc"; + cpu_off = <1>; + cpu_on = <2>; + }; + memory { device_type = "memory"; reg = <0x80000000 0x7F000000>; /* 2032 MB */ @@ -199,7 +220,7 @@ }; &mmc1 { - vmmc-supply = <&ldo9_reg>; + vmmc-supply = <&vmmcsd_fixed>; bus-width = <4>; }; diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index f8c9855..dfc229c 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi @@ -80,6 +80,7 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; + clock-frequency = <6144000>; }; gic: interrupt-controller@48211000 { @@ -90,6 +91,7 @@ <0x48212000 0x1000>, <0x48214000 0x2000>, <0x48216000 0x2000>; + interrupts = <1 9 0xf04>; }; /*
2.4 All together
Now we should have 3 files as following:
- xen-uImage
- zImage
- omap5-uevm.dtb
Then copy all these 3 files to the /boot partition of your MICRO-SD card.
3. Boot Xen and Dom0
Use the following U-boot command sequence to boot Xen & dom0:
OMAP5430 EVM # fatload mmc 0:1 0x825f0000 omap5-uevm.dtb OMAP5430 EVM # fatload mmc 0:1 0x90000000 xen-uImage OMAP5430 EVM # fatload mmc 0:1 0xa0000000 zImage OMAP5430 EVM # bootm 0x90000000 - 0x825f0000