1Booting Xen
2===========
3
4Xen follows the zImage protocol defined for 32-bit ARM Linux[1] and the
5Image protocol defined for ARM64 Linux[2].
6
7In both cases the recommendation to boot in HYP/EL2 mode is a strict
8requirement for Xen.
9
10The exceptions to this on 32-bit ARM are as follows:
11
12 Xen does not require the machine type to be passed in r1. This
13 register is ignored (so may be invalid or the actual machine type).
14
15 Xen does not support the ATAG list and requires Device
16 Tree. Therefore r2 must point to the physical address of device tree
17 block (dtb) in system RAM.
18
19 NOTE: although Xen uses the zImage protocol there is no compression
20 actually used. This should be transparent to the bootloader. The
21 zImage protocol should still be used and not the stricter "raw
22 (non-zImage)" protocol described in arm/Booting.
23
24The exceptions to this on 64-bit ARM are as follows:
25
26 Xen binary should be loaded in memory below 10 TiB.
27
28Booting Guests
29--------------
30
31Xen supports the legacy image header[3], zImage protocol for 32-bit
32ARM Linux[1] and Image protocol defined for ARM64[2].
33
34Until Xen 4.17, in case of legacy image protocol, Xen ignored the load
35address and entry point specified in the header. This has now changed.
36
37Now, it loads the image at the load address provided in the header.
38And the entry point is used as the kernel start address.
39
40A deviation from uboot is that, Xen treats "load address == 0x0" as
41position independent execution (PIE). Thus, Xen will load such an image
42at an address it considers appropriate. Also, user cannot specify the
43entry point of a PIE image since the start address cennot be
44predetermined.
45
46Users who want to use Xen with statically partitioned domains, can provide
47the fixed non zero load address and start address for the dom0/domU kernel.
48The load address and start address specified by the user in the header must
49be within the memory region allocated by Xen.
50
51Also, it is to be noted that if user provides the legacy image header on
52top of zImage or Image header, then Xen uses the attributes of legacy
53image header to determine the load address, entry point, etc.
54
55
56Firmware/bootloader requirements
57--------------------------------
58
59Xen relies on some settings the firmware has to configure in EL3 before starting Xen.
60
61* Xen must be entered in NS EL2 mode
62
63* The bit SCR_EL3.HCE (resp. SCR.HCE for 32-bit ARM) must be set to 1.
64
65
66[1] linux/Documentation/arm/booting.rst
67Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arch/arm/booting.rst
68
69[2] linux/Documentation/arm64/booting.rst
70Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arch/arm64/booting.rst
71
72[3] legacy format header
73Latest version: https://source.denx.de/u-boot/u-boot/-/blob/master/include/image.h#L315
74https://linux.die.net/man/1/mkimage
75