Commit 82043bb6 authored by Ian Campbell's avatar Ian Campbell Committed by Stefano Stabellini

xen: suspend: refactor non-arch specific pre/post suspend hooks

Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 03c8142b
...@@ -39,6 +39,23 @@ struct suspend_info { ...@@ -39,6 +39,23 @@ struct suspend_info {
unsigned long arg; /* extra hypercall argument */ unsigned long arg; /* extra hypercall argument */
}; };
static void xen_hvm_post_suspend(void)
{
gnttab_resume();
}
static void xen_pre_suspend(void)
{
xen_mm_pin_all();
gnttab_suspend();
}
static void xen_post_suspend(void)
{
gnttab_resume();
xen_mm_unpin_all();
}
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int xen_hvm_suspend(void *data) static int xen_hvm_suspend(void *data)
{ {
...@@ -62,7 +79,7 @@ static int xen_hvm_suspend(void *data) ...@@ -62,7 +79,7 @@ static int xen_hvm_suspend(void *data)
si->cancelled = HYPERVISOR_suspend(si->arg); si->cancelled = HYPERVISOR_suspend(si->arg);
xen_arch_hvm_post_suspend(si->cancelled); xen_arch_hvm_post_suspend(si->cancelled);
gnttab_resume(); xen_hvm_post_suspend();
if (!si->cancelled) { if (!si->cancelled) {
xen_irq_resume(); xen_irq_resume();
...@@ -89,8 +106,7 @@ static int xen_suspend(void *data) ...@@ -89,8 +106,7 @@ static int xen_suspend(void *data)
return err; return err;
} }
xen_mm_pin_all(); xen_pre_suspend();
gnttab_suspend();
xen_arch_pre_suspend(); xen_arch_pre_suspend();
/* /*
...@@ -101,8 +117,7 @@ static int xen_suspend(void *data) ...@@ -101,8 +117,7 @@ static int xen_suspend(void *data)
si->cancelled = HYPERVISOR_suspend(si->arg); si->cancelled = HYPERVISOR_suspend(si->arg);
xen_arch_post_suspend(si->cancelled); xen_arch_post_suspend(si->cancelled);
gnttab_resume(); xen_post_suspend();
xen_mm_unpin_all();
if (!si->cancelled) { if (!si->cancelled) {
xen_irq_resume(); xen_irq_resume();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment