Blame 0047-qemu-Add-qemu-xen-logic-for-Xen-HVM-S3-resume.patch

298366
From 1b5f7709411a412ec8ce21004a47f51ab6c3f3ad Mon Sep 17 00:00:00 2001
298366
From: "Liu, Jinsong" <jinsong.liu@intel.com>
298366
Date: Wed, 25 Sep 2013 16:40:23 +0000
298366
Subject: [PATCH] qemu: Add qemu xen logic for Xen HVM S3 resume
298366
298366
This patch is qemu patch 2 to fix Xen HVM S3 bug, adding qemu
298366
xen logic. When qemu wakeup, qemu xen logic is notified and
298366
hypercall to xen hypervisor to unpause domain.
298366
298366
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
298366
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
298366
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
298366
(cherry picked from commit 11addd0ab9371af2b6ec028c7fe4e4c4992252fc)
298366
298366
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
298366
---
298366
 xen-all.c | 9 +++++++++
298366
 1 file changed, 9 insertions(+)
298366
298366
diff --git a/xen-all.c b/xen-all.c
298366
index e1d0694..7894ac6 100644
298366
--- a/xen-all.c
298366
+++ b/xen-all.c
298366
@@ -98,6 +98,7 @@ typedef struct XenIOState {
298366
 
298366
     Notifier exit;
298366
     Notifier suspend;
298366
+    Notifier wakeup;
298366
 } XenIOState;
298366
 
298366
 /* Xen specific function for piix pci */
298366
@@ -1060,6 +1061,11 @@ static void xen_read_physmap(XenIOState *state)
298366
     free(entries);
298366
 }
298366
 
298366
+static void xen_wakeup_notifier(Notifier *notifier, void *data)
298366
+{
298366
+    xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0);
298366
+}
298366
+
298366
 int xen_hvm_init(MemoryRegion **ram_memory)
298366
 {
298366
     int i, rc;
298366
@@ -1089,6 +1095,9 @@ int xen_hvm_init(MemoryRegion **ram_memory)
298366
     state->suspend.notify = xen_suspend_notifier;
298366
     qemu_register_suspend_notifier(&state->suspend);
298366
 
298366
+    state->wakeup.notify = xen_wakeup_notifier;
298366
+    qemu_register_wakeup_notifier(&state->wakeup);
298366
+
298366
     xc_get_hvm_param(xen_xc, xen_domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
298366
     DPRINTF("shared page at pfn %lx\n", ioreq_pfn);
298366
     state->shared_page = xc_map_foreign_range(xen_xc, xen_domid, XC_PAGE_SIZE,