From: Julien Grall <julien.grall@linaro.org>
To: Wei Huang <w1.huang@samsung.com>
Cc: stefano.stabellini@eu.citrix.com, yjhyun.yoo@samsung.com,
ian.campbell@citrix.com, jaeyong.yoo@samsung.com,
xen-devel@lists.xen.org
Subject: Re: [PATCH 1/6] xen/arm: Save and restore support for hvm context hypercall
Date: Fri, 11 Apr 2014 14:57:44 +0100 [thread overview]
Message-ID: <5347F4D8.3080904@linaro.org> (raw)
In-Reply-To: <1397148539-19084-2-git-send-email-w1.huang@samsung.com>
Hi Wei,
Thank you for the patch.
On 04/10/2014 05:48 PM, Wei Huang wrote:
[..]
> case XEN_DOMCTL_cacheflush:
> {
> unsigned long s = domctl->u.cacheflush.start_pfn;
> unsigned long e = s + domctl->u.cacheflush.nr_pfns;
>
> if ( domctl->u.cacheflush.nr_pfns > (1U<<MAX_ORDER) )
> - return -EINVAL;
> + ret = -EINVAL;
>
> if ( e < s )
> - return -EINVAL;
> + ret = -EINVAL;
>
> - return p2m_cache_flush(d, s, e);
> + ret = p2m_cache_flush(d, s, e);
> }
Your change in XEN_DOMCTL_cacheflush is wrong. The code should not
continue if the sanity check has failed.
> void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
> diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
> index 471c4cd..bfe38f4 100644
> --- a/xen/arch/arm/hvm.c
> +++ b/xen/arch/arm/hvm.c
> @@ -7,14 +7,15 @@
>
> #include <xsm/xsm.h>
>
> +#include <xen/hvm/save.h>
> #include <public/xen.h>
> #include <public/hvm/params.h>
> #include <public/hvm/hvm_op.h>
>
> #include <asm/hypercall.h>
> +#include <asm/gic.h>
>
> long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
> -
> {
> long rc = 0;
>
> @@ -65,3 +66,505 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
>
> return rc;
> }
> +
> +static int vgic_irq_rank_save(struct vcpu *v,
> + struct vgic_rank *ext,
> + struct vgic_irq_rank *rank)
I would prefer if you move all theses functions of this file in each
specific file (timer in time.c, vgic in vgic.c,...).
It would be easier when GICv3 and new stuff will be supported.
> +{
> + spin_lock(&rank->lock);
> +
> + /* Some of VGIC registers are not used yet, it is for a future usage */
> + /* IENABLE, IACTIVE, IPEND, PENDSGI registers */
> + ext->ienable = rank->ienable;
> + ext->iactive = rank->iactive;
> + ext->ipend = rank->ipend;
> + ext->pendsgi = rank->pendsgi;
> +
> + /* ICFG */
> + ext->icfg[0] = rank->icfg[0];
> + ext->icfg[1] = rank->icfg[1];
> +
> + /* IPRIORITY */
> + if ( sizeof(rank->ipriority) != sizeof (ext->ipriority) )
> + {
> + dprintk(XENLOG_G_ERR, "hvm_hw_gic: check ipriority dumping space\n");
> + return -EINVAL;
> + }
You don't need to check it at runtime. BUILG_BUG_ON is enough here.
> + memcpy(ext->ipriority, rank->ipriority, sizeof(rank->ipriority));
> +
> + /* ITARGETS */
> + if ( sizeof(rank->itargets) != sizeof (ext->itargets) )
> + {
> + dprintk(XENLOG_G_ERR, "hvm_hw_gic: check itargets dumping space\n");
> + return -EINVAL;
> + }
Same here. And actually everywhere you have the pattern "if (sizeof(a)
op sizeof (b))" in this file.
[..]
> +HVM_REGISTER_SAVE_RESTORE(A15_TIMER, timer_save, timer_load, 2, HVMSR_PER_VCPU);
The timer structure is not A15 specific. Can you rename it in timer?
[..]
> +void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
> +{
> + hdr->cpuid = READ_SYSREG32(MIDR_EL1);
You can directly use current_cpu_data.midr.bits;
> +}
> +
> +int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
> +{
> + uint32_t cpuid;
> +
> + if ( hdr->magic != HVM_FILE_MAGIC )
> + {
> + printk(XENLOG_G_ERR "HVM%d restore: bad magic number %#"PRIx32"\n",
> + d->domain_id, hdr->magic);
> + return -1;
> + }
> +
> + if ( hdr->version != HVM_FILE_VERSION )
> + {
> + printk(XENLOG_G_ERR "HVM%d restore: unsupported version %u\n",
> + d->domain_id, hdr->version);
> + return -1;
> + }
> +
> + cpuid = READ_SYSREG32(MIDR_EL1);
Same here.
> + if ( hdr->cpuid != cpuid )
> + {
> + printk(XENLOG_G_INFO "HVM%d restore: VM saved on one CPU "
> + "(%#"PRIx32") and restored on another (%#"PRIx32").\n",
> + d->domain_id, hdr->cpuid, cpuid);
> + return -1;
> + }
> +
> + return 0;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * tab-width: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/common/Makefile b/xen/common/Makefile
> index 3683ae3..714a3c4 100644
> --- a/xen/common/Makefile
> +++ b/xen/common/Makefile
> @@ -64,6 +64,8 @@ subdir-$(CONFIG_COMPAT) += compat
>
> subdir-$(x86_64) += hvm
>
> +subdir-$(CONFIG_ARM) += hvm
> +
I think you can directly merge with the line above and use:
subdir-y += hvm
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-04-11 13:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 16:48 [PATCH 0/6] xen/arm: Xen save/restore/live migration support Wei Huang
2014-04-10 16:48 ` [PATCH 1/6] xen/arm: Save and restore support for hvm context hypercall Wei Huang
2014-04-10 17:26 ` Andrew Cooper
2014-04-10 21:53 ` Wei Huang
2014-04-11 13:57 ` Julien Grall [this message]
2014-04-10 16:48 ` [PATCH 2/6] xen/arm: implement get_maximum_gpfn hypercall Wei Huang
2014-04-10 17:28 ` Andrew Cooper
2014-04-10 21:54 ` Wei Huang
2014-04-11 13:17 ` Julien Grall
2014-04-11 13:15 ` Julien Grall
2014-04-10 16:48 ` [PATCH 3/6] xen/arm: Implement do_suspend function Wei Huang
2014-04-11 14:10 ` Julien Grall
2014-04-10 16:48 ` [PATCH 4/6] xen/arm: Implement VLPT for guest p2m mapping in live migration Wei Huang
2014-04-10 16:48 ` [PATCH 5/6] xen/arm: Implement hypercall for dirty page tracing Wei Huang
2014-04-10 16:48 ` [PATCH 6/6] xen/arm: Implement toolstack for xl restore/save and migrate Wei Huang
2014-04-11 14:15 ` [PATCH 0/6] xen/arm: Xen save/restore/live migration support Julien Grall
2014-04-11 14:22 ` Wei Huang
2014-04-11 14:33 ` Julien Grall
2014-04-11 15:36 ` Wei Huang
2014-04-11 15:53 ` Julien Grall
2014-04-11 16:15 ` Wei Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5347F4D8.3080904@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=jaeyong.yoo@samsung.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=w1.huang@samsung.com \
--cc=xen-devel@lists.xen.org \
--cc=yjhyun.yoo@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.