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
0 commit comments