Vitaly Kuznetsov | 9963236 | 2017-03-14 18:35:49 +0100 | [diff] [blame] | 1 | #include <linux/types.h> |
| 2 | |
| 3 | #include <asm/fixmap.h> |
| 4 | |
| 5 | #include <asm/xen/hypercall.h> |
| 6 | #include <asm/xen/page.h> |
| 7 | |
| 8 | #include "xen-ops.h" |
| 9 | |
| 10 | void xen_pv_pre_suspend(void) |
| 11 | { |
| 12 | xen_mm_pin_all(); |
| 13 | |
| 14 | xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); |
| 15 | xen_start_info->console.domU.mfn = |
| 16 | mfn_to_pfn(xen_start_info->console.domU.mfn); |
| 17 | |
| 18 | BUG_ON(!irqs_disabled()); |
| 19 | |
| 20 | HYPERVISOR_shared_info = &xen_dummy_shared_info; |
| 21 | if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_PARAVIRT_BOOTMAP), |
| 22 | __pte_ma(0), 0)) |
| 23 | BUG(); |
| 24 | } |
| 25 | |
| 26 | void xen_pv_post_suspend(int suspend_cancelled) |
| 27 | { |
| 28 | xen_build_mfn_list_list(); |
| 29 | |
| 30 | xen_setup_shared_info(); |
| 31 | |
| 32 | if (suspend_cancelled) { |
| 33 | xen_start_info->store_mfn = |
| 34 | pfn_to_mfn(xen_start_info->store_mfn); |
| 35 | xen_start_info->console.domU.mfn = |
| 36 | pfn_to_mfn(xen_start_info->console.domU.mfn); |
| 37 | } else { |
| 38 | #ifdef CONFIG_SMP |
| 39 | BUG_ON(xen_cpu_initialized_map == NULL); |
| 40 | cpumask_copy(xen_cpu_initialized_map, cpu_online_mask); |
| 41 | #endif |
| 42 | xen_vcpu_restore(); |
| 43 | } |
| 44 | |
| 45 | xen_mm_unpin_all(); |
| 46 | } |