From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH RFC 13/15] libxc: arm64 vcpu initialisation Date: Thu, 10 Oct 2013 16:54:34 +0100 Message-ID: <5256CDBA.5000902@linaro.org> References: <1381163944.21562.129.camel@kazak.uk.xensource.com> <1381164001-1446-13-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1381164001-1446-13-git-send-email-ian.campbell@citrix.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: Ian Campbell Cc: stefano.stabellini@eu.citrix.com, tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 10/07/2013 05:39 PM, Ian Campbell wrote: > Signed-off-by: Ian Campbell > --- > tools/libxc/xc_dom_arm.c | 90 ++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 88 insertions(+), 2 deletions(-) > > diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c > index ecdaea9..a6d2259 100644 > --- a/tools/libxc/xc_dom_arm.c > +++ b/tools/libxc/xc_dom_arm.c > @@ -105,7 +105,7 @@ static int shared_info_arm(struct xc_dom_image *dom, void *ptr) > > /* ------------------------------------------------------------------------ */ > > -static int vcpu_arm(struct xc_dom_image *dom, void *ptr) > +static int vcpu_arm32(struct xc_dom_image *dom, void *ptr) > { > vcpu_guest_context_t *ctxt = ptr; > > @@ -143,6 +143,41 @@ static int vcpu_arm(struct xc_dom_image *dom, void *ptr) > return 0; > } > > +static int vcpu_arm64(struct xc_dom_image *dom, void *ptr) > +{ > + vcpu_guest_context_t *ctxt = ptr; > + > + DOMPRINTF_CALLED(dom->xch); > + /* clear everything */ > + memset(ctxt, 0, sizeof(*ctxt)); > + > + ctxt->user_regs.pc64 = dom->parms.virt_entry; > + > + /* Linux boot protocol. See linux.Documentation/arm/Booting. */ > + ctxt->user_regs.x0 = dom->devicetree_blob ? > + dom->devicetree_seg.vstart : 0xffffffff; > + ctxt->user_regs.x1 = 0; > + ctxt->user_regs.x2 = 0; > + ctxt->user_regs.x3 = 0; > + > + DOMPRINTF("DTB %"PRIx64, ctxt->user_regs.x0); > + > + ctxt->sctlr = /* #define SCTLR_BASE */0x00c50078; > + > + ctxt->ttbr0 = 0; > + ctxt->ttbr1 = 0; > + ctxt->ttbcr = 0; /* Defined Reset Value */ > + > + ctxt->user_regs.cpsr = PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_EL1h; PSR_MODE_EL1h is only defined on arm64. I think you will need to prefix all the code by #ifdef __aarch64__ BTW, can you use PSR_GUEST64_INIT here? So if we modified it in Xen, the behaviour will also change here. -- Julien Grall