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>
This commit is contained in:
@@ -12,8 +12,10 @@
|
||||
#include "xen-ops.h"
|
||||
#include "mmu.h"
|
||||
|
||||
void xen_arch_pre_suspend(void)
|
||||
static void xen_pv_pre_suspend(void)
|
||||
{
|
||||
xen_mm_pin_all();
|
||||
|
||||
xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
|
||||
xen_start_info->console.domU.mfn =
|
||||
mfn_to_pfn(xen_start_info->console.domU.mfn);
|
||||
@@ -26,7 +28,7 @@ void xen_arch_pre_suspend(void)
|
||||
BUG();
|
||||
}
|
||||
|
||||
void xen_arch_hvm_post_suspend(int suspend_cancelled)
|
||||
static void xen_hvm_post_suspend(int suspend_cancelled)
|
||||
{
|
||||
#ifdef CONFIG_XEN_PVHVM
|
||||
int cpu;
|
||||
@@ -41,7 +43,7 @@ void xen_arch_hvm_post_suspend(int suspend_cancelled)
|
||||
#endif
|
||||
}
|
||||
|
||||
void xen_arch_post_suspend(int suspend_cancelled)
|
||||
static void xen_pv_post_suspend(int suspend_cancelled)
|
||||
{
|
||||
xen_build_mfn_list_list();
|
||||
|
||||
@@ -60,6 +62,21 @@ void xen_arch_post_suspend(int suspend_cancelled)
|
||||
xen_vcpu_restore();
|
||||
}
|
||||
|
||||
xen_mm_unpin_all();
|
||||
}
|
||||
|
||||
void xen_arch_pre_suspend(void)
|
||||
{
|
||||
if (xen_pv_domain())
|
||||
xen_pv_pre_suspend();
|
||||
}
|
||||
|
||||
void xen_arch_post_suspend(int cancelled)
|
||||
{
|
||||
if (xen_pv_domain())
|
||||
xen_pv_post_suspend(cancelled);
|
||||
else
|
||||
xen_hvm_post_suspend(cancelled);
|
||||
}
|
||||
|
||||
static void xen_vcpu_notify_restore(void *data)
|
||||
|
@@ -31,6 +31,8 @@ void xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn);
|
||||
void xen_reserve_top(void);
|
||||
extern unsigned long xen_max_p2m_pfn;
|
||||
|
||||
void xen_mm_pin_all(void);
|
||||
void xen_mm_unpin_all(void);
|
||||
void xen_set_pat(u64);
|
||||
|
||||
char * __init xen_memory_setup(void);
|
||||
|
Reference in New Issue
Block a user