pgtable-64k.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H
  2. #define _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H
  3. #include <asm-generic/pgtable-nopud.h>
  4. #define PTE_INDEX_SIZE 8
  5. #define PMD_INDEX_SIZE 10
  6. #define PUD_INDEX_SIZE 0
  7. #define PGD_INDEX_SIZE 12
  8. /*
  9. * we support 32 fragments per PTE page of 64K size
  10. */
  11. #define PTE_FRAG_NR 32
  12. /*
  13. * We use a 2K PTE page fragment and another 2K for storing
  14. * real_pte_t hash index
  15. */
  16. #define PTE_FRAG_SIZE_SHIFT 11
  17. #define PTE_FRAG_SIZE (1UL << PTE_FRAG_SIZE_SHIFT)
  18. #ifndef __ASSEMBLY__
  19. #define PTE_TABLE_SIZE PTE_FRAG_SIZE
  20. #define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
  21. #define PUD_TABLE_SIZE (0)
  22. #define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
  23. #endif /* __ASSEMBLY__ */
  24. #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
  25. #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
  26. #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
  27. /* With 4k base page size, hugepage PTEs go at the PMD level */
  28. #define MIN_HUGEPTE_SHIFT PAGE_SHIFT
  29. /* PMD_SHIFT determines what a second-level page table entry can map */
  30. #define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
  31. #define PMD_SIZE (1UL << PMD_SHIFT)
  32. #define PMD_MASK (~(PMD_SIZE-1))
  33. /* PGDIR_SHIFT determines what a third-level page table entry can map */
  34. #define PGDIR_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE)
  35. #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
  36. #define PGDIR_MASK (~(PGDIR_SIZE-1))
  37. /*
  38. * Bits to mask out from a PMD to get to the PTE page
  39. * PMDs point to PTE table fragments which are PTE_FRAG_SIZE aligned.
  40. */
  41. #define PMD_MASKED_BITS (PTE_FRAG_SIZE - 1)
  42. /* Bits to mask out from a PGD/PUD to get to the PMD page */
  43. #define PUD_MASKED_BITS 0x1ff
  44. #define pgd_pte(pgd) (pud_pte(((pud_t){ pgd })))
  45. #define pte_pgd(pte) ((pgd_t)pte_pud(pte))
  46. #endif /* _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H */