Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234233
b: refs/heads/master
c: 55fb4ac
h: refs/heads/master
i:
  234231: 73c3d65
v: v3
  • Loading branch information
Ian Campbell authored and Stefano Stabellini committed Feb 25, 2011
1 parent af26d2d commit 8d9cf22
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 07af38102fc4f260cc5a2418ec833707f53cdf70
refs/heads/master: 55fb4acef7089a6d4d93ed8caae6c258d06cfaf7
23 changes: 18 additions & 5 deletions trunk/drivers/xen/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ static enum shutdown_state shutting_down = SHUTDOWN_INVALID;
struct suspend_info {
int cancelled;
unsigned long arg; /* extra hypercall argument */
void (*pre)(void);
void (*post)(int cancelled);
};

static void xen_hvm_post_suspend(int cancelled)
Expand Down Expand Up @@ -74,14 +76,18 @@ static int xen_hvm_suspend(void *data)
return err;
}

if (si->pre)
si->pre();

/*
* This hypercall returns 1 if suspend was cancelled
* or the domain was merely checkpointed, and 0 if it
* is resuming in a new domain.
*/
si->cancelled = HYPERVISOR_suspend(si->arg);

xen_hvm_post_suspend(si->cancelled);
if (si->post)
si->post(si->cancelled);

if (!si->cancelled) {
xen_irq_resume();
Expand All @@ -108,7 +114,8 @@ static int xen_suspend(void *data)
return err;
}

xen_pre_suspend();
if (si->pre)
si->pre();

/*
* This hypercall returns 1 if suspend was cancelled
Expand All @@ -117,7 +124,8 @@ static int xen_suspend(void *data)
*/
si->cancelled = HYPERVISOR_suspend(si->arg);

xen_post_suspend(si->cancelled);
if (si->post)
si->post(si->cancelled);

if (!si->cancelled) {
xen_irq_resume();
Expand Down Expand Up @@ -165,10 +173,15 @@ static void do_suspend(void)

si.cancelled = 1;

if (xen_hvm_domain())
if (xen_hvm_domain()) {
si.arg = 0UL;
else
si.pre = NULL;
si.post = &xen_hvm_post_suspend;
} else {
si.arg = virt_to_mfn(xen_start_info);
si.pre = &xen_pre_suspend;
si.post = &xen_post_suspend;
}

if (xen_hvm_domain())
err = stop_machine(xen_hvm_suspend, &si, cpumask_of(0));
Expand Down

0 comments on commit 8d9cf22

Please sign in to comment.