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