0001
0002 #include <linux/types.h>
0003
0004 #include <asm/xen/hypercall.h>
0005 #include <asm/xen/page.h>
0006
0007 #include <asm/fixmap.h>
0008
0009 #include "xen-ops.h"
0010
0011 void xen_pv_pre_suspend(void)
0012 {
0013 xen_mm_pin_all();
0014
0015 xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
0016 xen_start_info->console.domU.mfn =
0017 mfn_to_pfn(xen_start_info->console.domU.mfn);
0018
0019 BUG_ON(!irqs_disabled());
0020
0021 HYPERVISOR_shared_info = &xen_dummy_shared_info;
0022 if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_PARAVIRT_BOOTMAP),
0023 __pte_ma(0), 0))
0024 BUG();
0025 }
0026
0027 void xen_pv_post_suspend(int suspend_cancelled)
0028 {
0029 xen_build_mfn_list_list();
0030 set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_start_info->shared_info);
0031 HYPERVISOR_shared_info = (void *)fix_to_virt(FIX_PARAVIRT_BOOTMAP);
0032 xen_setup_mfn_list_list();
0033
0034 if (suspend_cancelled) {
0035 xen_start_info->store_mfn =
0036 pfn_to_mfn(xen_start_info->store_mfn);
0037 xen_start_info->console.domU.mfn =
0038 pfn_to_mfn(xen_start_info->console.domU.mfn);
0039 } else {
0040 #ifdef CONFIG_SMP
0041 BUG_ON(xen_cpu_initialized_map == NULL);
0042 cpumask_copy(xen_cpu_initialized_map, cpu_online_mask);
0043 #endif
0044 xen_vcpu_restore();
0045 }
0046
0047 xen_mm_unpin_all();
0048 }