Skip to content

Commit ff80890

Browse files
Move to capsule paradigm and alignment
1 parent 2f0f387 commit ff80890

21 files changed

Lines changed: 342 additions & 187 deletions

File tree

doc/source/img/SOO.drawio

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.0.9 Chrome/128.0.6613.186 Electron/32.2.5 Safari/537.36" compressed="false" version="26.0.9" pages="14">
1+
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.2.2 Chrome/134.0.6998.178 Electron/35.1.2 Safari/537.36" compressed="false" version="26.2.2" pages="15">
22
<diagram name="Grant_Table" id="y1c0M9BHfZaBCB786lUY">
33
<mxGraphModel dx="1272" dy="707" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1654" pageHeight="1169" math="0" shadow="0">
44
<root>
@@ -1257,7 +1257,7 @@
12571257
</mxGraphModel>
12581258
</diagram>
12591259
<diagram id="dTEORiReagdL3ibUwoot" name="Page-19">
1260-
<mxGraphModel dx="1987" dy="613" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
1260+
<mxGraphModel dx="2097" dy="698" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
12611261
<root>
12621262
<mxCell id="0" />
12631263
<mxCell id="1" parent="0" />
@@ -1330,43 +1330,70 @@
13301330
<mxCell id="CdGM0g2mvot5W0QHDlVw-4" value="domain_unpause_by_systemcontroller()" style="rounded=0;whiteSpace=wrap;html=1;align=center;verticalAlign=middle;fontFamily=Verdana;fontSize=12;fontColor=default;fontStyle=0;fillColor=none;gradientColor=none;" parent="1" vertex="1">
13311331
<mxGeometry x="547.5" y="350" width="265" height="40" as="geometry" />
13321332
</mxCell>
1333-
<mxCell id="kv8sBSaDybhW4RajzNSk-4" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="kv8sBSaDybhW4RajzNSk-1" target="kv8sBSaDybhW4RajzNSk-3">
1333+
<mxCell id="kv8sBSaDybhW4RajzNSk-4" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kv8sBSaDybhW4RajzNSk-1" target="kv8sBSaDybhW4RajzNSk-3" edge="1">
13341334
<mxGeometry relative="1" as="geometry" />
13351335
</mxCell>
1336-
<mxCell id="kv8sBSaDybhW4RajzNSk-8" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=11;fontColor=default;labelBackgroundColor=default;endArrow=classic;" edge="1" parent="1" source="kv8sBSaDybhW4RajzNSk-1" target="kv8sBSaDybhW4RajzNSk-7">
1336+
<mxCell id="kv8sBSaDybhW4RajzNSk-8" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=11;fontColor=default;labelBackgroundColor=default;endArrow=classic;" parent="1" source="kv8sBSaDybhW4RajzNSk-1" target="kv8sBSaDybhW4RajzNSk-7" edge="1">
13371337
<mxGeometry relative="1" as="geometry" />
13381338
</mxCell>
1339-
<mxCell id="kv8sBSaDybhW4RajzNSk-1" value="LIVING" style="ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;fontSize=22;" vertex="1" parent="1">
1339+
<mxCell id="kv8sBSaDybhW4RajzNSk-1" value="LIVING" style="ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;fontSize=22;" parent="1" vertex="1">
13401340
<mxGeometry x="-80" y="950" width="120" height="80" as="geometry" />
13411341
</mxCell>
1342-
<mxCell id="kv8sBSaDybhW4RajzNSk-6" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=11;fontColor=default;labelBackgroundColor=default;endArrow=classic;" edge="1" parent="1" source="kv8sBSaDybhW4RajzNSk-2" target="kv8sBSaDybhW4RajzNSk-1">
1342+
<mxCell id="kv8sBSaDybhW4RajzNSk-6" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=11;fontColor=default;labelBackgroundColor=default;endArrow=classic;" parent="1" source="kv8sBSaDybhW4RajzNSk-2" target="kv8sBSaDybhW4RajzNSk-1" edge="1">
13431343
<mxGeometry relative="1" as="geometry" />
13441344
</mxCell>
1345-
<mxCell id="kv8sBSaDybhW4RajzNSk-2" value="RESUMING" style="ellipse;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontStyle=1;fontSize=22;" vertex="1" parent="1">
1345+
<mxCell id="kv8sBSaDybhW4RajzNSk-2" value="RESUMING" style="ellipse;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontStyle=1;fontSize=22;" parent="1" vertex="1">
13461346
<mxGeometry x="520" y="880" width="145" height="80" as="geometry" />
13471347
</mxCell>
1348-
<mxCell id="kv8sBSaDybhW4RajzNSk-5" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=11;fontColor=default;labelBackgroundColor=default;endArrow=classic;" edge="1" parent="1" source="kv8sBSaDybhW4RajzNSk-3" target="kv8sBSaDybhW4RajzNSk-2">
1348+
<mxCell id="kv8sBSaDybhW4RajzNSk-5" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=11;fontColor=default;labelBackgroundColor=default;endArrow=classic;" parent="1" source="kv8sBSaDybhW4RajzNSk-3" target="kv8sBSaDybhW4RajzNSk-2" edge="1">
13491349
<mxGeometry relative="1" as="geometry" />
13501350
</mxCell>
1351-
<mxCell id="kv8sBSaDybhW4RajzNSk-3" value="SUSPENDED" style="ellipse;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;fontSize=22;" vertex="1" parent="1">
1351+
<mxCell id="Ezqw4CNE1hvkgpD4EQ-7-1" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;" edge="1" parent="1" source="kv8sBSaDybhW4RajzNSk-3" target="Gz3j7CppjRzNbJeJO3T3-2">
1352+
<mxGeometry relative="1" as="geometry" />
1353+
</mxCell>
1354+
<mxCell id="kv8sBSaDybhW4RajzNSk-3" value="SUSPENDED" style="ellipse;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;fontSize=22;" parent="1" vertex="1">
13521355
<mxGeometry x="90" y="800" width="160" height="80" as="geometry" />
13531356
</mxCell>
1354-
<mxCell id="kv8sBSaDybhW4RajzNSk-10" value="From a restoreme" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=18;fontColor=default;labelBackgroundColor=default;endArrow=classic;" edge="1" parent="1" source="kv8sBSaDybhW4RajzNSk-7" target="kv8sBSaDybhW4RajzNSk-9">
1357+
<mxCell id="kv8sBSaDybhW4RajzNSk-10" value="From a restoreme" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=18;fontColor=default;labelBackgroundColor=default;endArrow=classic;" parent="1" source="kv8sBSaDybhW4RajzNSk-7" target="kv8sBSaDybhW4RajzNSk-9" edge="1">
13551358
<mxGeometry relative="1" as="geometry" />
13561359
</mxCell>
1357-
<mxCell id="kv8sBSaDybhW4RajzNSk-12" value="Continue to live" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=18;fontColor=default;labelBackgroundColor=default;endArrow=classic;" edge="1" parent="1" source="kv8sBSaDybhW4RajzNSk-7" target="kv8sBSaDybhW4RajzNSk-2">
1360+
<mxCell id="kv8sBSaDybhW4RajzNSk-12" value="Continue to live" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=18;fontColor=default;labelBackgroundColor=default;endArrow=classic;" parent="1" source="kv8sBSaDybhW4RajzNSk-7" target="kv8sBSaDybhW4RajzNSk-2" edge="1">
13581361
<mxGeometry x="-0.4773" y="-1" relative="1" as="geometry">
13591362
<mxPoint x="-1" as="offset" />
13601363
</mxGeometry>
13611364
</mxCell>
1362-
<mxCell id="kv8sBSaDybhW4RajzNSk-7" value="HIBERNATE" style="ellipse;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontStyle=1;fontSize=22;" vertex="1" parent="1">
1363-
<mxGeometry x="110" y="1130" width="160" height="80" as="geometry" />
1365+
<mxCell id="kv8sBSaDybhW4RajzNSk-7" value="HIBERNATE" style="ellipse;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontStyle=1;fontSize=22;" parent="1" vertex="1">
1366+
<mxGeometry x="90" y="1130" width="160" height="80" as="geometry" />
1367+
</mxCell>
1368+
<mxCell id="kv8sBSaDybhW4RajzNSk-11" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=11;fontColor=default;labelBackgroundColor=default;endArrow=classic;" parent="1" source="kv8sBSaDybhW4RajzNSk-9" target="kv8sBSaDybhW4RajzNSk-1" edge="1">
1369+
<mxGeometry relative="1" as="geometry" />
1370+
</mxCell>
1371+
<mxCell id="kv8sBSaDybhW4RajzNSk-9" value="AWAKENED" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=22;" parent="1" vertex="1">
1372+
<mxGeometry x="560" y="1050" width="160" height="80" as="geometry" />
13641373
</mxCell>
1365-
<mxCell id="kv8sBSaDybhW4RajzNSk-11" style="edgeStyle=none;shape=connector;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=default;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=11;fontColor=default;labelBackgroundColor=default;endArrow=classic;" edge="1" parent="1" source="kv8sBSaDybhW4RajzNSk-9" target="kv8sBSaDybhW4RajzNSk-1">
1374+
<mxCell id="Gz3j7CppjRzNbJeJO3T3-3" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Gz3j7CppjRzNbJeJO3T3-2" target="kv8sBSaDybhW4RajzNSk-1" edge="1">
13661375
<mxGeometry relative="1" as="geometry" />
13671376
</mxCell>
1368-
<mxCell id="kv8sBSaDybhW4RajzNSk-9" value="AWAKENED" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=22;" vertex="1" parent="1">
1369-
<mxGeometry x="640" y="1090" width="160" height="80" as="geometry" />
1377+
<mxCell id="Gz3j7CppjRzNbJeJO3T3-4" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;" parent="1" source="Gz3j7CppjRzNbJeJO3T3-2" target="kv8sBSaDybhW4RajzNSk-7" edge="1">
1378+
<mxGeometry relative="1" as="geometry">
1379+
<Array as="points">
1380+
<mxPoint x="-20" y="1150" />
1381+
</Array>
1382+
</mxGeometry>
1383+
</mxCell>
1384+
<mxCell id="Gz3j7CppjRzNbJeJO3T3-2" value="STOPPED" style="ellipse;whiteSpace=wrap;html=1;fillColor=#a20025;strokeColor=#6F0000;fontStyle=1;fontSize=22;fontColor=#ffffff;" parent="1" vertex="1">
1385+
<mxGeometry x="-280" y="810" width="140" height="90" as="geometry" />
1386+
</mxCell>
1387+
</root>
1388+
</mxGraphModel>
1389+
</diagram>
1390+
<diagram id="OlzlAWqjLXW4eZHVZYnM" name="Page-15">
1391+
<mxGraphModel dx="1247" dy="698" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
1392+
<root>
1393+
<mxCell id="0" />
1394+
<mxCell id="1" parent="0" />
1395+
<mxCell id="iItZtlUbwyU94qP-V6P0-1" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;Creation of a SO3 Capsule&lt;/h1&gt;&lt;div&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;- Load the capsule and stop before the execution&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;- Produce a snapshot&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;- Kill the capsule&lt;/span&gt;&lt;/div&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="1">
1396+
<mxGeometry x="60" y="110" width="420" height="120" as="geometry" />
13701397
</mxCell>
13711398
</root>
13721399
</mxGraphModel>

