From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Huang Subject: Re: [RFC v2 1/6] xen/arm: Save and restore support with hvm context hypercalls Date: Tue, 13 May 2014 11:44:19 -0500 Message-ID: <53724BE3.2090701@samsung.com> References: <1397595918-30419-1-git-send-email-w1.huang@samsung.com> <1397595918-30419-2-git-send-email-w1.huang@samsung.com> <534FEDFD.7030202@linaro.org> <1399886168.561.95.camel@kazak.uk.xensource.com> <5370B8DD.6000600@linaro.org> <53723ACC.8040402@samsung.com> <53723D48.2050800@linaro.org> <537245D0.2010908@samsung.com> <53724A5D.2040000@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-reply-to: <53724A5D.2040000@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Andrew Cooper , Stefano Stabellini , Ian Campbell , xen-devel List-Id: xen-devel@lists.xenproject.org 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, >