>From e7d4bd70eae8da131dc3ff2cec70cb2c7b6575a9 Mon Sep 17 00:00:00 2001
From: Liu Jinsong <jinsong....@intel.com>
Date: Mon, 2 Sep 2013 00:39:20 +0800
Subject: [PATCH 2/2] qemu-xen: add qemu xen logic for HVM S3 resume

This patch is qemu-xen patch 2 to fix 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....@intel.com>
---
 xen-all.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 15be8ed..bef946b 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -97,6 +97,7 @@ typedef struct XenIOState {
 
     Notifier exit;
     Notifier suspend;
+    Notifier later_wakeup;
 } XenIOState;
 
 /* Xen specific function for piix pci */
@@ -139,6 +140,11 @@ static void xen_suspend_notifier(Notifier *notifier, void 
*data)
     xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3);
 }
 
+static void xen_later_wakeup_notifier(Notifier *notifier, void *data)
+{
+    xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0);
+}
+
 /* Xen Interrupt Controller */
 
 static void xen_set_irq(void *opaque, int irq, int level)
@@ -1106,6 +1112,9 @@ int xen_hvm_init(void)
     state->suspend.notify = xen_suspend_notifier;
     qemu_register_suspend_notifier(&state->suspend);
 
+    state->later_wakeup.notify = xen_later_wakeup_notifier;
+    qemu_register_later_wakeup_notifier(&state->later_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,
-- 
1.7.1

Attachment: 0002-Add-qemu-xen-logic-for-HVM-S3-resume.patch
Description: 0002-Add-qemu-xen-logic-for-HVM-S3-resume.patch

Reply via email to