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)
}
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);
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);
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 )
#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
struct vcpu *v = current;
struct domain *d = v->domain;
- if ( !is_viridian_domain(d) )
+ if ( !is_viridian_domain(d) ) {
+ gdprintk(XENLOG_WARNING, "%s: %d not a viridian domain\n", __func__,
+ d->domain_id);
return 0;
+ }
switch ( idx )
{
struct vcpu *v = current;
struct domain *d = v->domain;
- if ( !is_viridian_domain(d) )
+ if ( !is_viridian_domain(d) ) {
+ gdprintk(XENLOG_WARNING, "%s: %d not a viridian domain\n", __func__,
+ d->domain_id);
return 0;
+ }
switch ( idx )
{
if ( hvm_load_entry(VIRIDIAN_DOMAIN, h, &ctxt) != 0 )
return -EINVAL;
+ ASSERT(is_viridian_domain(d));
+
d->arch.hvm_domain.viridian.hypercall_gpa.raw = ctxt.hypercall_gpa;
d->arch.hvm_domain.viridian.guest_os_id.raw = ctxt.guest_os_id;
if ( hvm_load_entry(VIRIDIAN_VCPU, h, &ctxt) != 0 )
return -EINVAL;
+ ASSERT(is_viridian_domain(d));
+
v->arch.hvm_vcpu.viridian.apic_assist.raw = ctxt.apic_assist;
return 0;