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("//test/hftest/args.gni")
9import("//src/arch/${plat_arch}/args.gni")
10
11# VM that will control execution of tests in a VM-to-SP set-up
12vm_kernel("vm_primary") {
13  testonly = true
14  public_configs = [
15    "services:config",
16    "//src/arch/${plat_arch}:arch_config",
17  ]
18
19  sources = [
20    "dir_msg.c",
21    "indirect_msg.c",
22    "interrupts.c",
23    "notifications.c",
24    "power_mgt.c",
25    "setup_and_discovery.c",
26  ]
27
28  deps = [
29    "//src/arch/${plat_arch}/hftest:interrupts_gicv3",
30    "//src/arch/${plat_arch}/hftest:power_mgmt",
31    "//test/hftest:hftest_primary_vm",
32    "//test/vmapi/arch/${plat_arch}/gicv3:gicv3_setup",
33    "//test/vmapi/common:common",
34  ]
35}
36
37# SP that will be controlled via communication/scheduling primitives by the
38# former SP
39vm_kernel("secure_partitions_services") {
40  testonly = true
41  public_configs = [ "services:config" ]
42
43  deps = [
44    "services:message_loop",
45    "//test/hftest:hftest_secure_service",
46  ]
47}
48
49manifest("partition_manifest_service_sp_first") {
50  source = "partition_manifest_service_sp_first.dts"
51  output = "partition_manifest_service_sp_first.dtb"
52}
53
54manifest("partition_manifest_service_sp_second") {
55  source = "partition_manifest_service_sp_second.dts"
56  output = "partition_manifest_service_sp_second.dtb"
57}
58
59partition_package("service_sp_second_package") {
60  testonly = true
61  pm_offset = "0x1000"
62  img_offset = "0x2000"
63  files = [ [
64        "partition_manifest_service_sp_second.dtb",
65        "secure_partitions_services.bin",
66        ":partition_manifest_service_sp_second",
67        ":secure_partitions_services",
68      ] ]
69  output = "service_sp_second_package.img"
70}
71
72partition_package("service_sp_first_package") {
73  testonly = true
74  pm_offset = "0x1000"
75  img_offset = "0x2000"
76  files = [ [
77        "partition_manifest_service_sp_first.dtb",
78        "secure_partitions_services.bin",
79        ":partition_manifest_service_sp_first",
80        ":secure_partitions_services",
81      ] ]
82  output = "service_sp_first_package.img"
83}
84
85manifest("vm_primary_manifest") {
86  source = "partition_manifest_nwd_primary.dts"
87  output = "partition_manifest_nwd_primary.dtb"
88}
89
90partition_package("vm_primary_test_package") {
91  testonly = true
92  pm_offset = "0x1000"
93  img_offset = "0x2000"
94  files = [ [
95        "partition_manifest_nwd_primary.dtb",
96        "vm_primary.bin",
97        ":vm_primary_manifest",
98        ":vm_primary",
99      ] ]
100  output = "vm_primary_test_package.img"
101}
102
103vm_kernel("sel0_partition") {
104  testonly = true
105
106  deps = [
107    "services:message_loop",
108    "//test/hftest:hftest_sel0_partition_base",
109  ]
110}
111
112manifest("partition_manifest_service_sp_second_el0") {
113  source = "partition_manifest_service_sp_second_el0.dts"
114  output = "partition_manifest_service_sp_second_el0.dtb"
115}
116
117partition_package("service_sp_second_el0_package") {
118  testonly = true
119  pm_offset = "0x1000"
120  img_offset = "0x2000"
121  files = [ [
122        "partition_manifest_service_sp_second_el0.dtb",
123        "sel0_partition.bin",
124        ":partition_manifest_service_sp_second_el0",
125        ":sel0_partition",
126      ] ]
127  output = "service_sp_second_el0_package.img"
128}
129
130partitions_json("ffa_both_world_partitions_vhe_test") {
131  testonly = true
132
133  sps = [
134    [
135      "service_sp_second_el0_package.img",
136      "manifest_service_sp_second_el0.dts",
137      ":service_sp_second_el0_package",
138      ":partition_manifest_service_sp_second_el0",
139    ],
140    [
141      "service_sp_first_package.img",
142      "manifest_service_sp_first.dts",
143      ":service_sp_first_package",
144      ":partition_manifest_service_sp_first",
145    ],
146  ]
147
148  vms = [ [
149        "vm_primary_test_package.img",
150        "manifest.dts",
151        ":vm_primary_test_package",
152        ":vm_primary_test_package",
153      ] ]
154
155  json_file = "ffa_both_world_partitions_vhe_test.json"
156}
157
158partitions_json("ffa_both_world_partitions_test") {
159  testonly = true
160
161  sps = [
162    [
163      "service_sp_second_package.img",
164      "manifest_service_sp_second.dts",
165      ":service_sp_second_package",
166      ":partition_manifest_service_sp_second",
167    ],
168    [
169      "service_sp_first_package.img",
170      "manifest_service_sp_first.dts",
171      ":service_sp_first_package",
172      ":partition_manifest_service_sp_first",
173    ],
174  ]
175
176  vms = [ [
177        "vm_primary_test_package.img",
178        "manifest.dts",
179        ":vm_primary_test_package",
180        ":vm_primary_test_package",
181      ] ]
182
183  json_file = "ffa_both_world_partitions_test.json"
184}
185