David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 1 | # Hafnium Manifest |
| 2 | |
| 3 | ## Format |
| 4 | |
| 5 | The format of the manifest is a simple DeviceTree overlay: |
| 6 | |
| 7 | ``` |
| 8 | /dts-v1/; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 9 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 10 | / { |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 11 | hypervisor { |
David Brazdil | ea707d6 | 2019-11-06 10:10:17 +0000 | [diff] [blame] | 12 | compatible = "hafnium,hafnium"; |
| 13 | |
Olivier Deprez | 622ab8d | 2021-08-02 12:15:45 +0200 | [diff] [blame] | 14 | ffa_tee_enabled; |
Andrew Walbran | 41a49d8 | 2020-01-10 17:46:38 +0000 | [diff] [blame] | 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 |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 41 | `initrd.img`. Secondaries cannot have a ramdisk. FF-A memory sharing with the |
Andrew Walbran | 41a49d8 | 2020-01-10 17:46:38 +0000 | [diff] [blame] | 42 | TEE is enabled. |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 43 | |
| 44 | ``` |
| 45 | /dts-v1/; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 46 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 47 | / { |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 48 | hypervisor { |
David Brazdil | ea707d6 | 2019-11-06 10:10:17 +0000 | [diff] [blame] | 49 | compatible = "hafnium,hafnium"; |
| 50 | |
Olivier Deprez | 622ab8d | 2021-08-02 12:15:45 +0200 | [diff] [blame] | 51 | ffa_tee_enabled; |
Andrew Walbran | 41a49d8 | 2020-01-10 17:46:38 +0000 | [diff] [blame] | 52 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 53 | vm1 { |
| 54 | debug_name = "primary VM"; |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 55 | kernel_filename = "vmlinuz"; |
David Brazdil | e6f8322 | 2019-09-23 14:47:37 +0100 | [diff] [blame] | 56 | ramdisk_filename = "initrd.img"; |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 57 | |
| 58 | smc_whitelist = < |
| 59 | 0x04000000 |
| 60 | 0x3200ffff |
| 61 | >; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | vm2 { |
| 65 | debug_name = "secondary VM 1"; |
| 66 | kernel_filename = "kernel0"; |
| 67 | vcpu_count = <2>; |
| 68 | mem_size = <0x100000>; |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 69 | |
Andrew Scull | 5dc089e | 2019-11-04 13:21:03 +0000 | [diff] [blame] | 70 | smc_whitelist_permissive; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | vm3 { |
| 74 | debug_name = "secondary VM 2"; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 75 | vcpu_count = <4>; |
| 76 | mem_size = <0x200000>; |
| 77 | }; |
| 78 | }; |
| 79 | }; |
| 80 | ``` |
| 81 | |
Olivier Deprez | 4168203 | 2021-04-21 10:29:21 +0200 | [diff] [blame] | 82 | ## FF-A partition |
| 83 | Partitions wishing to follow the FF-A specification must respect the |
| 84 | format specified by the [TF-A binding document](https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html). |
Olivier Deprez | 62d99e3 | 2020-01-09 15:58:07 +0100 | [diff] [blame] | 85 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 86 | ## Compiling |
| 87 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 88 | Hafnium expects the manifest inside its [RAM disk](HafniumRamDisk.md), |
| 89 | in DeviceTree's binary format (DTB). |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 90 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 91 | Compile the manifest's source file into a DTB with: |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 92 | ```shell |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 93 | 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] | 94 | ``` |