WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH V3 5/6] libxc, save/restore, Save the HVM_PARAM_ACPI_

To: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH V3 5/6] libxc, save/restore, Save the HVM_PARAM_ACPI_NEW_IOPORT
From: anthony.perard@xxxxxxxxxx
Date: Fri, 29 Oct 2010 13:08:38 +0100
Cc: anthony.perard@xxxxxxxxxx
Delivery-date: Fri, 29 Oct 2010 05:17:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1288354119-1916-1-git-send-email-anthony.perard@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1288354119-1916-1-git-send-email-anthony.perard@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
From: Anthony PERARD <anthony.perard@xxxxxxxxxx>

This will save the acpi_new_ioport hvm_param in the checkpoint file and
set the parameter in Xen at restore.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/libxc/xc_domain_restore.c |   12 ++++++++++++
 tools/libxc/xc_domain_save.c    |   11 +++++++++++
 tools/libxc/xg_save_restore.h   |    1 +
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index 316f32d..c03512f 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -647,6 +647,7 @@ typedef struct {
     uint64_t identpt;
     uint64_t vm86_tss;
     uint64_t console_pfn;
+    int new_acpi_ioport;
 } pagebuf_t;
 
 static int pagebuf_init(pagebuf_t* buf)
@@ -771,6 +772,10 @@ static int pagebuf_get_one(xc_interface *xch, struct 
restore_ctx *ctx,
         // DPRINTF("last checkpoint indication received");
         return pagebuf_get_one(xch, ctx, buf, fd, dom);
 
+    case XC_SAVE_ID_HVM_ACPI_NEW_IOPORT:
+        buf->new_acpi_ioport = 1;
+        return pagebuf_get_one(xch, ctx, buf, fd, dom);
+
     default:
         if ( (count > MAX_BATCH_SIZE) || (count < 0) ) {
             ERROR("Max batch size exceeded (%d). Giving up.", count);
@@ -1317,6 +1322,13 @@ int xc_domain_restore(xc_interface *xch, int io_fd, 
uint32_t dom,
             fcntl(io_fd, F_SETFL, orig_io_fd_flags | O_NONBLOCK);
     }
 
+    if (pagebuf.new_acpi_ioport) {
+        DBGPRINTF("Use new firmware ioport from the checkpoint\n");
+        xc_set_hvm_param(xch, dom, HVM_PARAM_ACPI_NEW_IOPORT, 1);
+    } else {
+        DBGPRINTF("Use old firmware ioport from the checkpoint\n");
+    }
+
     if ( ctx->last_checkpoint )
     {
         // DPRINTF("Last checkpoint, finishing\n");
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index 47f8a79..83af771 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -1618,6 +1618,17 @@ int xc_domain_save(xc_interface *xch, int io_fd, 
uint32_t dom, uint32_t max_iter
             PERROR("Error when writing the console pfn for guest");
             goto out;
         }
+
+        chunk.id = XC_SAVE_ID_HVM_ACPI_NEW_IOPORT;
+        xc_get_hvm_param(xch, dom, HVM_PARAM_ACPI_NEW_IOPORT,
+                         (unsigned long *)&chunk.data);
+
+        if ( (chunk.data != 0) &&
+             wrexact(io_fd, &chunk.id, sizeof(int)) )
+        {
+            PERROR("Error when writing the firmware ioport version");
+            goto out;
+        }
     }
 
     if ( !callbacks->checkpoint )
diff --git a/tools/libxc/xg_save_restore.h b/tools/libxc/xg_save_restore.h
index 2c82ce7..c86b6c4 100644
--- a/tools/libxc/xg_save_restore.h
+++ b/tools/libxc/xg_save_restore.h
@@ -132,6 +132,7 @@
 #define XC_SAVE_ID_TSC_INFO           -7
 #define XC_SAVE_ID_HVM_CONSOLE_PFN    -8 /* (HVM-only) */
 #define XC_SAVE_ID_LAST_CHECKPOINT    -9 /* Commit to restoring after 
completion of current iteration. */
+#define XC_SAVE_ID_HVM_ACPI_NEW_IOPORT -10
 
 /*
 ** We process save/restore/migrate in batches of pages; the below
-- 
1.7.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel