1# Copyright 2021 The Hafnium Authors. 2# 3# Use of this source code is governed by a BSD-style 4# license that can be found in the LICENSE file or at 5# https://opensource.org/licenses/BSD-3-Clause. 6 7import("//build/image/image.gni") 8import("//src/arch/${plat_arch}/args.gni") 9import("//test/hftest/args.gni") 10 11config("config") { 12 include_dirs = [ "inc" ] 13} 14 15source_set("ffa_secure_partitions") { 16 testonly = true 17 public_configs = [ 18 ":config", 19 "//src/arch/${plat_arch}:config", 20 ] 21 22 sources = [ "ffa_secure_partitions.c" ] 23 24 deps = [ "//test/vmapi/common:ffa" ] 25} 26 27# VM that will control execution of tests in a VM-to-SP set-up 28vm_kernel("vm_primary") { 29 testonly = true 30 public_configs = [ 31 ":config", 32 "services/arch/${plat_arch}/secure:config", 33 "//src/arch/${plat_arch}:arch_config", 34 ] 35 36 sources = [ 37 "dir_msg.c", 38 "interrupts.c", 39 "memory_sharing.c", 40 "notifications.c", 41 "power_mgt.c", 42 "secure_interrupts.c", 43 "setup_and_discovery.c", 44 "smccc.c", 45 ] 46 47 deps = [ 48 ":ffa_secure_partitions", 49 "//src/arch/${plat_arch}/hftest:interrupts_gicv3", 50 "//src/arch/${plat_arch}/hftest:power_mgmt", 51 "//test/hftest:hftest_primary_vm", 52 "//test/vmapi/arch/${plat_arch}/gicv3:gicv3_setup", 53 "//test/vmapi/common:ffa", 54 "//test/vmapi/common/arch/aarch64:exception_handler", 55 "//vmlib", 56 ] 57} 58 59manifest("vm_primary_manifest") { 60 source = "partition_manifest_nwd_primary.dts" 61 output = "partition_manifest_nwd_primary.dtb" 62} 63 64partition_package("vm_primary_test_package") { 65 testonly = true 66 pm_offset = "0x1000" 67 img_offset = "0x2000" 68 files = [ [ 69 "partition_manifest_nwd_primary.dtb", 70 "vm_primary.bin", 71 ":vm_primary_manifest", 72 ":vm_primary", 73 ] ] 74 output = "vm_primary_test_package.img" 75} 76 77# VM that will control execution of tests in a VM-to-SP set-up 78# VM for running boot tests only 79vm_kernel("vm_primary_boot_fail_test_sp1") { 80 testonly = true 81 public_configs = [ 82 ":config", 83 "services/arch/${plat_arch}/secure:config", 84 "//src/arch/${plat_arch}:arch_config", 85 ] 86 defines = [ "FAILING_SP=1" ] 87 sources = [ "boot_fail.c" ] 88 89 deps = [ 90 ":ffa_secure_partitions", 91 "//test/hftest:hftest_primary_vm", 92 "//test/vmapi/common:ffa", 93 ] 94} 95 96# VM that will control execution of tests in a VM-to-SP set-up 97# VM for running boot tests only 98vm_kernel("vm_primary_boot_fail_test_sp2") { 99 testonly = true 100 public_configs = [ 101 ":config", 102 "services/arch/${plat_arch}/secure:config", 103 "//src/arch/${plat_arch}:arch_config", 104 ] 105 defines = [ "FAILING_SP=2" ] 106 sources = [ "boot_fail.c" ] 107 108 deps = [ 109 ":ffa_secure_partitions", 110 "//test/hftest:hftest_primary_vm", 111 "//test/vmapi/common:ffa", 112 ] 113} 114 115# VM that will control execution of tests in a VM-to-SP set-up 116# VM for running boot tests only 117vm_kernel("vm_primary_boot_fail_test_sp3") { 118 testonly = true 119 public_configs = [ 120 ":config", 121 "services/arch/${plat_arch}/secure:config", 122 "//src/arch/${plat_arch}:arch_config", 123 ] 124 defines = [ "FAILING_SP=3" ] 125 sources = [ "boot_fail.c" ] 126 127 deps = [ 128 ":ffa_secure_partitions", 129 "//test/hftest:hftest_primary_vm", 130 "//test/vmapi/common:ffa", 131 ] 132} 133 134partition_package("vm_primary_boot_fail_test_package_sp1") { 135 testonly = true 136 pm_offset = "0x1000" 137 img_offset = "0x2000" 138 files = [ [ 139 "partition_manifest_nwd_primary.dtb", 140 "vm_primary_boot_fail_test_sp1.bin", 141 ":vm_primary_manifest", 142 ":vm_primary_boot_fail_test_sp1", 143 ] ] 144 output = "vm_primary_boot_fail_test_package_sp1.img" 145} 146 147partition_package("vm_primary_boot_fail_test_package_sp2") { 148 testonly = true 149 pm_offset = "0x1000" 150 img_offset = "0x2000" 151 files = [ [ 152 "partition_manifest_nwd_primary.dtb", 153 "vm_primary_boot_fail_test_sp2.bin", 154 ":vm_primary_manifest", 155 ":vm_primary_boot_fail_test_sp2", 156 ] ] 157 output = "vm_primary_boot_fail_test_package_sp2.img" 158} 159 160partition_package("vm_primary_boot_fail_test_package_sp3") { 161 testonly = true 162 pm_offset = "0x1000" 163 img_offset = "0x2000" 164 files = [ [ 165 "partition_manifest_nwd_primary.dtb", 166 "vm_primary_boot_fail_test_sp3.bin", 167 ":vm_primary_manifest", 168 ":vm_primary_boot_fail_test_sp3", 169 ] ] 170 output = "vm_primary_boot_fail_test_package_sp3.img" 171} 172 173partitions_json("ffa_both_world_partitions_vhe_test") { 174 testonly = true 175 176 sps = [ 177 [ 178 "service_sp_first_package.img", 179 "services/arch/${plat_arch}/secure/manifest_service_sp_first.dts", 180 "services/arch/${plat_arch}/secure:service_sp_first_package", 181 "services/arch/${plat_arch}/secure:partition_manifest_service_sp_first", 182 ], 183 [ 184 "service_sp_second_el0_package.img", 185 "services/arch/${plat_arch}/secure/el0/manifest_service_sp_second.dts", 186 "services/arch/${plat_arch}/secure/el0:service_sp_second_package", 187 "services//arch/${plat_arch}/secure/el0:partition_manifest_service_sp_second", 188 ], 189 [ 190 "service_sp_third_package.img", 191 "services/arch/${plat_arch}/secure/manifest_service_sp_third.dts", 192 "services/arch/${plat_arch}/secure:service_sp_third_package", 193 "services/arch/${plat_arch}/secure:partition_manifest_service_sp_third", 194 ], 195 ] 196 197 vms = [ [ 198 "vm_primary_test_package.img", 199 "manifest.dts", 200 ":vm_primary_test_package", 201 ":vm_primary_test_package", 202 ] ] 203 204 json_file = "ffa_both_world_partitions_vhe_test.json" 205} 206 207partitions_json("ffa_both_world_partitions_test") { 208 testonly = true 209 210 sps = [ 211 [ 212 "service_sp_first_package.img", 213 "services/arch/aarch64/secure/manifest_service_sp_first.dts", 214 "services/arch/aarch64/secure:service_sp_first_package", 215 "services/arch/aarch64/secure:partition_manifest_service_sp_first", 216 ], 217 [ 218 "service_sp_second_package.img", 219 "services/arch/aarch64/secure/manifest_service_sp_second.dts", 220 "services/arch/aarch64/secure:service_sp_second_package", 221 "services/arch/aarch64/secure:partition_manifest_service_sp_second", 222 ], 223 [ 224 "service_sp_third_package.img", 225 "services/arch/aarch64/secure/manifest_service_sp_third.dts", 226 "services/arch/aarch64/secure:service_sp_third_package", 227 "services/arch/aarch64/secure:partition_manifest_service_sp_third", 228 ], 229 ] 230 231 vms = [ [ 232 "vm_primary_test_package.img", 233 "manifest.dts", 234 ":vm_primary_test_package", 235 ":vm_primary_test_package", 236 ] ] 237 238 json_file = "ffa_both_world_partitions_test.json" 239} 240 241partitions_json("ffa_both_world_partitions_boot_fail_test_sp1") { 242 testonly = true 243 244 sps = [ 245 [ 246 "service_sp_first_package_boot_fail_test.img", 247 "services/arch/aarch64/secure/manifest_service_sp_first.dts", 248 "services/arch/aarch64/secure:service_sp_first_package_boot_fail_test", 249 "services/arch/aarch64/secure:partition_manifest_service_sp_first", 250 ], 251 [ 252 "service_sp_second_package.img", 253 "services/arch/aarch64/secure/manifest_service_sp_second.dts", 254 "services/arch/aarch64/secure:service_sp_second_package", 255 "services/arch/aarch64/secure:partition_manifest_service_sp_second", 256 ], 257 [ 258 "service_sp_third_package.img", 259 "services/arch/aarch64/secure/manifest_service_sp_third.dts", 260 "services/arch/aarch64/secure:service_sp_third_package", 261 "services/arch/aarch64/secure:partition_manifest_service_sp_third", 262 ], 263 ] 264 265 vms = [ [ 266 "vm_primary_boot_fail_test_package_sp1.img", 267 "manifest.dts", 268 ":vm_primary_boot_fail_test_package_sp1", 269 ":vm_primary_boot_fail_test_package_sp1", 270 ] ] 271 272 json_file = "ffa_both_world_partitions_boot_fail_test_sp1.json" 273} 274 275partitions_json("ffa_both_world_partitions_boot_fail_test_sp2") { 276 testonly = true 277 278 sps = [ 279 [ 280 "service_sp_first_package.img", 281 "services/arch/aarch64/secure/manifest_service_sp_first.dts", 282 "services/arch/aarch64/secure:service_sp_first_package", 283 "services/arch/aarch64/secure:partition_manifest_service_sp_first", 284 ], 285 [ 286 "service_sp_second_package_boot_fail_test.img", 287 "services/arch/aarch64/secure/manifest_service_sp_second.dts", 288 "services/arch/aarch64/secure:service_sp_second_package_boot_fail_test", 289 "services/arch/aarch64/secure:partition_manifest_service_sp_second", 290 ], 291 [ 292 "service_sp_third_package.img", 293 "services/arch/aarch64/secure/manifest_service_sp_third.dts", 294 "services/arch/aarch64/secure:service_sp_third_package", 295 "services/arch/aarch64/secure:partition_manifest_service_sp_third", 296 ], 297 ] 298 299 vms = [ [ 300 "vm_primary_boot_fail_test_package_sp2.img", 301 "manifest.dts", 302 ":vm_primary_boot_fail_test_package_sp2", 303 ":vm_primary_boot_fail_test_package_sp2", 304 ] ] 305 306 json_file = "ffa_both_world_partitions_boot_fail_test_sp2.json" 307} 308 309partitions_json("ffa_both_world_partitions_boot_fail_test_sp3") { 310 testonly = true 311 312 sps = [ 313 [ 314 "service_sp_first_package.img", 315 "services/arch/aarch64/secure/manifest_service_sp_first.dts", 316 "services/arch/aarch64/secure:service_sp_first_package", 317 "services/arch/aarch64/secure:partition_manifest_service_sp_first", 318 ], 319 [ 320 "service_sp_second_package.img", 321 "services/arch/aarch64/secure/manifest_service_sp_second.dts", 322 "services/arch/aarch64/secure:service_sp_second_package", 323 "services/arch/aarch64/secure:partition_manifest_service_sp_second", 324 ], 325 [ 326 "service_sp_third_package_boot_fail_test.img", 327 "services/arch/aarch64/secure/manifest_service_sp_third.dts", 328 "services/arch/aarch64/secure:service_sp_third_package_boot_fail_test", 329 "services/arch/aarch64/secure:partition_manifest_service_sp_third", 330 ], 331 ] 332 333 vms = [ [ 334 "vm_primary_boot_fail_test_package_sp3.img", 335 "manifest.dts", 336 ":vm_primary_boot_fail_test_package_sp3", 337 ":vm_primary_boot_fail_test_package_sp3", 338 ] ] 339 340 json_file = "ffa_both_world_partitions_boot_fail_test_sp3.json" 341} 342