[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC XEN v1 06/14] xen: arm: Add some basic platform info to save header
These correspond to the content of struct xen_arch_domainconfig. On restore various things are checked, mostly to ensure they match the hardcoded things of the restoring Xen. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- xen/arch/arm/save.c | 44 ++++++++++++++++++++++++++++++++++ xen/include/public/arch-arm/hvm/save.h | 6 +++++ 2 files changed, 50 insertions(+) diff --git a/xen/arch/arm/save.c b/xen/arch/arm/save.c index 6a1934b..7b34782 100644 --- a/xen/arch/arm/save.c +++ b/xen/arch/arm/save.c @@ -21,6 +21,17 @@ void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr) { + switch ( d->arch.vgic.version ) + { + case GIC_V2: hdr->gic_version = XEN_DOMCTL_CONFIG_GIC_V2; break; + case GIC_V3: hdr->gic_version = XEN_DOMCTL_CONFIG_GIC_V3; break; + default: BUG(); + } + + hdr->nr_spis = d->arch.vgic.nr_spis; + hdr->clock_frequency = cpu_khz; + + hdr->evtchn_irq = GUEST_EVTCHN_PPI; } int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr) @@ -39,6 +50,39 @@ int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr) return -1; } + switch ( hdr->gic_version ) + { + case XEN_DOMCTL_CONFIG_GIC_V2: d->arch.vgic.version = GIC_V2; break; + case XEN_DOMCTL_CONFIG_GIC_V3: d->arch.vgic.version = GIC_V3; break; + default: + printk(XENLOG_G_ERR "HVM%d restore: unsupported gic version %u\n", + d->domain_id, hdr->gic_version); + return -1; + } + + if ( hdr->nr_spis ) + { + printk(XENLOG_G_ERR "HVM%d restore: cannot support nr_spis != 0, %u\n", + d->domain_id, hdr->nr_spis); + return -1; + } + + if ( hdr->clock_frequency != cpu_khz ) + { + printk(XENLOG_G_ERR + "HVM%d restore: unsupported guest clock %"PRId32"kHz on host @ %ldkHz\n", + d->domain_id, hdr->clock_frequency, cpu_khz); + return -1; + } + + if ( hdr->evtchn_irq != GUEST_EVTCHN_PPI ) + { + printk(XENLOG_G_ERR + "HVM%d restore: unsupported guest evtchn IRQ%u host uses IRQ%u\n", + d->domain_id, hdr->evtchn_irq, GUEST_EVTCHN_PPI); + return -1; + } + return 0; } diff --git a/xen/include/public/arch-arm/hvm/save.h b/xen/include/public/arch-arm/hvm/save.h index 5f4de94..6f1be37 100644 --- a/xen/include/public/arch-arm/hvm/save.h +++ b/xen/include/public/arch-arm/hvm/save.h @@ -34,6 +34,12 @@ struct hvm_save_header uint32_t magic; /* Must be HVM_FILE_MAGIC */ uint32_t version; /* File format version */ uint64_t changeset; /* Version of Xen that saved this file */ + + uint8_t gic_version; /* XEN_DOMCTL_CONFIG_GIC_v* (_NOT_ _NATIVE) */ + uint32_t nr_spis; /* Currently must be 0 */ + uint32_t clock_frequency; /* kHz */ + + uint32_t evtchn_irq; }; DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header); -- 2.6.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |