Skip to content

Commit

Permalink
arm/efi: Use dom0less configuration when using EFI boot
Browse files Browse the repository at this point in the history
This patch introduces the support for dom0less configuration
when using UEFI boot on ARM, it permits the EFI boot to
continue if no dom0 kernel is specified but at least one domU
is found.

Introduce the new property "xen,uefi-binary" for device tree boot
module nodes that are subnode of "xen,domain" compatible nodes.
The property holds a string containing the file name of the
binary that shall be loaded by the uefi loader from the filesystem.

Introduce a new call efi_check_dt_boot(...) called during EFI boot
that checks for module to be loaded using device tree.
Architectures that don't support device tree don't have to
provide this function.

Update efi documentation about how to start a dom0less
setup using UEFI

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
[stefano: drop inline from efi_check_dt_boot]
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
  • Loading branch information
luca-fancellu authored and Stefano Stabellini committed Oct 12, 2021
1 parent eb7518b commit a1743fc
Show file tree
Hide file tree
Showing 4 changed files with 550 additions and 12 deletions.
21 changes: 21 additions & 0 deletions docs/misc/arm/device-tree/booting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ The kernel sub-node has the following properties:

Command line parameters for the guest kernel.

- xen,uefi-binary (UEFI boot only)

String property that specifies the file name to be loaded by the UEFI boot
for this module. If this is specified, there is no need to specify the reg
property because it will be created by the UEFI stub on boot.
This option is needed only when UEFI boot is used.

The ramdisk sub-node has the following properties:

- compatible
Expand All @@ -201,6 +208,13 @@ The ramdisk sub-node has the following properties:
Specifies the physical address of the ramdisk in RAM and its
length.

- xen,uefi-binary (UEFI boot only)

String property that specifies the file name to be loaded by the UEFI boot
for this module. If this is specified, there is no need to specify the reg
property because it will be created by the UEFI stub on boot.
This option is needed only when UEFI boot is used.


Example
=======
Expand Down Expand Up @@ -265,6 +279,13 @@ The dtb sub-node should have the following properties:
Specifies the physical address of the device tree binary fragment
RAM and its length.

- xen,uefi-binary (UEFI boot only)

String property that specifies the file name to be loaded by the UEFI boot
for this module. If this is specified, there is no need to specify the reg
property because it will be created by the UEFI stub on boot.
This option is needed only when UEFI boot is used.

As an example:

