David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 1 | # Hafnium Manifest |
| 2 | |
Andrew Walbran | b784997 | 2019-11-15 15:23:43 +0000 | [diff] [blame] | 3 | [TOC] |
| 4 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 5 | ## Format |
| 6 | |
| 7 | The format of the manifest is a simple DeviceTree overlay: |
| 8 | |
| 9 | ``` |
| 10 | /dts-v1/; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 11 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame^] | 12 | / { |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 13 | hypervisor { |
David Brazdil | ea707d6 | 2019-11-06 10:10:17 +0000 | [diff] [blame] | 14 | compatible = "hafnium,hafnium"; |
| 15 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 16 | vm1 { |
| 17 | debug_name = "name"; |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 18 | kernel_filename = "vmlinuz"; |
David Brazdil | e6f8322 | 2019-09-23 14:47:37 +0100 | [diff] [blame] | 19 | ramdisk_filename = "initrd.img"; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 20 | }; |
| 21 | |
| 22 | vm2 { |
| 23 | debug_name = "name"; |
| 24 | kernel_filename = "filename"; |
| 25 | vcpu_count = <N>; |
| 26 | mem_size = <M>; |
| 27 | }; |
| 28 | ... |
| 29 | }; |
| 30 | }; |
| 31 | ``` |
| 32 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 33 | ## Example |
| 34 | |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 35 | The following manifest defines a primary VM with two secondary VMs. The first |
| 36 | secondary VM has 1MB of memory, 2 CPUs and kernel image called `kernel0` |
| 37 | (matches filename in Hafnium's [ramdisk](HafniumRamDisk.md)). The second has 2MB |
| 38 | of memory, 4 CPUs and, by omitting the `kernel_filename` property, a kernel |
| 39 | preloaded into memory. The primary VM is given all remaining memory, the same |
David Brazdil | e6f8322 | 2019-09-23 14:47:37 +0100 | [diff] [blame] | 40 | number of CPUs as the hardware, a kernel image called `vmlinuz` and a ramdisk |
| 41 | `initrd.img`. Secondaries cannot have a ramdisk. |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 42 | |
| 43 | ``` |
| 44 | /dts-v1/; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 45 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame^] | 46 | / { |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 47 | hypervisor { |
David Brazdil | ea707d6 | 2019-11-06 10:10:17 +0000 | [diff] [blame] | 48 | compatible = "hafnium,hafnium"; |
| 49 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 50 | vm1 { |
| 51 | debug_name = "primary VM"; |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 52 | kernel_filename = "vmlinuz"; |
David Brazdil | e6f8322 | 2019-09-23 14:47:37 +0100 | [diff] [blame] | 53 | ramdisk_filename = "initrd.img"; |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 54 | |
| 55 | smc_whitelist = < |
| 56 | 0x04000000 |
| 57 | 0x3200ffff |
| 58 | >; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | vm2 { |
| 62 | debug_name = "secondary VM 1"; |
| 63 | kernel_filename = "kernel0"; |
| 64 | vcpu_count = <2>; |
| 65 | mem_size = <0x100000>; |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 66 | |
Andrew Scull | 5dc089e | 2019-11-04 13:21:03 +0000 | [diff] [blame] | 67 | smc_whitelist_permissive; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | vm3 { |
| 71 | debug_name = "secondary VM 2"; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 72 | vcpu_count = <4>; |
| 73 | mem_size = <0x200000>; |
| 74 | }; |
| 75 | }; |
| 76 | }; |
| 77 | ``` |
| 78 | |
| 79 | ## Compiling |
| 80 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame^] | 81 | Hafnium expects the manifest inside its [RAM disk](HafniumRamDisk.md), |
| 82 | in DeviceTree's binary format (DTB). |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 83 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame^] | 84 | Compile the manifest's source file into a DTB with: |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 85 | ```shell |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame^] | 86 | prebuilts/linux-x64/dtc/dtc -I dts -O dtb --out-version 17 -o manifest.dtb <manifest_source_file> |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 87 | ``` |