filesystem/create_img.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ fi
77

88
# Partition layout on the sdcard (virt32 for example):
99
# - Partition #1: 128 MB (u-boot, kernel, etc.)
10-
# - Partition #2: 400 MB (agency rootfs 1)
11-
# - Partition #3: 100 MB (MEs)
12-
# - Partition #4: remaining size (agency rootfs 2)
10+
# - Partition #2: 400 MB (Linux rootfs)
11+
# - Partition #3: 100 MB (Capsules)
1312

1413
if [ "$1" == "virt32" -o "$1" == "virt64" ]; then
1514
#create image first
@@ -34,7 +33,7 @@ fi
3433

3534
if [ "$1" == "virt32" -o "$1" == "virt64" -o "$1" == "rpi4" -o "$1" == "rpi4_64" -o "$1" == "cm4_64" ]; then
3635
#create the partition layout this way
37-
(echo o; echo n; echo p; echo; echo; echo +128M; echo t; echo c; echo n; echo p; echo; echo; echo +400M; echo n; echo p; echo; echo; echo +100M; echo n; echo p; echo; echo; echo; echo w) | sudo fdisk /dev/"$devname";
36+
(echo o; echo n; echo p; echo; echo; echo +128M; echo t; echo c; echo n; echo p; echo; echo; echo +400M; echo n; echo p; echo; echo; echo; echo w) | sudo fdisk /dev/"$devname";
3837
fi
3938

