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 | |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 16 | ffa_tee; |
Andrew Walbran | 41a49d8 | 2020-01-10 17:46:38 +0000 | [diff] [blame] | 17 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 18 | vm1 { |
| 19 | debug_name = "name"; |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 20 | kernel_filename = "vmlinuz"; |
David Brazdil | e6f8322 | 2019-09-23 14:47:37 +0100 | [diff] [blame] | 21 | ramdisk_filename = "initrd.img"; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | vm2 { |
| 25 | debug_name = "name"; |
| 26 | kernel_filename = "filename"; |
| 27 | vcpu_count = <N>; |
| 28 | mem_size = <M>; |
| 29 | }; |
| 30 | ... |
| 31 | }; |
| 32 | }; |
| 33 | ``` |
| 34 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 35 | ## Example |
| 36 | |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 37 | The following manifest defines a primary VM with two secondary VMs. The first |
| 38 | secondary VM has 1MB of memory, 2 CPUs and kernel image called `kernel0` |
| 39 | (matches filename in Hafnium's [ramdisk](HafniumRamDisk.md)). The second has 2MB |
| 40 | of memory, 4 CPUs and, by omitting the `kernel_filename` property, a kernel |
| 41 | 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] | 42 | 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] | 43 | `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] | 44 | TEE is enabled. |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 45 | |
| 46 | ``` |
| 47 | /dts-v1/; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 48 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 49 | / { |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 50 | hypervisor { |
David Brazdil | ea707d6 | 2019-11-06 10:10:17 +0000 | [diff] [blame] | 51 | compatible = "hafnium,hafnium"; |
| 52 | |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 53 | ffa_tee; |
Andrew Walbran | 41a49d8 | 2020-01-10 17:46:38 +0000 | [diff] [blame] | 54 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 55 | vm1 { |
| 56 | debug_name = "primary VM"; |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 57 | kernel_filename = "vmlinuz"; |
David Brazdil | e6f8322 | 2019-09-23 14:47:37 +0100 | [diff] [blame] | 58 | ramdisk_filename = "initrd.img"; |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 59 | |
| 60 | smc_whitelist = < |
| 61 | 0x04000000 |
| 62 | 0x3200ffff |
| 63 | >; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | vm2 { |
| 67 | debug_name = "secondary VM 1"; |
| 68 | kernel_filename = "kernel0"; |
| 69 | vcpu_count = <2>; |
| 70 | mem_size = <0x100000>; |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 71 | |
Andrew Scull | 5dc089e | 2019-11-04 13:21:03 +0000 | [diff] [blame] | 72 | smc_whitelist_permissive; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | vm3 { |
| 76 | debug_name = "secondary VM 2"; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 77 | vcpu_count = <4>; |
| 78 | mem_size = <0x200000>; |
| 79 | }; |
| 80 | }; |
| 81 | }; |
| 82 | ``` |
| 83 | |
Olivier Deprez | 4168203 | 2021-04-21 10:29:21 +0200 | [diff] [blame^] | 84 | ## FF-A partition |
| 85 | Partitions wishing to follow the FF-A specification must respect the |
| 86 | 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] | 87 | |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 88 | ## Compiling |
| 89 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 90 | Hafnium expects the manifest inside its [RAM disk](HafniumRamDisk.md), |
| 91 | in DeviceTree's binary format (DTB). |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 92 | |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 93 | Compile the manifest's source file into a DTB with: |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 94 | ```shell |
David Brazdil | a2358d4 | 2020-01-27 18:51:38 +0000 | [diff] [blame] | 95 | 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] | 96 | ``` |