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

Re: [Xen-devel] [PATCH RFC 13/15] libxc: arm64 vcpu initialisation



On Thu, 2013-10-10 at 16:54 +0100, Julien Grall wrote:
> On 10/07/2013 05:39 PM, Ian Campbell wrote:
> > Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > ---
> >  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__

Correct.

> BTW, can you use PSR_GUEST64_INIT here? So if we modified it in Xen, the
> behaviour will also change here.

It's a bit annoying, but PSR_GUEST*_INIT are no in the public interfaces
and libxc can't include anything else. I don't want to expose this to
guests incase it becomes ABI...

Oh, maybe I can just us #if on __XEN_TOOLS__ and/or __XEN__ as
appropaite.

I'll have a play with that.



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