From: Ian Campbell Subject: Re: [RFC PATCH] xen/arm: Add 4-level page table for stage 2 translation Date: Fri, 2 May 2014 17:12:05 +0100 Message-ID: <1399047125.18944.48.camel@kazak.uk.xensource.com> References: <1398860114-10064-1-git-send-email-vijay.kilari@gmail.com> <5360EF08.7090700@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5360EF08.7090700@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: vijay.kilari@gmail.com, stefano.stabellini@eu.citrix.com, Prasun.Kapoor@caviumnetworks.com, vijaya.kumar@caviumnetworks.com, xen-devel@lists.xen.org, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On Wed, 2014-04-30 at 13:39 +0100, Julien Grall wrote: > Hello Vijaya, > > On 04/30/2014 01:15 PM, vijay.kilari@gmail.com wrote: > > diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S > > index d151724..c0e0362 100644 > > --- a/xen/arch/arm/arm64/head.S > > +++ b/xen/arch/arm/arm64/head.S > > @@ -224,13 +224,16 @@ skip_bss: > > ldr x0, =MAIRVAL > > msr mair_el2, x0 > > > > + mrs x1, ID_AA64MMFR0_EL1 > > + > > /* Set up the HTCR: > > - * PASize -- 40 bits / 1TB > > + * PASize -- based on ID_AA64MMFR0_EL1.PARange value > > * Top byte is used > > * PT walks use Outer-Shareable accesses, > > * PT walks are write-back, write-allocate in both cache levels, > > * Full 64-bit address space goes through this table. */ > > - ldr x0, =0x80822500 > > + ldr x0, =TCR_VAL_40PA > > If you define TCR_VAL_40PA in another header, I would also move the > comments explaining the different bits in this header. Yeah, I'm increasingly not sure what was so wrong with this extensively commented number TBH. > > +#ifdef CONFIG_ARM_64 > > +/* Zeroeth level is of 1 page size */ > > +#define P2M_FIRST_ORDER 0 > > From your comment, should not it be P2M_ZEROETH_ORDER? Actually it should be P2M_ROOT_ORDER. > > diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h > > index 905beb8..8477206 100644 > > --- a/xen/include/asm-arm/page.h > > +++ b/xen/include/asm-arm/page.h > > @@ -6,12 +6,13 @@ > > #include > > #include > > > > +#ifdef CONFIG_ARM_64 > > +#define PADDR_BITS 48 > > +#else > > #define PADDR_BITS 40 > > +#endif > > #define PADDR_MASK ((1ULL << PADDR_BITS)-1) > > > > -#define VADDR_BITS 32 > > -#define VADDR_MASK (~0UL) > > - > > Why did you remove VADDR_{BITS,MASK}? These were unused (and wrong on arm64) I think removing them is OK, if a little bit tangential to this patch. > > +/* 40 bit VA to 32 bit PA */ > > Did you mean IPA instead of VA? > > Also, on ARM, the PA is encoded with 40 bits. Do you mean arm32? Ian.