if ( ctxt->caps & ~guest_mcg_cap & ~MCG_CAP_COUNT & ~MCG_CTL_P )
{
- dprintk(XENLOG_G_ERR, "%s restore: unsupported MCA capabilities"
- " %#" PRIx64 " for %pv (supported: %#Lx)\n",
+ printk(XENLOG_G_ERR
+ "%s restore: unsupported MCA capabilities %#"PRIx64" for %pv (supported: %#Lx)\n",
is_hvm_vcpu(v) ? "HVM" : "PV", ctxt->caps,
v, guest_mcg_cap & ~MCG_CAP_COUNT);
- return -EPERM;
+ return -EINVAL;
}
v->arch.vmce.mcg_cap = ctxt->caps;
static int pit_load(struct domain *d, hvm_domain_context_t *h)
{
PITState *pit = domain_vpit(d);
- int i;
+ int i, rc = 0;
if ( !has_vpit(d) )
return -ENODEV;
if ( hvm_load_entry(PIT, h, &pit->hw) )
{
- spin_unlock(&pit->lock);
- return 1;
+ rc = -ENODATA;
+ goto out;
}
/*
for ( i = 0; i < 3; i++ )
pit_load_count(pit, i, pit->hw.channels[i].count);
+ out:
spin_unlock(&pit->lock);
- return 0;
+ return rc;
}
HVM_REGISTER_SAVE_RESTORE(PIT, pit_save, pit_load, 1, HVMSR_PER_DOM);
for ( link = 0; link < 4; link++ )
if ( hvm_irq->pci_link.route[link] > 15 )
{
- gdprintk(XENLOG_ERR,
- "HVM restore: PCI-ISA link %u out of range (%u)\n",
- link, hvm_irq->pci_link.route[link]);
+ printk(XENLOG_G_ERR
+ "HVM restore: PCI-ISA link %u out of range (%u)\n",
+ link, hvm_irq->pci_link.route[link]);
return -EINVAL;
}
{
printk(XENLOG_G_ERR "HVM%d restore: bad magic number %#"PRIx32"\n",
d->domain_id, hdr->magic);
- return -1;
+ return -EINVAL;
}
if ( hdr->version != HVM_FILE_VERSION )
{
printk(XENLOG_G_ERR "HVM%d restore: unsupported version %u\n",
d->domain_id, hdr->version);
- return -1;
+ return -EINVAL;
}
cpuid(1, &eax, &ebx, &ecx, &edx);
struct hvm_save_descriptor *desc;
hvm_load_handler handler;
struct vcpu *v;
+ int rc;
if ( d->is_dying )
return -EINVAL;
/* Read the save header, which must be first */
if ( hvm_load_entry(HEADER, h, &hdr) != 0 )
- return -1;
+ return -ENODATA;
- if ( arch_hvm_load(d, &hdr) )
- return -1;
+ rc = arch_hvm_load(d, &hdr);
+ if ( rc )
+ return rc;
/* Down all the vcpus: we only re-enable the ones that had state saved. */
for_each_vcpu(d, v)
printk(XENLOG_G_ERR
"HVM%d restore: save did not end with a null entry\n",
d->domain_id);
- return -1;
+ return -ENODATA;
}
/* Read the typecode of the next entry and check for the end-marker */
{
printk(XENLOG_G_ERR "HVM%d restore: unknown entry typecode %u\n",
d->domain_id, desc->typecode);
- return -1;
+ return -EINVAL;
}
/* Load the entry */
printk(XENLOG_G_INFO "HVM%d restore: %s %"PRIu16"\n", d->domain_id,
hvm_sr_handlers[desc->typecode].name, desc->instance);
- if ( handler(d, h) != 0 )
+ rc = handler(d, h);
+ if ( rc )
{
- printk(XENLOG_G_ERR "HVM%d restore: failed to load entry %u/%u\n",
- d->domain_id, desc->typecode, desc->instance);
- return -1;
+ printk(XENLOG_G_ERR "HVM%d restore: failed to load entry %u/%u rc %d\n",
+ d->domain_id, desc->typecode, desc->instance, rc);
+ return rc;
}
}
d->arch.hvm.nr_vioapics != 1 )
return -EOPNOTSUPP;
- return hvm_load_entry(IOAPIC, h, &s->domU);
+ if ( hvm_load_entry(IOAPIC, h, &s->domU) )
+ return -ENODATA;
+
+ return 0;
}
HVM_REGISTER_SAVE_RESTORE(IOAPIC, ioapic_save, ioapic_load, 1, HVMSR_PER_DOM);