diff options
author | Paul Mackerras <paulus@samba.org> | 2007-10-11 06:37:10 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-10-12 00:05:17 -0400 |
commit | 1189be6508d45183013ddb82b18f4934193de274 (patch) | |
tree | 58924481b4de56699e4a884dce8dc601e71cf7d1 /arch/powerpc/mm/hugetlbpage.c | |
parent | 287e5d6fcccfa38b953cebe307e1ddfd32363355 (diff) |
[POWERPC] Use 1TB segments
This makes the kernel use 1TB segments for all kernel mappings and for
user addresses of 1TB and above, on machines which support them
(currently POWER5+, POWER6 and PA6T).
We detect that the machine supports 1TB segments by looking at the
ibm,processor-segment-sizes property in the device tree.
We don't currently use 1TB segments for user addresses < 1T, since
that would effectively prevent 32-bit processes from using huge pages
unless we also had a way to revert to using 256MB segments. That
would be possible but would involve extra complications (such as
keeping track of which segment size was used when HPTEs were inserted)
and is not addressed here.
Parts of this patch were originally written by Ben Herrenschmidt.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm/hugetlbpage.c')
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index ba5f12a60467..08f0d9ff7712 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -403,11 +403,12 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access, | |||
403 | unsigned long va, rflags, pa; | 403 | unsigned long va, rflags, pa; |
404 | long slot; | 404 | long slot; |
405 | int err = 1; | 405 | int err = 1; |
406 | int ssize = user_segment_size(ea); | ||
406 | 407 | ||
407 | ptep = huge_pte_offset(mm, ea); | 408 | ptep = huge_pte_offset(mm, ea); |
408 | 409 | ||
409 | /* Search the Linux page table for a match with va */ | 410 | /* Search the Linux page table for a match with va */ |
410 | va = (vsid << 28) | (ea & 0x0fffffff); | 411 | va = hpt_va(ea, vsid, ssize); |
411 | 412 | ||
412 | /* | 413 | /* |
413 | * If no pte found or not present, send the problem up to | 414 | * If no pte found or not present, send the problem up to |
@@ -458,19 +459,19 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access, | |||
458 | /* There MIGHT be an HPTE for this pte */ | 459 | /* There MIGHT be an HPTE for this pte */ |
459 | unsigned long hash, slot; | 460 | unsigned long hash, slot; |
460 | 461 | ||
461 | hash = hpt_hash(va, HPAGE_SHIFT); | 462 | hash = hpt_hash(va, HPAGE_SHIFT, ssize); |
462 | if (old_pte & _PAGE_F_SECOND) | 463 | if (old_pte & _PAGE_F_SECOND) |
463 | hash = ~hash; | 464 | hash = ~hash; |
464 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; | 465 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; |
465 | slot += (old_pte & _PAGE_F_GIX) >> 12; | 466 | slot += (old_pte & _PAGE_F_GIX) >> 12; |
466 | 467 | ||
467 | if (ppc_md.hpte_updatepp(slot, rflags, va, mmu_huge_psize, | 468 | if (ppc_md.hpte_updatepp(slot, rflags, va, mmu_huge_psize, |
468 | local) == -1) | 469 | ssize, local) == -1) |
469 | old_pte &= ~_PAGE_HPTEFLAGS; | 470 | old_pte &= ~_PAGE_HPTEFLAGS; |
470 | } | 471 | } |
471 | 472 | ||
472 | if (likely(!(old_pte & _PAGE_HASHPTE))) { | 473 | if (likely(!(old_pte & _PAGE_HASHPTE))) { |
473 | unsigned long hash = hpt_hash(va, HPAGE_SHIFT); | 474 | unsigned long hash = hpt_hash(va, HPAGE_SHIFT, ssize); |
474 | unsigned long hpte_group; | 475 | unsigned long hpte_group; |
475 | 476 | ||
476 | pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT; | 477 | pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT; |
@@ -489,7 +490,7 @@ repeat: | |||
489 | 490 | ||
490 | /* Insert into the hash table, primary slot */ | 491 | /* Insert into the hash table, primary slot */ |
491 | slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 0, | 492 | slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 0, |
492 | mmu_huge_psize); | 493 | mmu_huge_psize, ssize); |
493 | 494 | ||
494 | /* Primary is full, try the secondary */ | 495 | /* Primary is full, try the secondary */ |
495 | if (unlikely(slot == -1)) { | 496 | if (unlikely(slot == -1)) { |
@@ -497,7 +498,7 @@ repeat: | |||
497 | HPTES_PER_GROUP) & ~0x7UL; | 498 | HPTES_PER_GROUP) & ~0x7UL; |
498 | slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, | 499 | slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, |
499 | HPTE_V_SECONDARY, | 500 | HPTE_V_SECONDARY, |
500 | mmu_huge_psize); | 501 | mmu_huge_psize, ssize); |
501 | if (slot == -1) { | 502 | if (slot == -1) { |
502 | if (mftb() & 0x1) | 503 | if (mftb() & 0x1) |
503 | hpte_group = ((hash & htab_hash_mask) * | 504 | hpte_group = ((hash & htab_hash_mask) * |