# HG changeset patch
# User Anthony Perard <anthony.perard@xxxxxxxxxx>
# Date 1289237154 0
# Node ID 985f5fa8fc59f84c8577c482df6246258c785991
# Parent beff430f224c1daba0ca7384a23d18ddff77e1f5
libxc: Save the HVM_PARAM_ACPI_IOPORTS_LOCATION
This will save the acpi_ioport_location hvm_param in the checkpoint file
and set the parameter in Xen at restore.
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
tools/libxc/xc_domain_restore.c | 20 ++++++++++++++++++++
tools/libxc/xc_domain_save.c | 10 ++++++++++
tools/libxc/xg_save_restore.h | 1 +
3 files changed, 31 insertions(+)
diff -r beff430f224c -r 985f5fa8fc59 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c Mon Nov 08 17:14:50 2010 +0000
+++ b/tools/libxc/xc_domain_restore.c Mon Nov 08 17:25:54 2010 +0000
@@ -669,6 +669,7 @@ typedef struct {
uint64_t identpt;
uint64_t vm86_tss;
uint64_t console_pfn;
+ uint64_t acpi_ioport_location;
} pagebuf_t;
static int pagebuf_init(pagebuf_t* buf)
@@ -791,6 +792,16 @@ static int pagebuf_get_one(xc_interface
case XC_SAVE_ID_LAST_CHECKPOINT:
ctx->last_checkpoint = 1;
// DPRINTF("last checkpoint indication received");
+ return pagebuf_get_one(xch, ctx, buf, fd, dom);
+
+ case XC_SAVE_ID_HVM_ACPI_IOPORTS_LOCATION:
+ /* Skip padding 4 bytes then read the acpi ioport location. */
+ if ( RDEXACT(fd, &buf->acpi_ioport_location, sizeof(uint32_t)) ||
+ RDEXACT(fd, &buf->acpi_ioport_location, sizeof(uint64_t)) )
+ {
+ PERROR("error read the acpi ioport location");
+ return -1;
+ }
return pagebuf_get_one(xch, ctx, buf, fd, dom);
default:
@@ -1342,6 +1353,15 @@ int xc_domain_restore(xc_interface *xch,
fcntl(io_fd, F_SETFL, orig_io_fd_flags | O_NONBLOCK);
}
+ if (pagebuf.acpi_ioport_location == 1) {
+ DBGPRINTF("Use new firmware ioport from the checkpoint\n");
+ xc_set_hvm_param(xch, dom, HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
+ } else if (pagebuf.acpi_ioport_location == 0) {
+ DBGPRINTF("Use old firmware ioport from the checkpoint\n");
+ } else {
+ ERROR("Error, unknow acpi ioport location (%i)",
pagebuf.acpi_ioport_location);
+ }
+
if ( ctx->last_checkpoint )
{
// DPRINTF("Last checkpoint, finishing\n");
diff -r beff430f224c -r 985f5fa8fc59 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c Mon Nov 08 17:14:50 2010 +0000
+++ b/tools/libxc/xc_domain_save.c Mon Nov 08 17:25:54 2010 +0000
@@ -1628,6 +1628,16 @@ int xc_domain_save(xc_interface *xch, in
PERROR("Error when writing the console pfn for guest");
goto out;
}
+
+ chunk.id = XC_SAVE_ID_HVM_ACPI_IOPORTS_LOCATION;
+ xc_get_hvm_param(xch, dom, HVM_PARAM_ACPI_IOPORTS_LOCATION,
+ (unsigned long *)&chunk.data);
+
+ if ((chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)))
+ {
+ PERROR("Error when writing the firmware ioport version");
+ goto out;
+ }
}
if ( !callbacks->checkpoint )
diff -r beff430f224c -r 985f5fa8fc59 tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h Mon Nov 08 17:14:50 2010 +0000
+++ b/tools/libxc/xg_save_restore.h Mon Nov 08 17:25:54 2010 +0000
@@ -133,6 +133,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_IOPORTS_LOCATION -10
/*
** We process save/restore/migrate in batches of pages; the below
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|