40x large page PTEs - Mark IV
This version of the patch fixes a few compilation problems in the last version when CONFIG_NOT_COHERENT_CACHE was not set. I'm running it now on my TiBook, and it works nicely on the 405GP machine.
iff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/config.in linux-grinch-largepage/arch/ppc/config.in
arch/ppc/config.in renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/config.in +0 -3
@@ -357,9 +357,6 @@ if [ "$CONFIG_8xx" = "y" ]; then bool "Pinned Kernel TLBs (860 ONLY)" CONFIG_PIN_TLB fi - if [ "$CONFIG_40x" = "y" ]; then - bool "Pinned Kernel TLBs" CONFIG_PIN_TLB - fi fi if [ "$CONFIG_ALL_PPC" = "y" ]; then
arch/ppc/kernel/head_4xx.S renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/head_4xx.S +50 -42
160 lines not on this page · raw message
arch/ppc/kernel/misc.S renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/misc.S +4 -14
@@ -354,18 +354,8 @@ * Flush MMU TLB */ _GLOBAL(_tlbia) -#if defined(CONFIG_40x) && defined(CONFIG_PIN_TLB) - /* This needs to be coordinated with other pinning functions since - * we don't keep a memory location of number of entries to reduce - * cache pollution during these operations. - */ - lis r3, 0 - sync -1: - tlbwe r3, r3, TLB_TAG /* just ensure V is clear */ - addi r3, r3, 1 /* so r3 works fine for that */ - cmpwi 0, r3, 61 /* reserve last two entries */ - ble 1b +#if defined(CONFIG_40x) + tlbia isync #elif defined(CONFIG_440) lis r3,0
@@ -376,7 +366,7 @@ cmpwi 0,r3,61 ble 1b isync -#else +#else /* !defined(CONFIG_40x) && !defined(CONFIG_440) */ #if defined(CONFIG_SMP) mfmsr r10 SYNC
@@ -410,7 +400,7 @@ #else /* CONFIG_SMP */ sync #endif /* CONFIG_SMP */ -#endif /* defined(CONFIG_40x) && defined(CONFIG_PIN_TLB) */ +#endif /* ! defined(CONFIG_40x) && ! defined(CONFIG_440) */ blr /*
arch/ppc/mm/4xx_mmu.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/mm/4xx_mmu.c +47 -0
57 lines not on this page · raw message
arch/ppc/mm/pgtable.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/mm/pgtable.c +27 -6
@@ -75,6 +75,12 @@#define p_mapped_by_bats (x) (0UL)#endif /* HAVE_BATS */ +#if (_PMD_SIZE ==0 )/* No large page PMD support */ +#define largepte_mapin_ram () 0UL +#else +extern unsigned long largepte_mapin_ram (void ); +#endif +#ifndef CONFIG_PPC_ISERIES #ifndef CONFIG_440 void *
@@ -346,9 +352,12 @@bat_mapin_ram (__bat2, __bat3);#endif /* HAVE_BATS */ - v =KERNELBASE ; - p =PPC_MEMSTART ; -for (s =0 ; s < total_lowmem; s +=PAGE_SIZE ) { + s =largepte_mapin_ram (); + + v =KERNELBASE + s; + p =PPC_MEMSTART + s; + +for (; s < total_lowmem; s +=PAGE_SIZE ) {/* On the MPC8xx, we want the page shared so we * don't get ASID compares on kernel space. */
@@ -451,6 +460,8 @@* tables.......I am actively working on resolving this, but * can't hold up other stuff. -- Dan */ +pgd_t *pgd; +pmd_t *pmd;pte_t *pte;struct mm_struct *mm;
@@ -468,10 +479,20 @@ mm = &init_mm; pa =0 ; -if (get_pteptr (mm, addr, &pte)) - pa = (pte_val (*pte) &PAGE_MASK ) | (addr & ~PAGE_MASK ); + pgd =pgd_offset (mm, addr); +if (pgd) { + pmd =pmd_offset (pgd, addr); +if (pmd_present (*pmd)) { + pte =pte_offset (pmd, addr); + pa = (pte_val (*pte) &PAGE_MASK ) | (addr & ~PAGE_MASK ); + }else if (pmd_largepage (*pmd)) { +unsigned long mask =pmd_largepagemask (*pmd); + + pa = (pmd_val (*pmd) & mask) | (addr & ~mask); + } + } -return (pa); +return pa; }/* This is will find the virtual address for a physical one....
include/asm-ppc/pgtable.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/include/asm-ppc/pgtable.h +18 -10
@@ -18,15 +18,7 @@extern void _tlbia (void );#ifdef CONFIG_4xx -#ifdef CONFIG_PIN_TLB -/* When pinning entries on the 4xx, we have to use a software function -* to ensure we don't remove them since there isn't any hardware support -* for this. -*/ -#define __tlbia () _tlbia() -#else #define __tlbia () asm volatile ("tlbia; sync" : : : "memory") -#endif static inline void local_flush_tlb_all (void ) {__tlbia (); }
@@ -296,7 +288,12 @@#define _PAGE_HWWRITE 0x100/* hardware: Dirty & RW, set in exception */ #define _PAGE_HWEXEC 0x200/* hardware: EX permission */ #define _PAGE_ACCESSED 0x400/* software: R: page referenced */ -#define _PMD_PRESENT PAGE_MASK + +#define _PMD_PRESENT 0x400/* PMD points to page of PTEs */ +#define _PMD_SIZE 0x0e0/* size field, != 0 for large-page PMD entry */ +#define _PMD_SIZE_4M 0x0c0 +#define _PMD_SIZE_16M 0x0e0 +#define PMD_PAGE_SIZE (pmdval) (1024 << (((pmdval) & _PMD_SIZE) >> 4))#elif defined(CONFIG_440 )
@@ -398,6 +395,10 @@#ifndef _PAGE_EXEC#define _PAGE_EXEC 0#endif +#ifndef _PMD_SIZE +#define _PMD_SIZE 0 +#define PMD_PAGE_SIZE (pmd) bad_call_to_PMD_PAGE_SIZE() +#endif #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
@@ -455,6 +456,10 @@#define __S111 PAGE_SHARED_X#ifndef __ASSEMBLY__ +/* Make sure we get a link error if PMD_PAGE_SIZE is ever called on a +* kernel without large page PMD support */ +extern unsigned long bad_call_to_PMD_PAGE_SIZE (void ); +/* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc..
@@ -469,9 +474,12 @@#define pte_clear (ptep) do { set_pte((ptep), __pte(0)); } while (0)#define pmd_none (pmd) (!pmd_val(pmd)) -#define pmd_bad (pmd) ((pmd_val(pmd) & _PMD_PRESENT) == 0) +#define pmd_bad (pmd) ( ((pmd_val(pmd) & _PMD_PRESENT) == 0) && \ + ((pmd_val(pmd) & _PMD_SIZE) == 0) )#define pmd_present (pmd) ((pmd_val(pmd) & _PMD_PRESENT) != 0)#define pmd_clear (pmdp) do { pmd_val(*(pmdp)) = 0; } while (0) +#define pmd_largepage (pmd) ((pmd_val(pmd) & _PMD_SIZE) != 0) +#define pmd_largepagemask (pmd) (~(PMD_PAGE_SIZE(pmd_val(pmd)) - 1))#define pte_page (x) (mem_map+(unsigned long)((pte_val(x)-PPC_MEMSTART) >> PAGE_SHIFT))
--
David Gibson | For every complex problem there is a
[email protected] | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 4 lines · David Gibson
This version of the patch fixes a few compilation problems in the last version when
CONFIG_NOT_COHERENT_CACHEwas not set. I'm running it now on my TiBook, and it works nicely on the 405GP machine.
Ok, deathly silence. Anyone who would object to this patch being pushed (to 2_4_devel) please raise their hands...
--
David Gibson | For every complex problem there is a
[email protected] | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 9 lines · David Gibson
Quoted 4 lines · David Gibson
This version of the patch fixes a few compilation problems in the last version when
CONFIG_NOT_COHERENT_CACHEwas not set. I'm running it now on my TiBook, and it works nicely on the 405GP machine.Ok, deathly silence. Anyone who would object to this patch being pushed (to 2_4_devel) please raise their hands...
Well, how about 2.5 first? :)
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 5 lines · Tom Rini
Quoted 3 lines · David Gibson
Quoted 1 line · David Gibson
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
This version of the patch fixes a few compilation problems in the last version when
CONFIG_NOT_COHERENT_CACHEwas not set. I'm running it now on my TiBook, and it works nicely on the 405GP machine.Ok, deathly silence. Anyone who would object to this patch being pushed (to 2_4_devel) please raise their hands...
Well, how about 2.5 first? :)
Ok... I agree that we should be doing more experimentation in 2.5. In 2.5 I'm waiting on paulus to apply (or reject) a couple of preliminary cleanups to mapin_ram() and friends.
--
David Gibson | For every complex problem there is a
[email protected] | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/