From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from midgard.sc.steeleye.com (midgard.sc.steeleye.com [172.17.6.40]) by hancock.sc.steeleye.com (8.11.6/linuxconf) with ESMTP id i43KpAa02485; Mon, 3 May 2004 16:51:10 -0400 From: James Bottomley To: PARISC list In-Reply-To: <20040502161601.DC7C24945C7@palinux.hppa> References: <20040502161601.DC7C24945C7@palinux.hppa> Content-Type: text/plain Date: 03 May 2004 15:51:09 -0500 Message-Id: <1083617469.2417.10.camel@mulgrave> Mime-Version: 1.0 Cc: parisc-linux-cvs@lists.parisc-linux.org Subject: [parisc-linux] Re: [parisc-linux-cvs] linux-2.6 jejb List-Id: parisc-linux developers list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sun, 2004-05-02 at 11:16, James Bottomley wrote: > CVSROOT: /var/cvs > Module name: linux-2.6 > Changes by: jejb 04/05/02 10:16:01 > > Modified files: > . : Makefile > arch/parisc/kernel: asm-offsets.c entry.S init_task.c > include/asm-parisc: pgalloc.h pgtable.h > > Log message: > Implement L2/L3 hybrid page tables for 64 bit kernels Index: arch/parisc/kernel/asm-offsets.c =================================================================== RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/asm-offsets.c,v retrieving revision 1.7 diff -u -r1.7 asm-offsets.c --- a/arch/parisc/kernel/asm-offsets.c 1 May 2004 20:03:11 -0000 1.7 +++ b/arch/parisc/kernel/asm-offsets.c 2 May 2004 15:53:49 -0000 @@ -282,6 +282,7 @@ DEFINE(ASM_BITS_PER_PGD, BITS_PER_PGD); DEFINE(ASM_BITS_PER_PMD, BITS_PER_PMD); DEFINE(ASM_BITS_PER_PTE, BITS_PER_PTE); + DEFINE(ASM_PGD_PMD_OFFSET, -(PAGE_SIZE << PGD_ORDER)); DEFINE(ASM_PMD_ENTRY, ((PAGE_OFFSET & PMD_MASK) >> PMD_SHIFT)); DEFINE(ASM_PGD_ENTRY, PAGE_OFFSET >> PGDIR_SHIFT); DEFINE(ASM_PGD_ENTRY_SIZE, PGD_ENTRY_SIZE); Index: arch/parisc/kernel/entry.S =================================================================== RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/entry.S,v retrieving revision 1.13 diff -u -r1.13 entry.S --- a/arch/parisc/kernel/entry.S 1 May 2004 20:03:11 -0000 1.13 +++ b/arch/parisc/kernel/entry.S 2 May 2004 15:53:51 -0000 @@ -474,11 +474,24 @@ bb,>=,n \pte,_PAGE_PRESENT_BIT,\fault .endm - /* Look up PTE in a 3-Level scheme */ + /* Look up PTE in a 3-Level scheme. + * + * Here we implement a Hybrid L2/L3 scheme: we allocate the + * first pmd adjacent to the pgd. This means that we can + * subtract a constant offset to get to it. The pmd and pgd + * sizes are arranged so that a single pmd covers 4GB (giving + * a full LP64 process access to 8TB) so our lookups are + * effectively L2 for the first 4GB of the kernel (i.e. for + * all ILP32 processes and all the kernel for machines with + * under 4GB of memory) */ .macro L3_ptep pgd,pte,index,va,fault extrd,u \va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index copy %r0,\pte + extrd,u,*= \va,31,32,%r0 ldw,s \index(\pgd),\pgd + extrd,u,*<> \va,31,32,%r0 + ldo ASM_PGD_PMD_OFFSET(\pgd),\pgd + extrd,u,*= \va,31,32,%r0 bb,>=,n \pgd,_PAGE_PRESENT_BIT,\fault L2_ptep \pgd,\pte,\index,\va,\fault .endm Index: arch/parisc/kernel/init_task.c =================================================================== RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/init_task.c,v retrieving revision 1.5 diff -u -r1.5 init_task.c --- a/arch/parisc/kernel/init_task.c 1 May 2004 16:05:55 -0000 1.5 +++ b/arch/parisc/kernel/init_task.c 2 May 2004 15:53:51 -0000 @@ -52,11 +52,13 @@ __attribute__((aligned(128))) __attribute__((__section__(".data.init_task"))) = { INIT_THREAD_INFO(init_task) }; -pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((aligned(PAGE_SIZE< #include +/* Allocate the top level pgd (page directory) + * + * Here (for 64 bit kernels) we implement a Hybrid L2/L3 scheme: we + * allocate the first pmd adjacent to the pgd. This means that we can + * subtract a constant offset to get to it. The pmd and pgd sizes are + * arranged so that a single pmd covers 4GB (giving a full LP64 + * process access to 8TB) so our lookups are effectively L2 for the + * first 4GB of the kernel (i.e. for all ILP32 processes and all the + * kernel for machines with under 4GB of memory) */ static inline pgd_t *pgd_alloc(struct mm_struct *mm) { - pgd_t *pgd = (pgd_t *)__get_free_pages(GFP_KERNEL, PGD_ORDER); - - if (likely(pgd != NULL)) - memset(pgd, 0, PAGE_SIZE<