From: Ian Campbell Subject: Re: [PATCH 05/10] xen: arm: define a macro to get this CPUs page table root Date: Tue, 25 Jun 2013 11:49:50 +0100 Message-ID: <1372157390.22783.224.camel@zakaz.uk.xensource.com> References: <1371562002.22783.25.camel@zakaz.uk.xensource.com> <1371562017-5379-5-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: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: julien.grall@citrix.com, tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2013-06-20 at 17:30 +0100, Stefano Stabellini wrote: > On Tue, 18 Jun 2013, Ian Campbell wrote: > > Signed-off-by: Ian Campbell > > Honestly I don't see this as a great improvement In a later patch the 32 and 64 bit versions will start to differ, because 64-bit page tables are no longer per-PCPU. I suppose I could retain the per-cpu var and just initialise it the same on all processors, seems a bit unnecessary though. > > > > xen/arch/arm/mm.c | 5 +++-- > > 1 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > > index 0698c75..773fbf6 100644 > > --- a/xen/arch/arm/mm.c > > +++ b/xen/arch/arm/mm.c > > @@ -60,6 +60,7 @@ lpae_t boot_first[LPAE_ENTRIES] __attribute__((__aligned__(4096))); > > /* Per-CPU pagetable pages */ > > /* xen_pgtable == root of the trie (zeroeth level on 64-bit, first on 32-bit) */ > > static DEFINE_PER_CPU(lpae_t *, xen_pgtable); > > +#define THIS_CPU_PGTABLE this_cpu(xen_pgtable) > > /* xen_dommap == pages used by map_domain_page, these pages contain > > * the second level pagetables which mapp the domheap region > > * DOMHEAP_VIRT_START...DOMHEAP_VIRT_END in 2MB chunks. */ > > @@ -147,7 +148,7 @@ done: > > void dump_hyp_walk(vaddr_t addr) > > { > > uint64_t ttbr = READ_SYSREG64(TTBR0_EL2); > > - lpae_t *pgtable = this_cpu(xen_pgtable); > > + lpae_t *pgtable = THIS_CPU_PGTABLE; > > > > printk("Walking Hypervisor VA 0x%"PRIvaddr" " > > "on CPU%d via TTBR 0x%016"PRIx64"\n", > > @@ -502,7 +503,7 @@ void __cpuinit mmu_init_secondary_cpu(void) > > uint64_t ttbr; > > > > /* Change to this CPU's pagetables */ > > - ttbr = (uintptr_t)virt_to_maddr(this_cpu(xen_pgtable)); > > + ttbr = (uintptr_t)virt_to_maddr(THIS_CPU_PGTABLE); > > WRITE_TTBR(ttbr); > > > > /* From now on, no mapping may be both writable and executable. */ > > -- > > 1.7.2.5 > >