diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-06-11 01:37:10 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-30 08:30:53 -0400 |
commit | 41743a4e34f0777f51c1cf0675b91508ba143050 (patch) | |
tree | 9e63c8c8d70169e6c8be699167234db33b102a1f /arch/powerpc/mm | |
parent | ff1f4ee94c3c4480b9cee95da2d19668262636c6 (diff) |
powerpc: Free a PTE bit on ppc64 with 64K pages
This frees a PTE bit when using 64K pages on ppc64. This is done
by getting rid of the separate _PAGE_HASHPTE bit. Instead, we just test
if any of the 16 sub-page bits is set. For non-combo pages (ie. real
64K pages), we set SUB0 and the location encoding in that field.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/hash_low_64.S | 17 | ||||
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 8 |
2 files changed, 15 insertions, 10 deletions
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S index 70f4c833fa32..a719f53921a5 100644 --- a/arch/powerpc/mm/hash_low_64.S +++ b/arch/powerpc/mm/hash_low_64.S | |||
@@ -388,7 +388,7 @@ _GLOBAL(__hash_page_4K) | |||
388 | */ | 388 | */ |
389 | rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */ | 389 | rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */ |
390 | or r30,r30,r31 | 390 | or r30,r30,r31 |
391 | ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED | _PAGE_HASHPTE | 391 | ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED |
392 | oris r30,r30,_PAGE_COMBO@h | 392 | oris r30,r30,_PAGE_COMBO@h |
393 | /* Write the linux PTE atomically (setting busy) */ | 393 | /* Write the linux PTE atomically (setting busy) */ |
394 | stdcx. r30,0,r6 | 394 | stdcx. r30,0,r6 |
@@ -468,7 +468,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE) | |||
468 | * go to out-of-line code to try to modify the HPTE. We look for | 468 | * go to out-of-line code to try to modify the HPTE. We look for |
469 | * the bit at (1 >> (index + 32)) | 469 | * the bit at (1 >> (index + 32)) |
470 | */ | 470 | */ |
471 | andi. r0,r31,_PAGE_HASHPTE | 471 | rldicl. r0,r31,64-12,48 |
472 | li r26,0 /* Default hidx */ | 472 | li r26,0 /* Default hidx */ |
473 | beq htab_insert_pte | 473 | beq htab_insert_pte |
474 | 474 | ||
@@ -726,11 +726,11 @@ BEGIN_FTR_SECTION | |||
726 | bne- ht64_bail_ok | 726 | bne- ht64_bail_ok |
727 | END_FTR_SECTION_IFCLR(CPU_FTR_CI_LARGE_PAGE) | 727 | END_FTR_SECTION_IFCLR(CPU_FTR_CI_LARGE_PAGE) |
728 | /* Prepare new PTE value (turn access RW into DIRTY, then | 728 | /* Prepare new PTE value (turn access RW into DIRTY, then |
729 | * add BUSY,HASHPTE and ACCESSED) | 729 | * add BUSY and ACCESSED) |
730 | */ | 730 | */ |
731 | rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */ | 731 | rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */ |
732 | or r30,r30,r31 | 732 | or r30,r30,r31 |
733 | ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED | _PAGE_HASHPTE | 733 | ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED |
734 | /* Write the linux PTE atomically (setting busy) */ | 734 | /* Write the linux PTE atomically (setting busy) */ |
735 | stdcx. r30,0,r6 | 735 | stdcx. r30,0,r6 |
736 | bne- 1b | 736 | bne- 1b |
@@ -798,18 +798,21 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE) | |||
798 | /* Check if we may already be in the hashtable, in this case, we | 798 | /* Check if we may already be in the hashtable, in this case, we |
799 | * go to out-of-line code to try to modify the HPTE | 799 | * go to out-of-line code to try to modify the HPTE |
800 | */ | 800 | */ |
801 | andi. r0,r31,_PAGE_HASHPTE | 801 | rldicl. r0,r31,64-12,48 |
802 | bne ht64_modify_pte | 802 | bne ht64_modify_pte |
803 | 803 | ||
804 | ht64_insert_pte: | 804 | ht64_insert_pte: |
805 | /* Clear hpte bits in new pte (we also clear BUSY btw) and | 805 | /* Clear hpte bits in new pte (we also clear BUSY btw) and |
806 | * add _PAGE_HASHPTE | 806 | * add _PAGE_HPTE_SUB0 |
807 | */ | 807 | */ |
808 | lis r0,_PAGE_HPTEFLAGS@h | 808 | lis r0,_PAGE_HPTEFLAGS@h |
809 | ori r0,r0,_PAGE_HPTEFLAGS@l | 809 | ori r0,r0,_PAGE_HPTEFLAGS@l |
810 | andc r30,r30,r0 | 810 | andc r30,r30,r0 |
811 | #ifdef CONFIG_PPC_64K_PAGES | ||
812 | oris r30,r30,_PAGE_HPTE_SUB0@h | ||
813 | #else | ||
811 | ori r30,r30,_PAGE_HASHPTE | 814 | ori r30,r30,_PAGE_HASHPTE |
812 | 815 | #endif | |
813 | /* Phyical address in r5 */ | 816 | /* Phyical address in r5 */ |
814 | rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT | 817 | rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT |
815 | sldi r5,r5,PAGE_SHIFT | 818 | sldi r5,r5,PAGE_SHIFT |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index a02266dad215..8fa07f3f6c2b 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -458,8 +458,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access, | |||
458 | old_pte = pte_val(*ptep); | 458 | old_pte = pte_val(*ptep); |
459 | if (old_pte & _PAGE_BUSY) | 459 | if (old_pte & _PAGE_BUSY) |
460 | goto out; | 460 | goto out; |
461 | new_pte = old_pte | _PAGE_BUSY | | 461 | new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED; |
462 | _PAGE_ACCESSED | _PAGE_HASHPTE; | ||
463 | } while(old_pte != __cmpxchg_u64((unsigned long *)ptep, | 462 | } while(old_pte != __cmpxchg_u64((unsigned long *)ptep, |
464 | old_pte, new_pte)); | 463 | old_pte, new_pte)); |
465 | 464 | ||
@@ -499,8 +498,11 @@ repeat: | |||
499 | HPTES_PER_GROUP) & ~0x7UL; | 498 | HPTES_PER_GROUP) & ~0x7UL; |
500 | 499 | ||
501 | /* clear HPTE slot informations in new PTE */ | 500 | /* clear HPTE slot informations in new PTE */ |
501 | #ifdef CONFIG_PPC_64K_PAGES | ||
502 | new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0; | ||
503 | #else | ||
502 | new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE; | 504 | new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE; |
503 | 505 | #endif | |
504 | /* Add in WIMG bits */ | 506 | /* Add in WIMG bits */ |
505 | /* XXX We should store these in the pte */ | 507 | /* XXX We should store these in the pte */ |
506 | /* --BenH: I think they are ... */ | 508 | /* --BenH: I think they are ... */ |