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

Re: [Xen-devel] [RFC v2 1/6] xen/arm: Save and restore support with hvm context hypercalls



On 05/13/2014 11:37 AM, Julien Grall wrote:
On 05/13/2014 05:18 PM, Wei Huang wrote:
Given the comments from you and Andrew, I will revise the context struct
to the following format. With this, we can get rid of most problems
(switch/case/...).

With this solution, you will duplicate code to save/restore the timer.
The code size will be reduced and looks cleaner? Here is the example:

static int hvm_timer_save(struct domain *d, hvm_domain_context_t *h)
{
    struct hvm_arm_timer ctxt;
    struct vcpu *v;
    int rc = 0;

    /* Save the state of vtimer and ptimer */
    for_each_vcpu( d, v )
    {
        /* save phys_timer */
        ctxt.phys_cval = v->arch.phys_timer.cval;
        ctxt.phys_ctl = v->arch.phys_timer.ctl;
        ctxt.phys_vtb_offset = d->arch.phys_timer_base.offset;

        /* save virt_timer */
        ctxt.virt_cval = v->arch.virt_timer.cval;
        ctxt.virt_ctl = v->arch.virt_timer.ctl;
        ctxt.virt_vtb_offset = d->arch.virt_timer_base.offset;

        if ( (rc = hvm_save_entry(TIMER, v->vcpu_id, h, &ctxt)) != 0 )
            return rc;
    }

    return rc;
}


struct hvm_arm_timer
{
     /* phys_timer */
     uint64_t phys_vtb_offset;
     uint64_t phys_cval;
     uint32_t phys_ctl;

If I'm not mistaken, you need a 32 bit padding here ...


     /* virt_timer */
     uint64_t virt_vtb_offset;
     uint64_t virt_cval;
     uint32_t virt_ctl;

... and here

Regards,



_______________________________________________
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®.