blob: 00dd86f29e615c8088e362fb1cdb69bb2b12fd81 [file] [log] [blame] [view]
David Brazdil0dbb41f2019-09-09 18:03:35 +01001# Hafnium Manifest
2
3## Format
4
5The format of the manifest is a simple DeviceTree overlay:
6
7```
8/dts-v1/;
9/plugin/;
10
11&{/} {
12 hypervisor {
David Brazdilea707d62019-11-06 10:10:17 +000013 compatible = "hafnium,hafnium";
14
David Brazdil0dbb41f2019-09-09 18:03:35 +010015 vm1 {
16 debug_name = "name";
Andrew Scull72b43c02019-09-18 13:53:45 +010017 kernel_filename = "vmlinuz";
David Brazdile6f83222019-09-23 14:47:37 +010018 ramdisk_filename = "initrd.img";
David Brazdil0dbb41f2019-09-09 18:03:35 +010019 };
20
21 vm2 {
22 debug_name = "name";
23 kernel_filename = "filename";
24 vcpu_count = <N>;
25 mem_size = <M>;
26 };
27 ...
28 };
29};
30```
31
32Note: `&{/}` is a syntactic sugar expanded by the DTC compiler. Make sure to
33use the DTC in `prebuilts/` as the version packaged with your OS may not support
34it yet.
35
36## Example
37
Andrew Scull72b43c02019-09-18 13:53:45 +010038The following manifest defines a primary VM with two secondary VMs. The first
39secondary VM has 1MB of memory, 2 CPUs and kernel image called `kernel0`
40(matches filename in Hafnium's [ramdisk](HafniumRamDisk.md)). The second has 2MB
41of memory, 4 CPUs and, by omitting the `kernel_filename` property, a kernel
42preloaded into memory. The primary VM is given all remaining memory, the same
David Brazdile6f83222019-09-23 14:47:37 +010043number of CPUs as the hardware, a kernel image called `vmlinuz` and a ramdisk
44`initrd.img`. Secondaries cannot have a ramdisk.
David Brazdil0dbb41f2019-09-09 18:03:35 +010045
46```
47/dts-v1/;
48/plugin/;
49
50&{/} {
51 hypervisor {
David Brazdilea707d62019-11-06 10:10:17 +000052 compatible = "hafnium,hafnium";
53
David Brazdil0dbb41f2019-09-09 18:03:35 +010054 vm1 {
55 debug_name = "primary VM";
Andrew Scull72b43c02019-09-18 13:53:45 +010056 kernel_filename = "vmlinuz";
David Brazdile6f83222019-09-23 14:47:37 +010057 ramdisk_filename = "initrd.img";
Andrew Scullae9962e2019-10-03 16:51:16 +010058
59 smc_whitelist = <
60 0x04000000
61 0x3200ffff
62 >;
David Brazdil0dbb41f2019-09-09 18:03:35 +010063 };
64
65 vm2 {
66 debug_name = "secondary VM 1";
67 kernel_filename = "kernel0";
68 vcpu_count = <2>;
69 mem_size = <0x100000>;
Andrew Scullae9962e2019-10-03 16:51:16 +010070
Andrew Scull5dc089e2019-11-04 13:21:03 +000071 smc_whitelist_permissive;
David Brazdil0dbb41f2019-09-09 18:03:35 +010072 };
73
74 vm3 {
75 debug_name = "secondary VM 2";
David Brazdil0dbb41f2019-09-09 18:03:35 +010076 vcpu_count = <4>;
77 mem_size = <0x200000>;
78 };
79 };
80};
81```
82
83## Compiling
84
85Hafnium expects the manifest as part of the board FDT, i.e. DeviceTree in binary
86format (DTB).
87
88First, compile the manifest into a DTBO (binary overlay):
89```shell
90prebuilts/linux-x64/dtc/dtc -I dts -O dtb --out-version 17 -o manifest.dtbo <manifest_source_file>
91```
92
93Then overlay it with the DTB of your board:
94```shell
95prebuilts/linux-x64/dtc/fdtoverlay -i <board DTB> -o <output DTB> manifest.dtbo
96```