1 #include <linux/types.h>
2 #include <linux/tick.h>
4 #include <xen/interface/xen.h>
5 #include <xen/grant_table.h>
6 #include <xen/events.h>
8 #include <asm/xen/hypercall.h>
9 #include <asm/xen/page.h>
10 #include <asm/fixmap.h>
15 static void xen_pv_pre_suspend(void)
19 xen_start_info
->store_mfn
= mfn_to_pfn(xen_start_info
->store_mfn
);
20 xen_start_info
->console
.domU
.mfn
=
21 mfn_to_pfn(xen_start_info
->console
.domU
.mfn
);
23 BUG_ON(!irqs_disabled());
25 HYPERVISOR_shared_info
= &xen_dummy_shared_info
;
26 if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_PARAVIRT_BOOTMAP
),
31 static void xen_hvm_post_suspend(int suspend_cancelled
)
33 #ifdef CONFIG_XEN_PVHVM
35 if (!suspend_cancelled
)
36 xen_hvm_init_shared_info();
37 xen_callback_vector();
38 xen_unplug_emulated_devices();
39 if (xen_feature(XENFEAT_hvm_safe_pvclock
)) {
40 for_each_online_cpu(cpu
) {
41 xen_setup_runstate_info(cpu
);
47 static void xen_pv_post_suspend(int suspend_cancelled
)
49 xen_build_mfn_list_list();
51 xen_setup_shared_info();
53 if (suspend_cancelled
) {
54 xen_start_info
->store_mfn
=
55 pfn_to_mfn(xen_start_info
->store_mfn
);
56 xen_start_info
->console
.domU
.mfn
=
57 pfn_to_mfn(xen_start_info
->console
.domU
.mfn
);
60 BUG_ON(xen_cpu_initialized_map
== NULL
);
61 cpumask_copy(xen_cpu_initialized_map
, cpu_online_mask
);
69 void xen_arch_pre_suspend(void)
75 void xen_arch_post_suspend(int cancelled
)
78 xen_pv_post_suspend(cancelled
);
80 xen_hvm_post_suspend(cancelled
);
83 static void xen_vcpu_notify_restore(void *data
)
85 /* Boot processor notified via generic timekeeping_resume() */
86 if (smp_processor_id() == 0)
92 static void xen_vcpu_notify_suspend(void *data
)
97 void xen_arch_resume(void)
99 on_each_cpu(xen_vcpu_notify_restore
, NULL
, 1);
102 void xen_arch_suspend(void)
104 on_each_cpu(xen_vcpu_notify_suspend
, NULL
, 1);