Skip to content

Commit 8d87d4f

Browse files
Fix issues during capsule restoring
1 parent ff80890 commit 8d87d4f

5 files changed

Lines changed: 22 additions & 26 deletions

File tree

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,10 @@ typedef struct {
461461
/* AVZ_WRITE_SNAPSHOT */
462462
typedef struct {
463463
void *snapshot_paddr;
464-
uint32_t slotID;
464+
int32_t slotID;
465465
int size;
466466
} avz_snapshot_t;
467467

468-
/* AVZ_MIG_FINAL */
469-
typedef struct {
470-
uint32_t slotID;
471-
} avz_mig_final_t;
472-
473468
/* AVZ_KILL_ME */
474469
typedef struct {
475470
uint32_t slotID;
@@ -505,7 +500,6 @@ typedef struct {
505500
avz_free_slot_t avz_free_slot_args;
506501
avz_mig_init_t avz_mig_init_args;
507502
avz_snapshot_t avz_snapshot_args;
508-
avz_mig_final_t avz_mig_final_args;
509503
avz_kill_me_t avz_kill_me_args;
510504
avz_console_io_t avz_console_io_args;
511505
avz_domctl_t avz_domctl_args;

linux/linux/soo/kernel/injector.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*/
1818

19-
#if 0
19+
#if 1
2020
#define DEBUG
2121
#endif
2222

@@ -161,6 +161,9 @@ void read_snapshot(uint32_t slotID, void *buffer, uint32_t *size) {
161161

162162
/* Ask the size only */
163163
if (*size == 0) {
164+
165+
DBG("%s: ask the snapshot size...\n", __func__);
166+
164167
args.cmd = AVZ_ME_READ_SNAPSHOT;
165168
args.u.avz_snapshot_args.slotID = slotID;
166169
args.u.avz_snapshot_args.size = 0;
@@ -214,7 +217,6 @@ void read_snapshot(uint32_t slotID, void *buffer, uint32_t *size) {
214217

215218
if (ME_state == ME_state_resuming) {
216219

217-
DBG0("SOO migration subsys: Entering post migration tasks...\n");
218220
DBG("Pinging ME %d for DC_RESUME...\n", slotID);
219221
do_sync_dom(slotID, DC_RESUME);
220222

@@ -248,18 +250,6 @@ int write_snapshot(void *buffer) {
248250

249251
snapshot_size = *((uint32_t *) buffer);
250252

251-
args.cmd = AVZ_ME_WRITE_SNAPSHOT;
252-
253-
args.u.avz_snapshot_args.size = snapshot_size;
254-
args.u.avz_snapshot_args.slotID = 0;
255-
256-
avz_hypercall(&args);
257-
258-
if (!args.u.avz_snapshot_args.slotID)
259-
return -1; /* No free space */
260-
261-
slotID = args.u.avz_snapshot_args.slotID;
262-
263253
ret = misc_register(&cma_malloc_miscdevice);
264254

265255
dev = cma_malloc_miscdevice.this_device;
@@ -277,11 +267,22 @@ int write_snapshot(void *buffer) {
277267
BUG_ON(ret);
278268

279269
args.cmd = AVZ_ME_WRITE_SNAPSHOT;
280-
270+
271+
args.u.avz_snapshot_args.size = snapshot_size;
272+
args.u.avz_snapshot_args.slotID = -1;
281273
args.u.avz_snapshot_args.snapshot_paddr = (void *) dma_handle;
282274

275+
DBG("%s: Now asking AVZ to re-implement the snapshot of size %d bytes...\n", __func__, snapshot_size);
276+
283277
avz_hypercall(&args);
284278

279+
if (!args.u.avz_snapshot_args.slotID) {
280+
printk("%s: No free space...\n", __func__);
281+
return -1; /* No free space */
282+
}
283+
284+
slotID = args.u.avz_snapshot_args.slotID;
285+
285286
dma_free_coherent(dev, snapshot_size, me, dma_handle);
286287
misc_deregister(&cma_malloc_miscdevice);
287288

linux/linux/soo/kernel/vbus/vbus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static irqreturn_t directcomm_isr(int irq, void *args) {
770770
case DC_PRE_SUSPEND:
771771
case DC_SUSPEND:
772772
case DC_RESUME:
773-
case DC_FORCE_TERMINATE:
773+
case DC_SHUTDOWN:
774774
case DC_POST_ACTIVATE:
775775
case DC_TRIGGER_DEV_PROBE:
776776
case DC_TRIGGER_LOCAL_COOPERATION:

linux/usr/apps/restoreme.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main(int argc, char *argv[]) {
5353
zip = zip_open(argv[1], 0, 'r');
5454

5555
if (!zip) {
56-
printf("Failed to open the zip file. Is there a bad sync after saving the snapshot?...");
56+
printf("Failed to open the zip file. Is there a bad sync after saving the snapshot?...\n");
5757
return EXIT_FAILURE;
5858
}
5959

@@ -63,8 +63,9 @@ int main(int argc, char *argv[]) {
6363

6464
zip_close(zip);
6565

66-
printf(" ** ME memory re-implantation and resuming...\n");
66+
printf(" ** ME memory re-implantation and resuming the capsule.\n");
6767

68+
args.slotID = -1;
6869
ioctl(fd_core, AGENCY_IOCTL_WRITE_SNAPSHOT, &args);
6970

7071
close(fd_core);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ typedef struct {
8484

8585
#define AGENCY_IOCTL_READ_SNAPSHOT _IOWR('S', 1, agency_ioctl_args_t)
8686
#define AGENCY_IOCTL_WRITE_SNAPSHOT _IOW('S', 2, agency_ioctl_args_t)
87-
#define AGENCY_IOCTL_SHUTDOWN _IOW('S', 3, agency_ioctl_args_t)
87+
#define AGENCY_IOCTL_SHUTDOWN _IOW('S', 3, agency_ioctl_args_t)
8888
#define AGENCY_IOCTL_INJECT_CAPSULE _IOWR('S', 4, agency_ioctl_args_t)
8989
#define AGENCY_IOCTL_START_CAPSULE _IOWR('S', 5, agency_ioctl_args_t)
9090
#define AGENCY_IOCTL_GET_ME_ID _IOWR('S', 6, agency_ioctl_args_t)

0 commit comments

Comments
 (0)