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/image/image.gni")
8
9# Service to expose race conditions when running a vCPU.
10source_set("check_state") {
11  testonly = true
12  public_configs = [ "//test/hftest:hftest_config" ]
13
14  sources = [
15    "check_state.c",
16  ]
17
18  deps = [
19    "//src/arch/aarch64/hftest:state",
20  ]
21}
22
23# Service to try to access EL1 debug registers.
24source_set("debug_el1") {
25  testonly = true
26  public_configs = [ "//test/hftest:hftest_config" ]
27
28  sources = [
29    "debug_el1.c",
30  ]
31}
32
33# Service to try to access performance monitor registers.
34source_set("perfmon") {
35  testonly = true
36  public_configs = [ "//test/hftest:hftest_config" ]
37
38  sources = [
39    "perfmon.c",
40  ]
41}
42
43# Service to listen for messages and echo them back to the sender.
44source_set("echo") {
45  testonly = true
46  public_configs = [ "//test/hftest:hftest_config" ]
47
48  sources = [
49    "echo.c",
50  ]
51}
52
53# Service for floating point register save/restore checks.
54source_set("floating_point") {
55  testonly = true
56  public_configs = [ "//test/hftest:hftest_config" ]
57
58  sources = [
59    "floating_point.c",
60  ]
61
62  deps = [
63    "//src/arch/aarch64/hftest:registers",
64  ]
65}
66
67# Services related to memory sharing.
68source_set("memory") {
69  testonly = true
70  public_configs = [
71    "..:config",
72    "//test/hftest:hftest_config",
73  ]
74  deps = [
75    "//test/vmapi/common",
76    "//vmlib",
77  ]
78
79  sources = [
80    "memory.c",
81  ]
82}
83
84# Services related to VMs that access unmapped memory.
85source_set("unmapped") {
86  testonly = true
87  public_configs = [ "//test/hftest:hftest_config" ]
88
89  sources = [
90    "unmapped.c",
91  ]
92
93  deps = [
94    "//test/vmapi/common:common",
95  ]
96}
97
98# Services related to the boot process for VMs.
99source_set("boot") {
100  testonly = true
101  public_configs = [ "//test/hftest:hftest_config" ]
102
103  sources = [
104    "boot.c",
105  ]
106
107  deps = [
108    "//test/vmapi/common:common",
109  ]
110}
111
112# Service that can be interrupted.
113source_set("interruptible") {
114  testonly = true
115  public_configs = [
116    "..:config",
117    "//test/hftest:hftest_config",
118  ]
119
120  sources = [
121    "interruptible.c",
122    "interruptible_echo.c",
123  ]
124
125  deps = [
126    "//src/arch/aarch64/hftest:interrupts",
127  ]
128}
129
130# Service to check that hf_mailbox_receive can't block when there are pending
131# interrupts.
132source_set("receive_block") {
133  testonly = true
134  public_configs = [
135    "..:config",
136    "//test/hftest:hftest_config",
137  ]
138  sources = [
139    "receive_block.c",
140  ]
141  deps = [
142    "//src/arch/aarch64:arch",
143    "//src/arch/aarch64/hftest:interrupts",
144    "//test/vmapi/common",
145  ]
146}
147
148# Service to listen for messages and forward them on to another.
149source_set("relay") {
150  testonly = true
151  public_configs = [ "//test/hftest:hftest_config" ]
152
153  sources = [
154    "relay.c",
155  ]
156}
157
158# Service to wait for a message but expect never to get one.
159source_set("run_waiting") {
160  testonly = true
161  public_configs = [ "//test/hftest:hftest_config" ]
162
163  sources = [
164    "run_waiting.c",
165  ]
166}
167
168# Service to start a second vCPU and send messages from both.
169source_set("smp") {
170  testonly = true
171  public_configs = [
172    "..:config",
173    "//test/hftest:hftest_config",
174  ]
175  sources = [
176    "smp.c",
177  ]
178}
179
180# Service to check that WFI is a no-op when there are pending interrupts.
181source_set("wfi") {
182  testonly = true
183  public_configs = [
184    "..:config",
185    "//test/hftest:hftest_config",
186  ]
187  sources = [
188    "wfi.c",
189  ]
190  deps = [
191    "//src/arch/aarch64/hftest:interrupts",
192  ]
193}
194
195# Service to receive messages in a secondary VM and ensure that the header fields are correctly set.
196source_set("ffa_check") {
197  testonly = true
198  public_configs = [
199    "..:config",
200    "//test/hftest:hftest_config",
201  ]
202  deps = [
203    "//test/vmapi/common",
204  ]
205
206  sources = [
207    "ffa_check.c",
208  ]
209}
210
211# Group services together into VMs.
212
213vm_kernel("service_vm1") {
214  testonly = true
215
216  deps = [
217    ":boot",
218    ":check_state",
219    ":debug_el1",
220    ":echo",
221    ":ffa_check",
222    ":floating_point",
223    ":interruptible",
224    ":memory",
225    ":perfmon",
226    ":receive_block",
227    ":relay",
228    ":run_waiting",
229    ":unmapped",
230    ":wfi",
231    "//test/hftest:hftest_secondary_vm",
232  ]
233}
234
235vm_kernel("service_vm2") {
236  testonly = true
237
238  deps = [
239    ":interruptible",
240    ":memory",
241    ":relay",
242    "//test/hftest:hftest_secondary_vm",
243  ]
244}
245
246vm_kernel("service_vm3") {
247  testonly = true
248
249  deps = [
250    ":smp",
251    "//test/hftest:hftest_secondary_vm",
252  ]
253}
254