4039
echo Waiting...
@@ -48,7 +47,6 @@ fi
4847
sudo mkfs.fat -F32 -v /dev/"$devname"1
4948
sudo mkfs.ext4 /dev/"$devname"2
5049
sudo mkfs.ext4 /dev/"$devname"3
51-
sudo mkfs.ext4 /dev/"$devname"4
5250

5351
if [ "$1" == "virt32" -o "$1" == "virt64" ]; then
5452
sudo losetup -D

linux/linux/arch/arm64/boot/dts/arm/virt64_guest.dts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@
420420

421421
&agency {
422422

423+
uid = <0xffffeeeeddddaaaaa>;
424+
423425
backends {
424426

425427
vuart {

linux/linux/soo/include/soo/uapi/injector.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ void injector_set_full(bool _full);
9797

9898
void injector_receive_ME(void *ME, size_t size);
9999

100-
int inject_ME(void *buffer, size_t size);
100+
int inject_capsule(void *buffer, size_t size, int slotID);
101+
void start_capsule(int slotID);
101102

102103
ssize_t agency_read(struct file *fp, char *buff, size_t length, loff_t *ppos);
103104

linux/linux/soo/include/soo/uapi/soo.h

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,17 @@ typedef struct domctl domctl_t;
194194

195195
/*
196196
* ME states:
197-
* - ME_state_booting: ME is currently booting...
197+
* - ME_state_stopped: Capsule is stopped (right after start or later)
198198
* - ME_state_living: ME is full-functional and activated (all frontend devices are consistent)
199199
* - ME_state_suspended: ME is suspended before migrating. This state is maintained for the resident ME instance
200200
* - ME_state_hibernate: ME is in a state of hibernate snapshot
201201
* - ME_state_resuming: ME ready to perform resuming (after recovering)
202202
* - ME_state_awakened: ME is just being awakened
203-
* - ME_state_terminated: ME has been terminated (by a force_terminate)
203+
* - ME_state_terminated: ME has been terminated (by a shutdown)
204204
* - ME_state_dead: ME does not exist
205205
*/
206206
typedef enum {
207-
ME_state_booting,
207+
ME_state_stopped,
208208
ME_state_living,
209209
ME_state_suspended,
210210
ME_state_hibernate,
@@ -253,7 +253,7 @@ typedef enum {
253253
DC_PRE_SUSPEND,
254254
DC_SUSPEND,
255255
DC_RESUME,
256-
DC_FORCE_TERMINATE,
256+
DC_SHUTDOWN,
257257
DC_POST_ACTIVATE,
258258
DC_TRIGGER_DEV_PROBE,
259259
DC_TRIGGER_LOCAL_COOPERATION,
@@ -278,13 +278,13 @@ extern atomic_t dc_incoming_domID[DC_EVENT_MAX];
278278
* IOCTL codes
279279
*/
280280

281-
#define AGENCY_IOCTL_GET_ME_FREE_SLOT _IOWR('S', 1, agency_ioctl_args_t)
282-
#define AGENCY_IOCTL_READ_SNAPSHOT _IOWR('S', 2, agency_ioctl_args_t)
283-
#define AGENCY_IOCTL_WRITE_SNAPSHOT _IOW('S', 3, agency_ioctl_args_t)
284-
#define AGENCY_IOCTL_FORCE_TERMINATE _IOW('S', 5, agency_ioctl_args_t)
285-
#define AGENCY_IOCTL_INJECT_ME _IOWR('S', 6, agency_ioctl_args_t)
286-
#define AGENCY_IOCTL_GET_ME_ID _IOWR('S', 7, agency_ioctl_args_t)
287-
#define AGENCY_IOCTL_GET_ME_ID_ARRAY _IOR('S', 11, agency_ioctl_args_t)
281+
#define AGENCY_IOCTL_READ_SNAPSHOT _IOWR('S', 1, agency_ioctl_args_t)
282+
#define AGENCY_IOCTL_WRITE_SNAPSHOT _IOW('S', 2, agency_ioctl_args_t)
283+
#define AGENCY_IOCTL_SHUTDOWN _IOW('S', 3, agency_ioctl_args_t)
284+
#define AGENCY_IOCTL_INJECT_CAPSULE _IOWR('S', 4, agency_ioctl_args_t)
285+
#define AGENCY_IOCTL_START_CAPSULE _IOWR('S', 5, agency_ioctl_args_t)
286+
#define AGENCY_IOCTL_GET_ME_ID _IOWR('S', 6, agency_ioctl_args_t)
287+
#define AGENCY_IOCTL_GET_ME_ID_ARRAY _IOR('S', 7, agency_ioctl_args_t)
288288

289289
#define SOO_NAME_SIZE 16
290290

@@ -398,7 +398,8 @@ typedef struct {
398398
/* AVZ hypercalls devoted to SOO */
399399
#define AVZ_ME_READ_SNAPSHOT 6
400400
#define AVZ_ME_WRITE_SNAPSHOT 7
401-
#define AVZ_INJECT_ME 9
401+
#define AVZ_START_CAPSULE 8
402+
#define AVZ_INJECT_CAPSULE 9
402403
#define AVZ_KILL_ME 10
403404
#define AVZ_DC_EVENT_SET 11
404405
#define AVZ_GET_ME_STATE 13
@@ -414,11 +415,16 @@ typedef struct {
414415
evtchn_op_t evtchn_op;
415416
} avz_evtchn_t;
416417

417-
/* AVZ_INJECT_ME */
418+
/* AVZ_INJECT_CAPSULE */
418419
typedef struct {
419420
void *itb_paddr;
420421
int slotID;
421-
} avz_inject_me_t;
422+
} avz_inject_capsule_t;
423+
424+
/* AVZ_START_CAPSULE */
425+
typedef struct {
426+
int slotID;
427+
} avz_start_capsule_t;
422428

423429
/* AVZ_DC_EVENT_SET */
424430
typedef struct {
@@ -491,7 +497,8 @@ typedef struct {
491497
int cmd;
492498
union {
493499
avz_evtchn_t avz_evtchn;
494-
avz_inject_me_t avz_inject_me_args;
500+
avz_inject_capsule_t avz_inject_capsule_args;
501+
avz_start_capsule_t avz_start_capsule_args;
495502
avz_dc_event_t avz_dc_event_args;
496503
avz_me_state_t avz_me_state_args;
497504
avz_dom_desc_t avz_dom_desc_args;
@@ -518,19 +525,11 @@ typedef struct {
518525
void *val;
519526
} post_activate_args_t;
520527

521-
/*
522-
* Further agency ctl commands that may be used by MEs.
523-
* !! WARNING !! The ME must implement the same definitions.
524-
*/
525-
526-
#define AG_INJECT_ME 0x11
527-
#define AG_KILL_ME 0x12
528528

529529
typedef struct {
530530
char soo_name[SOO_NAME_SIZE];
531531
} soo_name_args_t;
532532

533-
534533
/*
535534
* SOO callback functions.
536535
* The following definitions are used as argument in domcalls or in the
@@ -567,7 +566,7 @@ void cb_pre_suspend(soo_domcall_arg_t *args);
567566

568567
void cb_post_activate(soo_domcall_arg_t *args);
569568

570-
void cb_force_terminate(void);
569+
void cb_shutdown(void);
571570

572571
void callbacks_init(void);
573572

linux/linux/soo/kernel/core.c

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
#include <soo/guest_api.h>
4040
#include <soo/soo.h>
41+
#include <soo/avz.h>
4142

4243
#define AGENCY_DEV_NAME "soo/core"
4344
#define AGENCY_DEV_MAJOR 126
@@ -50,17 +51,17 @@ struct bus_type soo_subsys;
5051
static struct device soo_dev;
5152

5253
/*
53-
* Perform a force terminate of ME in <ME_slotID>
54+
* Perform a shutdown of the capsule in <ME_slotID>
5455
*
5556
*/
56-
static void force_terminate(unsigned int ME_slotID) {
57+
static void shutdown_capsule(unsigned int ME_slotID) {
5758
avz_hyp_t args;
5859

5960
/* The ME may be ME_state_terminated after a cooperate callback */
6061

6162
/* Asynchronous termination of the ME */
6263
if ((get_ME_state(ME_slotID) == ME_state_living) || (get_ME_state(ME_slotID) == ME_state_terminated))
63-
do_sync_dom(ME_slotID, DC_FORCE_TERMINATE);
64+
do_sync_dom(ME_slotID, DC_SHUTDOWN);
6465

6566
/* Then, final termination of the residual ME */
6667
if (get_ME_state(ME_slotID) == ME_state_terminated) {
@@ -102,12 +103,16 @@ long agency_ioctl(struct file *file, unsigned int cmd, unsigned long arg) {
102103
ret = write_snapshot(args.buffer);
103104
break;
104105

105-
case AGENCY_IOCTL_INJECT_ME:
106-
args.slotID = inject_ME(args.buffer, args.value);
106+
case AGENCY_IOCTL_INJECT_CAPSULE:
107+
args.slotID = inject_capsule(args.buffer, args.value, args.slotID);
108+
break;
109+
110+
case AGENCY_IOCTL_START_CAPSULE:
111+
start_capsule(args.slotID);
107112
break;
108113

109-
case AGENCY_IOCTL_FORCE_TERMINATE:
110-
force_terminate(args.slotID);
114+
case AGENCY_IOCTL_SHUTDOWN:
115+
shutdown_capsule(args.slotID);
111116
break;
112117

113118
case AGENCY_IOCTL_GET_ME_ID_ARRAY:
@@ -215,14 +220,14 @@ static int agency_reboot_notify(struct notifier_block *nb, unsigned long code, v
215220

216221
/*
217222
* Check if the ME slot is used or not in order to not
218-
call force_terminate on an empty slot, which would cause an error.
223+
call shutdown on an empty slot, which would cause an error.
219224
*/
220225

221226
get_ME_desc(slotID, &desc);
222227

223228
if (desc.size > 0) {
224229
lprintk("%s: terminating ME %d...\n", __func__, slotID);
225-
force_terminate(slotID);
230+
shutdown_capsule(slotID);
226231
}
227232
}
228233

@@ -255,6 +260,15 @@ int agency_late_init_fn(void *args) {
255260
return 0;
256261
}
257262

263+
/**
264+
* @brief Retrieve the agency UID
265+
*
266+
* @param str
267+
*/
268+
void agencyUID_read(char *str) {
269+
sprintf(str, "%16llx", avz_shared->dom_desc.u.agency.agencyUID);
270+
}
271+
258272
int agency_init(void) {
259273

260274
int rc;
@@ -287,6 +301,8 @@ int agency_init(void) {
287301

288302
register_reboot_notifier(&agency_reboot_nb);
289303

304+
soo_sysfs_register(agencyUID, agencyUID_read, NULL);
305+
290306
return 0;
291307
}
292308

0 commit comments

Comments
 (0)