1# Copyright 2018 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/toolchain/platform.gni") 8import("//test/hftest/args.gni") 9 10config("hftest_config") { 11 include_dirs = [ "//test/inc" ] 12 13 if (hftest_optimize_for_size == true) { 14 defines = [ "HFTEST_OPTIMIZE_FOR_SIZE" ] 15 } 16} 17 18#dlog for el0 partition that uses SVCs for debug logging 19source_set("el0_dlog") { 20 testonly = true 21 sources = [ "//src/dlog.c" ] 22 deps = [ "//src/arch/aarch64/hftest:el0_stdout" ] 23} 24 25source_set("el0_fdt_handler") { 26 testonly = true 27 sources = [ "//src/fdt_handler.c" ] 28 deps = [ "//src:fdt" ] 29} 30 31# Testing framework for a secondary EL0 partition in the normal world. 32# It's currently just a secondary partition and can't affect the tests directly. 33source_set("hftest_secondary_el0_partition") { 34 testonly = true 35 36 public_configs = [ ":hftest_config" ] 37 38 sources = [ 39 "nwd_el0_service.c", 40 "service_common.c", 41 ] 42 43 deps = [ 44 ":el0_dlog", 45 ":el0_fdt_handler", 46 "//src:panic", 47 "//src/arch/${plat_arch}/hftest:el0_entry", 48 "//test/hftest/arch/aarch64/el0:mm", 49 ] 50} 51 52# Testing framework for a S-EL0 partition. 53source_set("hftest_sel0_partition_base") { 54 testonly = true 55 56 public_configs = [ "//test/hftest:hftest_config" ] 57 58 sources = [ 59 "sel0_secure_service.c", 60 "service_common.c", 61 ] 62 63 deps = [ 64 ":el0_dlog", 65 ":el0_fdt_handler", 66 "//src:panic", 67 "//src/arch/${plat_arch}/hftest:el0_entry", 68 "//test/hftest/arch/aarch64/el0:mm", 69 ] 70} 71 72# Testing framework for a primary VM. 73source_set("hftest_primary_vm") { 74 testonly = true 75 76 public_configs = [ ":hftest_config" ] 77 78 deps = [ 79 ":hftest_standalone", 80 "//vmlib/${plat_arch}:call", 81 ] 82} 83 84# Testing framework for a secondary VM. It's currently just a slave VM and 85# can't affect the tests directly. 86source_set("hftest_secondary_vm") { 87 testonly = true 88 89 public_configs = [ ":hftest_config" ] 90 91 sources = [ "service.c" ] 92 93 deps = [ 94 ":mm", 95 ":power_mgmt", 96 ":service_common", 97 "//src:dlog", 98 "//src:fdt_handler", 99 "//src:memiter", 100 "//src:panic", 101 "//src:std", 102 "//src/arch/${plat_arch}:entry", 103 "//src/arch/${plat_arch}/hftest:entry", 104 "//src/arch/${plat_arch}/hftest:interrupts", 105 "//src/arch/${plat_arch}/hftest:power_mgmt", 106 "//vmlib/${plat_arch}:call", 107 ] 108} 109 110source_set("hftest_secure_service") { 111 testonly = true 112 113 public_configs = [ 114 "//src/arch/aarch64:arch_config", 115 ":hftest_config", 116 ] 117 118 sources = [ "sel1_secure_service.c" ] 119 120 deps = [ 121 ":mm", 122 ":service_common", 123 "//src:dlog", 124 "//src:fdt_handler", 125 "//src:panic", 126 "//src:std", 127 "//src/arch/${plat_arch}:entry", 128 "//src/arch/${plat_arch}/hftest:entry", 129 "//src/arch/${plat_arch}/hftest:power_mgmt", 130 "//src/arch/${plat_arch}/hftest:sp_secondary_entry", 131 ] 132} 133 134# Testing framework for a secondary VM. This framework doesn't provide services 135# and expects that secondary VMs will be passed the memory size in register x0 136# instead of a pointer to the FDT. 137source_set("hftest_secondary_vm_no_fdt") { 138 testonly = true 139 140 public_configs = [ ":hftest_config" ] 141 142 sources = [ "secondary_no_fdt.c" ] 143 144 deps = [ 145 ":mm", 146 ":service_common", 147 "//src:dlog", 148 "//src:panic", 149 "//src:std", 150 "//src/arch/${plat_arch}:entry", 151 "//src/arch/${plat_arch}/hftest:entry", 152 "//src/arch/${plat_arch}/hftest:power_mgmt", 153 "//vmlib/${plat_arch}:call", 154 ] 155} 156 157# Testing framework for a hypervisor. 158source_set("hftest_hypervisor") { 159 testonly = true 160 public_configs = [ ":hftest_config" ] 161 deps = [ ":hftest_standalone" ] 162} 163 164# Testing framework for tests running under Linux in the primary VM. 165source_set("hftest_linux") { 166 testonly = true 167 public_configs = [ ":hftest_config" ] 168 169 sources = [ "linux_main.c" ] 170 171 deps = [ 172 ":common", 173 "//src:dlog", 174 "//src:memiter", 175 "//src/arch/${plat_arch}/hftest:power_mgmt", 176 ] 177} 178 179source_set("hftest_standalone") { 180 visibility = [ ":*" ] 181 testonly = true 182 183 public_configs = [ ":hftest_config" ] 184 185 sources = [ "standalone_main.c" ] 186 187 deps = [ 188 ":common", 189 ":mm", 190 ":power_mgmt", 191 "//src:dlog", 192 "//src:memiter", 193 "//src/arch/${plat_arch}:entry", 194 "//src/arch/${plat_arch}/hftest:entry", 195 "//src/arch/${plat_arch}/hftest:interrupts", 196 "//src/arch/${plat_arch}/hftest:power_mgmt", 197 hftest_ctrl, 198 hftest_device, 199 ] 200} 201 202source_set("hftest_standalone_secure") { 203 testonly = true 204 205 public_configs = [ 206 "//src/arch/aarch64:arch_config", 207 ":hftest_config", 208 ] 209 210 sources = [ "standalone_main_secure.c" ] 211 212 deps = [ 213 ":common", 214 ":mm", 215 ":power_mgmt", 216 "//src:dlog", 217 "//src:fdt", 218 "//src:fdt_handler", 219 "//src:memiter", 220 "//src/arch/${plat_arch}:entry", 221 "//src/arch/${plat_arch}/hftest:entry", 222 "//src/arch/${plat_arch}/hftest:interrupts", 223 "//src/arch/${plat_arch}/hftest:power_mgmt", 224 "//test/hftest:ctrl_uart", 225 hftest_device, 226 ] 227} 228 229# Common code for hftest, whether it is running under Linux, under Hafnium in 230# the primary VM, or directly on the hardware. 231source_set("common") { 232 visibility = [ ":*" ] 233 testonly = true 234 public_configs = [ ":hftest_config" ] 235 sources = [ "common.c" ] 236 deps = [ 237 "//src:fdt_handler", 238 "//src:memiter", 239 "//src:panic", 240 "//src:std", 241 ] 242} 243 244source_set("service_common") { 245 visibility = [ ":*" ] 246 testonly = true 247 public_configs = [ ":hftest_config" ] 248 sources = [ "service_common.c" ] 249 deps = [ 250 "//src:memiter", 251 "//src:panic", 252 "//src:std", 253 "//test/vmapi/common:ffa", 254 ] 255} 256 257source_set("device_psci") { 258 testonly = true 259 260 public_configs = [ ":hftest_config" ] 261 262 sources = [ "device_psci.c" ] 263 264 deps = [ "//src/arch/${plat_arch}/hftest:power_mgmt" ] 265} 266 267source_set("mm") { 268 testonly = true 269 270 public_configs = [ ":hftest_config" ] 271 272 sources = [ "mm.c" ] 273 274 deps = [ 275 "//src:layout", 276 "//src:mm", 277 "//src/arch/${plat_arch}:arch", 278 "//src/arch/${plat_arch}/hftest:mm", 279 ] 280} 281 282source_set("power_mgmt") { 283 testonly = true 284 285 public_configs = [ ":hftest_config" ] 286 287 sources = [ "power_mgmt.c" ] 288 289 deps = [ 290 ":mm", 291 "//src/arch/${plat_arch}/hftest:power_mgmt", 292 ] 293} 294 295source_set("ctrl_fdt") { 296 testonly = true 297 298 public_configs = [ ":hftest_config" ] 299 300 sources = [ "ctrl_fdt.c" ] 301 302 deps = [ 303 "//src:dlog", 304 "//src:fdt", 305 "//src:memiter", 306 ] 307} 308 309source_set("ctrl_uart") { 310 testonly = true 311 312 public_configs = [ ":hftest_config" ] 313 314 sources = [ "ctrl_uart.c" ] 315 316 deps = [ 317 "//src:dlog", 318 "//src:memiter", 319 hftest_device, 320 plat_console, 321 ] 322} 323