Message ID | DE8DF0795D48FD4CA783C40EC82923350136FF61@SHSMSX101.ccr.corp.intel.com |
---|---|
State | New |
Headers | show |
On 09/09/13 04:28, Liu, Jinsong wrote: > From 63668de43b6512c1db06405b0d2d1e0a0c68244b Mon Sep 17 00:00:00 2001 > From: Liu Jinsong <jinsong.liu@intel.com> > Date: Sun, 8 Sep 2013 00:39:45 +0800 > Subject: [PATCH V3 2/2] qemu: Add qemu xen logic for Xen HVM S3 resume > > This patch is qemu patch 2 to fix Xen HVM S3 bug, adding qemu > xen logic. When qemu wakeup, qemu xen logic is notified and > hypercall to xen hypervisor to unpause domain. > > Signed-off-by: Liu Jinsong <jinsong.liu@intel.com> > --- > xen-all.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/xen-all.c b/xen-all.c > index eb13111..388d311 100644 > --- a/xen-all.c > +++ b/xen-all.c > @@ -98,6 +98,7 @@ typedef struct XenIOState { > > Notifier exit; > Notifier suspend; > + Notifier wakeup; > } XenIOState; > > /* Xen specific function for piix pci */ > @@ -1059,6 +1060,11 @@ static void xen_read_physmap(XenIOState *state) > free(entries); > } > > +static void xen_wakeup_notifier(Notifier *notifier, void *data) > +{ > + xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0); > +} > + > int xen_hvm_init(void) > { > int i, rc; > @@ -1088,6 +1094,9 @@ int xen_hvm_init(void) > state->suspend.notify = xen_suspend_notifier; > qemu_register_suspend_notifier(&state->suspend); > > + state->wakeup.notify = xen_wakeup_notifier; > + qemu_register_wakeup_notifier(&state->wakeup); > + > xc_get_hvm_param(xen_xc, xen_domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn); > DPRINTF("shared page at pfn %lx\n", ioreq_pfn); > state->shared_page = xc_map_foreign_range(xen_xc, xen_domid, XC_PAGE_SIZE, > Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
diff --git a/xen-all.c b/xen-all.c index eb13111..388d311 100644 --- a/xen-all.c +++ b/xen-all.c @@ -98,6 +98,7 @@ typedef struct XenIOState { Notifier exit; Notifier suspend; + Notifier wakeup; } XenIOState; /* Xen specific function for piix pci */ @@ -1059,6 +1060,11 @@ static void xen_read_physmap(XenIOState *state) free(entries); } +static void xen_wakeup_notifier(Notifier *notifier, void *data) +{ + xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0); +} + int xen_hvm_init(void) { int i, rc; @@ -1088,6 +1094,9 @@ int xen_hvm_init(void) state->suspend.notify = xen_suspend_notifier; qemu_register_suspend_notifier(&state->suspend); + state->wakeup.notify = xen_wakeup_notifier; + qemu_register_wakeup_notifier(&state->wakeup); + xc_get_hvm_param(xen_xc, xen_domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn); DPRINTF("shared page at pfn %lx\n", ioreq_pfn); state->shared_page = xc_map_foreign_range(xen_xc, xen_domid, XC_PAGE_SIZE,