Xen ARM with Virtualization Extensions/OMAP5432 uEVM

From Xen
Jump to: navigation, search

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

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.

diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts
index 3b99ec2..db58879 100644
--- a/arch/arm/boot/dts/omap5-uevm.dts
+++ b/arch/arm/boot/dts/omap5-uevm.dts
@@ -199,7 +199,7 @@
 };

 &mmc1 {
-       vmmc-supply = <&ldo9_reg>;
+       vmmc-supply = <&vmmcsd_fixed>;
        bus-width = <4>;
 };

@@ -214,14 +214,6 @@
        ti,non-removable;
 };

-&mmc4 {
-       status = "disabled";
-};
-
-&mmc5 {
-       status = "disabled";
-};
-
 &i2c1 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c1_pins>;
@@ -436,10 +428,6 @@
        clock-frequency = <400000>;
 };

-&mcbsp3 {
-       status = "disabled";
-};
-
 &usbhshost {
        port2-mode = "ehci-hsic";
        port3-mode = "ehci-hsic”;
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index f8c9855..82d91ba 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>;
        };

        /*
@@ -582,7 +584,6 @@
                        ti,hwmods = "dmic";
                        dmas = <&sdma 67>;
                        dma-names = "up_link";
-                       status = "disabled";
                };

                mcbsp1: mcbsp@40122000 {
@@ -597,7 +598,6 @@
                        dmas = <&sdma 33>,
                               <&sdma 34>;
                        dma-names = "tx", "rx";
-                       status = "disabled";
                };

                mcbsp2: mcbsp@40124000 {
@@ -612,7 +612,6 @@
                        dmas = <&sdma 17>,
                               <&sdma 18>;
                        dma-names = "tx", "rx";
-                       status = "disabled";
                };

                mcbsp3: mcbsp@40126000 {
@@ -627,7 +626,6 @@
                        dmas = <&sdma 19>,
                               <&sdma 20>;
                        dma-names = "tx", "rx";
-                       status = "disabled";
                };

                timer1: timer@4ae18000 {

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 # setenv dtb_addr_r 0x825f0000
OMAP5430 EVM # setenv xen_addr_r 0x90000000
OMAP5430 EVM # setenv kernel_addr_r 0xa0000000
OMAP5430 EVM # setenv xen_bootargs 'sync_console console=dtuart dtuart=serial2'
OMAP5430 EVM # setenv dom0_bootargs 'console=hvc0,115200n8 earlyprintk=xen debug ignore_loglevel root=/dev/mmcblk0p2 rw rootwait fixrtc'
OMAP5430 EVM # fatload mmc 0:1 $dtb_addr_r omap5-uevm.dtb
OMAP5430 EVM # fatload mmc 0:1 $xen_addr_r xen-uImage
OMAP5430 EVM # fatload mmc 0:1 $kernel_addr_r zImage
OMAP5430 EVM # fdt addr $dtb_addr_r
OMAP5430 EVM # fdt resize
OMAP5430 EVM # fdt set /chosen xen,xen-bootargs \"$xen_bootargs\"
OMAP5430 EVM # fdt resize
OMAP5430 EVM # fdt set /chosen xen,dom0-bootargs \"$dom0_bootargs\"
OMAP5430 EVM # fdt mknode /chosen modules
OMAP5430 EVM # fdt set /chosen/modules '#address-cells' <1>
OMAP5430 EVM # fdt set /chosen/modules '#size-cells' <1>
OMAP5430 EVM # fdt mknode /chosen/modules module@0
OMAP5430 EVM # fdt set /chosen/modules/module@0 compatible xen,linux-zimage xen,multiboot-module
OMAP5430 EVM # fdt set /chosen/modules/module@0 reg <$kernel_addr_r 0xa00000>
OMAP5430 EVM # bootm $xen_addr_r - $dtb_addr_r

4. Booting DomU

(TBD)