module@0xc000000 {
Expand Down
203 changes: 203 additions & 0 deletions docs/misc/efi.pandoc
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,206 @@ sbsign \
--output xen.signed.efi \
xen.unified.efi
```

## UEFI boot and dom0less on ARM

Dom0less feature is supported by ARM and it is possible to use it when Xen is
started as an EFI application.
The way to specify the domU domains is by Device Tree as specified in the
[dom0less](dom0less.html) documentation page under the "Device Tree
configuration" section, but instead of declaring the reg property in the boot
module, the user must specify the "xen,uefi-binary" property containing the name
of the binary file that has to be loaded in memory.
The UEFI stub will load the binary in memory and it will add the reg property
accordingly.

An example here:

domU1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xen,domain";
memory = <0 0x20000>;
cpus = <1>;
vpl011;

module@1 {
compatible = "multiboot,kernel", "multiboot,module";
xen,uefi-binary = "vmlinuz-3.0.31-0.4-xen";
bootargs = "console=ttyAMA0";
};
module@2 {
compatible = "multiboot,ramdisk", "multiboot,module";
xen,uefi-binary = "initrd-3.0.31-0.4-xen";
};
module@3 {
compatible = "multiboot,ramdisk", "multiboot,module";
xen,uefi-binary = "passthrough.dtb";
};
};

## How to boot different Xen setup using UEFI

These are the different ways to boot a Xen system from UEFI:

- Boot Xen and Dom0 (minimum required)
- Boot Xen and DomU(s) (true dom0less, only on ARM)
- Boot Xen, Dom0 and DomU(s) (only on ARM)

### Boot Xen and Dom0

This configuration can be started using the Xen configuration file in the
example above.

### Boot Xen and DomU(s)

This configuration needs the domU domain(s) specified in the /chosen node,
examples of how to do that are provided by the documentation about dom0less
and the example above shows how to use the "xen,uefi-binary" property to use the
UEFI stub for module loading.
When adding DomU modules to device tree, also add the property
xen,uefi-cfg-load under chosen for Xen to load the Xen config file.
Otherwise, Xen will skip the config file and rely on device tree alone.

Example 1 of how to boot a true dom0less configuration:

Xen configuration file: skipped.

Device tree:

```
chosen {
#size-cells = <0x1>;
#address-cells = <0x1>;
xen,xen-bootargs = "<Xen command line>"

domU1 {
#size-cells = <0x1>;
#address-cells = <0x1>;
compatible = "xen,domain";
cpus = <0x1>;
memory = <0x0 0xc0000>;
vpl011;

module@1 {
compatible = "multiboot,kernel", "multiboot,module";
xen,uefi-binary = "Image-domu1.bin";
bootargs = "console=ttyAMA0 root=/dev/ram0 rw";
};
};
domU2 {
#size-cells = <0x1>;
#address-cells = <0x1>;
compatible = "xen,domain";
cpus = <0x1>;
memory = <0x0 0x100000>;
vpl011;

module@2 {
compatible = "multiboot,kernel", "multiboot,module";
xen,uefi-binary = "Image-domu2.bin";
bootargs = "console=ttyAMA0 root=/dev/ram0 rw";
};
};
};
```

Example 2 of how to boot a true dom0less configuration:

Xen configuration file:

```
[global]
default=xen

[xen]
options=<Xen command line>
dtb=<optional DTB>
```

Device tree:

```
chosen {
#size-cells = <0x1>;
#address-cells = <0x1>;
xen,uefi-cfg-load;

domU1 {
#size-cells = <0x1>;
#address-cells = <0x1>;
compatible = "xen,domain";
cpus = <0x1>;
memory = <0x0 0xc0000>;
vpl011;

module@1 {
compatible = "multiboot,kernel", "multiboot,module";
xen,uefi-binary = "Image-domu1.bin";
bootargs = "console=ttyAMA0 root=/dev/ram0 rw";
};
};
domU2 {
#size-cells = <0x1>;
#address-cells = <0x1>;
compatible = "xen,domain";
cpus = <0x1>;
memory = <0x0 0x100000>;
vpl011;

module@2 {
compatible = "multiboot,kernel", "multiboot,module";
xen,uefi-binary = "Image-domu2.bin";
bootargs = "console=ttyAMA0 root=/dev/ram0 rw";
};
};
};
```

### Boot Xen, Dom0 and DomU(s)

This configuration is a mix of the two configuration above, to boot this one
the configuration file must be processed so the /chosen node must have the
"xen,uefi-cfg-load" property.

Here an example:

Xen configuration file:

```
[global]
default=xen

[xen]
options=<Xen command line>
kernel=vmlinuz-3.0.31-0.4-xen [domain 0 command line options]
ramdisk=initrd-3.0.31-0.4-xen
dtb=<optional DTB>
```

Device tree:

```
chosen {
#size-cells = <0x1>;
#address-cells = <0x1>;
xen,uefi-cfg-load;

domU1 {
#size-cells = <0x1>;
#address-cells = <0x1>;
compatible = "xen,domain";
cpus = <0x1>;
memory = <0x0 0xc0000>;
vpl011;

module@1 {
compatible = "multiboot,kernel", "multiboot,module";
xen,uefi-binary = "Image-domu1.bin";
bootargs = "console=ttyAMA0 root=/dev/ram0 rw";
};
};
};
```


0 comments on commit a1743fc

Please sign in to comment.