From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [RFC v2 1/6] xen/arm: Save and restore support with hvm context hypercalls Date: Tue, 13 May 2014 18:33:55 +0100 Message-ID: <53725783.4060806@linaro.org> 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> <53724BE3.2090701@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53724BE3.2090701@samsung.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Huang Cc: Andrew Cooper , Stefano Stabellini , Ian Campbell , xen-devel List-Id: xen-devel@lists.xenproject.org On 05/13/2014 05:44 PM, Wei Huang wrote: > 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: LGTM except ... > 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; I think you need to store d->arch.virt_timer_base.offset in ns rather than ticks. Regards, -- Julien Grall