-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvm_multi.camkes
247 lines (208 loc) · 7.65 KB
/
vm_multi.camkes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*
* Copyright 2017, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: BSD-2-Clause
*/
import <std_connector.camkes>;
import <global-connectors.camkes>;
/*
* can't import VM.camkes, because it adds dependencies on components instead of
* just the interfaces
*
*/
import <vm-connectors.camkes>;
import <seL4VMDTBPassthrough.idl4>;
import <Batch.idl4>;
import <PutChar.idl4>;
import <GetChar.idl4>;
import <VirtQueues.idl4>;
import <FileServerInterface.camkes>;
#include <configurations/vm.h>
struct vswitch_mapping {
string mac_addr;
int send_id;
int recv_id;
};
component VM {
VM_INIT_DEF()
maybe uses VirtQueueDev recv1;
maybe uses VirtQueueDrv send1;
maybe uses VirtQueueDev recv2;
maybe uses VirtQueueDrv send2;
attribute vswitch_mapping vswitch_layout[] = [];
attribute string vswitch_mac_address = "";
}
// Components
import <VirtQueue/VirtQueue.camkes>;
import <FileServer/FileServer.camkes>;
import <TimeServer/TimeServer.camkes>;
import <SerialServer/SerialServer.camkes>;
// Platform specific configurations
#include <plat.camkes>
assembly {
composition {
component TimeServer time_server;
component SerialServer serial;
connection seL4TimeServer serialserver_timer(
from serial.timeout,
to time_server.the_timer);
component FileServer fileServer;
component VM vm0;
connection seL4VMDTBPassthrough vm0_dtb(
from vm0.dtb_self,
to vm0.dtb
);
connection seL4GlobalAsynch vm0_notify_ready(
from vm0.notification_ready_connector,
to vm0.notification_ready
);
connection seL4RPCDataport vm0_fs(
from vm0.fs,
to fileServer.fs_ctrl
);
component VM vm1;
connection seL4VMDTBPassthrough vm1_dtb(
from vm1.dtb_self,
to vm1.dtb
);
connection seL4GlobalAsynch vm1_notify_ready(
from vm1.notification_ready_connector,
to vm1.notification_ready
);
connection seL4RPCDataport vm1_fs(
from vm1.fs,
to fileServer.fs_ctrl
);
component VM vm2;
connection seL4VMDTBPassthrough vm2_dtb(
from vm2.dtb_self,
to vm2.dtb
);
connection seL4GlobalAsynch vm2_notify_ready(
from vm2.notification_ready_connector,
to vm2.notification_ready
);
connection seL4RPCDataport vm2_fs(
from vm2.fs,
to fileServer.fs_ctrl
);
/* vm0,vm1 & vm2 serial connections */
connection seL4SerialServer serial_vm0(
from vm0.batch,
to serial.processed_batch
);
connection seL4SerialServer serial_input0(
from vm0.serial_getchar,
to serial.getchar
);
connection seL4SerialServer serial_vm1(
from vm1.batch,
to serial.processed_batch
);
connection seL4SerialServer serial_input1(
from vm1.serial_getchar,
to serial.getchar
);
connection seL4SerialServer serial_vm2(
from vm2.batch,
to serial.processed_batch
);
connection seL4SerialServer serial_input2(
from vm2.serial_getchar,
to serial.getchar
);
/* vm0-[vm1,vm2] connection */
component VirtQueueInit vm1_vm0;
component VirtQueueInit vm2_vm0;
connection seL4VirtQueues vm1_vm0_conn(to vm1_vm0.init, from vm0.send1, from vm0.recv1, from vm1.send1, from vm1.recv1);
connection seL4VirtQueues vm2_vm0_conn(to vm2_vm0.init, from vm0.recv2, from vm0.send2, from vm2.recv1, from vm2.send1);
}
configuration {
time_server.timers_per_client = 1;
/* Put the entire time server at the highest priority */
time_server.priority = 255;
time_server.simple = true;
fileServer.heap_size = 0x200000; // 128 KiB seems enough
// see also plat.camkes for more config values
vm0.num_vcpus = 1;
vm0.base_prio = 100;
vm0._priority = 101;
vm0.num_extra_frame_caps = 0;
vm0.extra_frame_map_address = 0;
vm0.cnode_size_bits = 18;
vm0.simple_untyped21_pool = 12;
vm0.simple_untyped12_pool = 12;
vm0.asid_pool = true;
vm0.global_endpoint_base = 1 << 27;
vm0.simple = true;
vm0.sem_value = 0;
vm0.heap_size = 0x300000;
vm0.fs_shmem_size = 0x100000;
vm0.serial_getchar_shmem_size = 0x1000;
vm0.batch_shmem_size = 0x1000;
vm0.vswitch_mac_address = "02:00:00:00:AA:01";
vm0.vswitch_layout = [{"mac_addr": "02:00:00:00:AA:02", "recv_id": 0, "send_id":1},
{"mac_addr": "02:00:00:00:AA:03", "recv_id": 2, "send_id":3}];
vm1.num_vcpus = 1;
vm1.base_prio = 100;
vm1._priority = 101;
vm1.num_extra_frame_caps = 0;
vm1.extra_frame_map_address = 0;
vm1.cnode_size_bits = 18;
vm1.simple_untyped21_pool = 12;
vm1.simple_untyped12_pool = 12;
vm1.asid_pool = true;
vm1.global_endpoint_base = 1 << 27;
vm1.simple = true;
vm1.sem_value = 0;
vm1.heap_size = 0x300000;
vm1.fs_shmem_size = 0x100000;
vm1.serial_getchar_shmem_size = 0x1000;
vm1.batch_shmem_size = 0x1000;
vm1.vswitch_mac_address = "02:00:00:00:AA:02";
vm1.vswitch_layout = [{"mac_addr": "02:00:00:00:AA:01", "recv_id": 0, "send_id":1}];
vm2.num_vcpus = 1;
vm2.base_prio = 100;
vm2._priority = 101;
vm2.num_extra_frame_caps = 0;
vm2.extra_frame_map_address = 0;
vm2.cnode_size_bits = 18;
vm2.simple_untyped21_pool = 12;
vm2.simple_untyped12_pool = 12;
vm2.asid_pool = true;
vm2.global_endpoint_base = 1 << 27;
vm2.simple = true;
vm2.sem_value = 0;
vm2.heap_size = 0x300000;
vm2.fs_shmem_size = 0x100000;
vm2.serial_getchar_shmem_size = 0x1000;
vm2.batch_shmem_size = 0x1000;
vm2.vswitch_mac_address = "02:00:00:00:AA:03";
vm2.vswitch_layout = [{"mac_addr": "02:00:00:00:AA:01", "recv_id": 0, "send_id":1}];
/* VM0-VM1 virtqueue configurations */
vm0.recv1_id = 0;
vm0.recv1_shmem_size = 8192;
vm0.send1_id = 1;
vm0.send1_shmem_size = 8192;
/* VM0-VM2 virtqueue configurations */
vm0.recv2_id = 2;
vm0.recv2_shmem_size = 8192;
vm0.send2_id = 3;
vm0.send2_shmem_size = 8192;
/* VM1 virtqueue configurations */
vm1.recv1_id = 0;
vm1.recv1_shmem_size = 8192;
vm1.send1_id = 1;
vm1.send1_shmem_size = 8192;
/* VM2 virtqueue configurations */
vm2.recv1_id = 0;
vm2.recv1_shmem_size = 8192;
vm2.send1_id = 1;
vm2.send1_shmem_size = 8192;
/* Virtqueue Topology */
vm1_vm0.init_topology = [{ "drv" : "vm0.send1", "dev" : "vm1.recv1"},
{ "drv" : "vm1.send1", "dev" : "vm0.recv1"}];
vm2_vm0.init_topology = [{ "drv" : "vm0.send2", "dev" : "vm2.recv1"},
{ "drv" : "vm2.send1", "dev" : "vm0.recv2"}];
}
}