[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC XEN v1 06/14] xen: arm: Add some basic platform info to save header



On Tue, 2015-12-15 at 18:37 +0000, Stefano Stabellini wrote:
> On Wed, 9 Dec 2015, Ian Campbell wrote:
> > 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;
> 
> I would prefer if you added these in the previous patch, or maybe
> better, you introduced HVM_FILE_VERSION only with the last patch.
> Otherwise theoretically you would have to bump HVM_FILE_VERSION with
> this patch.

I'm not terribly concerned with save file versioning in the midst of the
series which implements save/restore, it's ludicrous to suggest we might be
required to support save/restore with this series half applied, but I'll
fold it in anyway.

> The rest looks good.

Thanks.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.