direct-io.hg
changeset 890:45635770bd4c
bitkeeper revision 1.560 (3fa8e3c6Enpzi2YxcvMiP8aJ3tXbnw)
hypervisor.h, setup.c, kernel.c:
Finished guest support for suspend/resume.
hypervisor.h, setup.c, kernel.c:
Finished guest support for suspend/resume.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Wed Nov 05 11:49:26 2003 +0000 (2003-11-05) |
parents | 4b4252761715 |
children | 9d372131886a |
files | extras/mini-os/kernel.c xenolinux-2.4.22-sparse/arch/xeno/kernel/setup.c xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h |
line diff
1.1 --- a/extras/mini-os/kernel.c Wed Nov 05 10:48:47 2003 +0000 1.2 +++ b/extras/mini-os/kernel.c Wed Nov 05 11:49:26 2003 +0000 1.3 @@ -110,7 +110,7 @@ void start_kernel(start_info_t *si) 1.4 }; printk("\n"); 1.5 printk(" blk_ring: 0x%lx\n", si->blk_ring); 1.6 #endif 1.7 - printk(" dom_id: %d\n", si->dom_id); 1.8 + printk(" dom_id: %ld\n", si->dom_id); 1.9 printk(" flags: 0x%lx\n", si->flags); 1.10 printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); 1.11
2.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/kernel/setup.c Wed Nov 05 10:48:47 2003 +0000 2.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/kernel/setup.c Wed Nov 05 11:49:26 2003 +0000 2.3 @@ -1057,15 +1057,35 @@ static int __init setup_die_event(void) 2.4 * Stop/pickle callback handling. 2.5 */ 2.6 2.7 +#include <asm/suspend.h> 2.8 + 2.9 static void stop_task(void *unused) 2.10 { 2.11 /* Hmmm... a cleaner interface to suspend/resume blkdevs would be nice. */ 2.12 extern void blkdev_suspend(void); 2.13 extern void blkdev_resume(void); 2.14 2.15 + unsigned long *pfn_to_mfn_frame_list = NULL; 2.16 + suspend_record_t *suspend_record = NULL; 2.17 struct net_device *dev; 2.18 char name[6]; 2.19 - int i; 2.20 + int i, j; 2.21 + 2.22 + if ( (pfn_to_mfn_frame_list = (unsigned long *)__get_free_page(GFP_KERNEL)) 2.23 + == NULL ) 2.24 + goto out; 2.25 + if ( (suspend_record = (suspend_record_t *)__get_free_page(GFP_KERNEL)) 2.26 + == NULL ) 2.27 + goto out; 2.28 + 2.29 + suspend_record->pfn_to_mfn_frame_list = 2.30 + virt_to_machine(pfn_to_mfn_frame_list) >> PAGE_SHIFT; 2.31 + suspend_record->nr_pfns = max_pfn; 2.32 + 2.33 + j = 0; 2.34 + for ( i = 0; i < max_pfn; i += (PAGE_SIZE / sizeof(unsigned long)) ) 2.35 + pfn_to_mfn_frame_list[j++] = 2.36 + virt_to_machine(&phys_to_machine_mapping[i]) >> PAGE_SHIFT; 2.37 2.38 rtnl_lock(); 2.39 for ( i = 0; i < 10; i++ ) 2.40 @@ -1083,7 +1103,11 @@ static void stop_task(void *unused) 2.41 HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page; 2.42 clear_fixmap(FIX_SHARED_INFO); 2.43 2.44 - HYPERVISOR_stop(); 2.45 + memcpy(&suspend_record->resume_info, &start_info, sizeof(start_info)); 2.46 + 2.47 + HYPERVISOR_stop(virt_to_machine(suspend_record) >> PAGE_SHIFT); 2.48 + 2.49 + memcpy(&start_info, &suspend_record->resume_info, sizeof(start_info)); 2.50 2.51 set_fixmap(FIX_SHARED_INFO, start_info.shared_info); 2.52 HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO); 2.53 @@ -1101,6 +1125,12 @@ static void stop_task(void *unused) 2.54 dev_open(dev); 2.55 } 2.56 rtnl_unlock(); 2.57 + 2.58 + out: 2.59 + if ( pfn_to_mfn_frame_list != NULL ) 2.60 + free_page((unsigned long)pfn_to_mfn_frame_list); 2.61 + if ( suspend_record != NULL ) 2.62 + free_page((unsigned long)suspend_record); 2.63 } 2.64 2.65 static struct tq_struct stop_tq;
3.1 --- a/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h Wed Nov 05 10:48:47 2003 +0000 3.2 +++ b/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h Wed Nov 05 11:49:26 2003 +0000 3.3 @@ -263,13 +263,14 @@ static inline int HYPERVISOR_exit(void) 3.4 return ret; 3.5 } 3.6 3.7 -static inline int HYPERVISOR_stop(void) 3.8 +static inline int HYPERVISOR_stop(unsigned long srec) 3.9 { 3.10 int ret; 3.11 + /* NB. On suspend, control software expects a suspend record in %esi. */ 3.12 __asm__ __volatile__ ( 3.13 TRAP_INSTR 3.14 : "=a" (ret) : "0" (__HYPERVISOR_sched_op), 3.15 - "b" (SCHEDOP_stop) ); 3.16 + "b" (SCHEDOP_stop), "S" (srec) : "memory" ); 3.17 3.18 return ret; 3.19 }