diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c index 43e6c52e68..9564480651 100644 --- a/tools/libxc/xc_domain_restore.c +++ b/tools/libxc/xc_domain_restore.c @@ -670,6 +670,7 @@ typedef struct { uint64_t vm86_tss; uint64_t console_pfn; uint64_t acpi_ioport_location; + uint64_t viridian; } pagebuf_t; static int pagebuf_init(pagebuf_t* buf) @@ -804,6 +805,16 @@ static int pagebuf_get_one(xc_interface *xch, struct restore_ctx *ctx, } return pagebuf_get_one(xch, ctx, buf, fd, dom); + case XC_SAVE_ID_HVM_VIRIDIAN: + /* Skip padding 4 bytes then read the acpi ioport location. */ + if ( RDEXACT(fd, &buf->viridian, sizeof(uint32_t)) || + RDEXACT(fd, &buf->viridian, sizeof(uint64_t)) ) + { + PERROR("error read the viridian flag"); + return -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); @@ -1353,6 +1364,9 @@ 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.viridian != 0) + xc_set_hvm_param(xch, dom, HVM_PARAM_VIRIDIAN, 1); + 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); diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 4deca18a16..c32aef61cd 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -1642,6 +1642,18 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter PERROR("Error when writing the firmware ioport version"); goto out; } + + chunk.id = XC_SAVE_ID_HVM_VIRIDIAN; + chunk.data = 0; + xc_get_hvm_param(xch, dom, HVM_PARAM_VIRIDIAN, + (unsigned long *)&chunk.data); + + if ( (chunk.data != 0) && + wrexact(io_fd, &chunk, sizeof(chunk)) ) + { + PERROR("Error when writing the viridian flag"); + goto out; + } } if ( !callbacks->checkpoint ) diff --git a/tools/libxc/xg_save_restore.h b/tools/libxc/xg_save_restore.h index 02116012e2..9648e80c3a 100644 --- a/tools/libxc/xg_save_restore.h +++ b/tools/libxc/xg_save_restore.h @@ -134,6 +134,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 +#define XC_SAVE_ID_HVM_VIRIDIAN -11 /* ** We process save/restore/migrate in batches of pages; the below