diff options
author | David Vrabel <david.vrabel@citrix.com> | 2014-05-08 06:09:23 -0400 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2014-05-12 12:19:56 -0400 |
commit | aa8532c32216ae07c3813b9aeb774517878a7573 (patch) | |
tree | 4a718b5c8ba94d2d73e83ad7e50e3796a41b345f /arch/x86/xen/suspend.c | |
parent | 9f1d341415b9d84fcf0cb04f409bd61fac5e2f14 (diff) |
xen: refactor suspend pre/post hooks
New architectures currently have to provide implementations of 5 different
functions: xen_arch_pre_suspend(), xen_arch_post_suspend(),
xen_arch_hvm_post_suspend(), xen_mm_pin_all(), and xen_mm_unpin_all().
Refactor the suspend code to only require xen_arch_pre_suspend() and
xen_arch_post_suspend().
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'arch/x86/xen/suspend.c')
-rw-r--r-- | arch/x86/xen/suspend.c | 23 |
1 files changed, 20 insertions, 3 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) |