From: Ian Campbell Subject: Re: [PATCH v2 02/10] xen: arm: Add zeroeth level page table macros and defines Date: Thu, 8 Aug 2013 11:12:47 +0100 Message-ID: <1375956767.970.31.camel@kazak.uk.xensource.com> References: <1375882277.619.55.camel@kazak.uk.xensource.com> <1375882299-31035-2-git-send-email-ian.campbell@citrix.com> <20130808100907.GC68503@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130808100907.GC68503@ocelot.phlegethon.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: Tim Deegan Cc: julien.grall@citrix.com, stefano.stabellini@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2013-08-08 at 11:09 +0100, Tim Deegan wrote: > At 14:31 +0100 on 07 Aug (1375885891), Ian Campbell wrote: > > --- a/xen/include/asm-arm/page.h > > +++ b/xen/include/asm-arm/page.h > > @@ -337,7 +337,15 @@ static inline int gva_to_ipa(vaddr_t va, paddr_t *paddr) > > #define second_table_offset(va) TABLE_OFFSET(second_linear_offset(va)) > > #define third_table_offset(va) TABLE_OFFSET(third_linear_offset(va)) > > > > -#define clear_page(page)memset((void *)(page), 0, PAGE_SIZE) > > +#ifdef CONFIG_ARM_64 > > +#define ZEROETH_SHIFT (FIRST_SHIFT + LPAE_SHIFT) > > +#define ZEROETH_SIZE (1u << ZEROETH_SHIFT) > > +#define ZEROETH_MASK (~(ZEROETH_SIZE - 1)) > > +#define zeroeth_linear_offset(va) ((va) >> ZEROETH_SHIFT) > > +#define zeroeth_table_offset(va) TABLE_OFFSET(zeroeth_linear_offset(va)) > > +#endif > > I'd prefer to see these defined alongside the other levels. There's no > harm in defining them on 32-bit builds. My worry was that they would get used on 32-bit code paths by mistake, which is a build error with this version but a (possibly obscure) runtime error with the alternative. > Also, please update the comment above LPAE_SHIFT to describe the 4-level alternative. Will do.