diff options
-rw-r--r-- | arch/x86/xen/suspend.c | 23 | ||||
-rw-r--r-- | arch/x86/xen/xen-ops.h | 2 | ||||
-rw-r--r-- | drivers/xen/manage.c | 45 | ||||
-rw-r--r-- | include/xen/xen-ops.h | 4 |
4 files changed, 29 insertions, 45 deletions
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index 45329c8c226e..c4df9dbd63b7 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c | |||
@@ -12,8 +12,10 @@ | |||
12 | #include "xen-ops.h" | 12 | #include "xen-ops.h" |
13 | #include "mmu.h" | 13 | #include "mmu.h" |
14 | 14 | ||
15 | void xen_arch_pre_suspend(void) | 15 | static void xen_pv_pre_suspend(void) |
16 | { | 16 | { |
17 | xen_mm_pin_all(); | ||
18 | |||
17 | xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); | 19 | xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); |
18 | xen_start_info->console.domU.mfn = | 20 | xen_start_info->console.domU.mfn = |
19 | mfn_to_pfn(xen_start_info->console.domU.mfn); | 21 | mfn_to_pfn(xen_start_info->console.domU.mfn); |
@@ -26,7 +28,7 @@ void xen_arch_pre_suspend(void) | |||
26 | BUG(); | 28 | BUG(); |
27 | } | 29 | } |
28 | 30 | ||
29 | void xen_arch_hvm_post_suspend(int suspend_cancelled) | 31 | static void xen_hvm_post_suspend(int suspend_cancelled) |
30 | { | 32 | { |
31 | #ifdef CONFIG_XEN_PVHVM | 33 | #ifdef CONFIG_XEN_PVHVM |
32 | int cpu; | 34 | int cpu; |
@@ -41,7 +43,7 @@ void xen_arch_hvm_post_suspend(int suspend_cancelled) | |||
41 | #endif | 43 | #endif |
42 | } | 44 | } |
43 | 45 | ||
44 | void xen_arch_post_suspend(int suspend_cancelled) | 46 | static void xen_pv_post_suspend(int suspend_cancelled) |
45 | { | 47 | { |
46 | xen_build_mfn_list_list(); | 48 | xen_build_mfn_list_list(); |
47 | 49 | ||
@@ -60,6 +62,21 @@ void xen_arch_post_suspend(int suspend_cancelled) | |||
60 | xen_vcpu_restore(); | 62 | xen_vcpu_restore(); |
61 | } | 63 | } |
62 | 64 | ||
65 | xen_mm_unpin_all(); | ||
66 | } | ||
67 | |||
68 | void xen_arch_pre_suspend(void) | ||
69 | { | ||
70 | if (xen_pv_domain()) | ||
71 | xen_pv_pre_suspend(); | ||
72 | } | ||
73 | |||
74 | void xen_arch_post_suspend(int cancelled) | ||
75 | { | ||
76 | if (xen_pv_domain()) | ||
77 | xen_pv_post_suspend(cancelled); | ||
78 | else | ||
79 | xen_hvm_post_suspend(cancelled); | ||
63 | } | 80 | } |
64 | 81 | ||
65 | static void xen_vcpu_notify_restore(void *data) | 82 | static void xen_vcpu_notify_restore(void *data) |
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index 1cb6f4c37300..c834d4b231f0 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h | |||
@@ -31,6 +31,8 @@ void xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn); | |||
31 | void xen_reserve_top(void); | 31 | void xen_reserve_top(void); |
32 | extern unsigned long xen_max_p2m_pfn; | 32 | extern unsigned long xen_max_p2m_pfn; |
33 | 33 | ||
34 | void xen_mm_pin_all(void); | ||
35 | void xen_mm_unpin_all(void); | ||
34 | void xen_set_pat(u64); | 36 | void xen_set_pat(u64); |
35 | 37 | ||
36 | char * __init xen_memory_setup(void); | 38 | char * __init xen_memory_setup(void); |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 32f9236c959f..c3667b202f2f 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -41,9 +41,6 @@ static enum shutdown_state shutting_down = SHUTDOWN_INVALID; | |||
41 | 41 | ||
42 | struct suspend_info { | 42 | struct suspend_info { |
43 | int cancelled; | 43 | int cancelled; |
44 | unsigned long arg; /* extra hypercall argument */ | ||
45 | void (*pre)(void); | ||
46 | void (*post)(int cancelled); | ||
47 | }; | 44 | }; |
48 | 45 | ||
49 | static RAW_NOTIFIER_HEAD(xen_resume_notifier); | 46 | static RAW_NOTIFIER_HEAD(xen_resume_notifier); |
@@ -61,26 +58,6 @@ void xen_resume_notifier_unregister(struct notifier_block *nb) | |||
61 | EXPORT_SYMBOL_GPL(xen_resume_notifier_unregister); | 58 | EXPORT_SYMBOL_GPL(xen_resume_notifier_unregister); |
62 | 59 | ||
63 | #ifdef CONFIG_HIBERNATE_CALLBACKS | 60 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
64 | static void xen_hvm_post_suspend(int cancelled) | ||
65 | { | ||
66 | xen_arch_hvm_post_suspend(cancelled); | ||
67 | gnttab_resume(); | ||
68 | } | ||
69 | |||
70 | static void xen_pre_suspend(void) | ||
71 | { | ||
72 | xen_mm_pin_all(); | ||
73 | gnttab_suspend(); | ||
74 | xen_arch_pre_suspend(); | ||
75 | } | ||
76 | |||
77 | static void xen_post_suspend(int cancelled) | ||
78 | { | ||
79 | xen_arch_post_suspend(cancelled); | ||
80 | gnttab_resume(); | ||
81 | xen_mm_unpin_all(); | ||
82 | } | ||
83 | |||
84 | static int xen_suspend(void *data) | 61 | static int xen_suspend(void *data) |
85 | { | 62 | { |
86 | struct suspend_info *si = data; | 63 | struct suspend_info *si = data; |
@@ -94,18 +71,20 @@ static int xen_suspend(void *data) | |||
94 | return err; | 71 | return err; |
95 | } | 72 | } |
96 | 73 | ||
97 | if (si->pre) | 74 | gnttab_suspend(); |
98 | si->pre(); | 75 | xen_arch_pre_suspend(); |
99 | 76 | ||
100 | /* | 77 | /* |
101 | * This hypercall returns 1 if suspend was cancelled | 78 | * This hypercall returns 1 if suspend was cancelled |
102 | * or the domain was merely checkpointed, and 0 if it | 79 | * or the domain was merely checkpointed, and 0 if it |
103 | * is resuming in a new domain. | 80 | * is resuming in a new domain. |
104 | */ | 81 | */ |
105 | si->cancelled = HYPERVISOR_suspend(si->arg); | 82 | si->cancelled = HYPERVISOR_suspend(xen_pv_domain() |
83 | ? virt_to_mfn(xen_start_info) | ||
84 | : 0); | ||
106 | 85 | ||
107 | if (si->post) | 86 | xen_arch_post_suspend(si->cancelled); |
108 | si->post(si->cancelled); | 87 | gnttab_resume(); |
109 | 88 | ||
110 | if (!si->cancelled) { | 89 | if (!si->cancelled) { |
111 | xen_irq_resume(); | 90 | xen_irq_resume(); |
@@ -154,16 +133,6 @@ static void do_suspend(void) | |||
154 | 133 | ||
155 | si.cancelled = 1; | 134 | si.cancelled = 1; |
156 | 135 | ||
157 | if (xen_hvm_domain()) { | ||
158 | si.arg = 0UL; | ||
159 | si.pre = NULL; | ||
160 | si.post = &xen_hvm_post_suspend; | ||
161 | } else { | ||
162 | si.arg = virt_to_mfn(xen_start_info); | ||
163 | si.pre = &xen_pre_suspend; | ||
164 | si.post = &xen_post_suspend; | ||
165 | } | ||
166 | |||
167 | err = stop_machine(xen_suspend, &si, cpumask_of(0)); | 136 | err = stop_machine(xen_suspend, &si, cpumask_of(0)); |
168 | 137 | ||
169 | raw_notifier_call_chain(&xen_resume_notifier, 0, NULL); | 138 | raw_notifier_call_chain(&xen_resume_notifier, 0, NULL); |
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index 2cf47175b12b..0b3149ed7eaa 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h | |||
@@ -9,10 +9,6 @@ DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); | |||
9 | 9 | ||
10 | void xen_arch_pre_suspend(void); | 10 | void xen_arch_pre_suspend(void); |
11 | void xen_arch_post_suspend(int suspend_cancelled); | 11 | void xen_arch_post_suspend(int suspend_cancelled); |
12 | void xen_arch_hvm_post_suspend(int suspend_cancelled); | ||
13 | |||
14 | void xen_mm_pin_all(void); | ||
15 | void xen_mm_unpin_all(void); | ||
16 | 12 | ||
17 | void xen_timer_resume(void); | 13 | void xen_timer_resume(void); |
18 | void xen_arch_resume(void); | 14 | void xen_arch_resume(void); |