aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2015-11-20 09:46:52 -0500
committerHelge Deller <deller@gmx.de>2015-11-22 06:22:34 -0500
commit1f25ad26d65b3740f44d6e03edcd34a5f7b58850 (patch)
treec5374c281e953446667d8788976b180be97e1b98 /arch/parisc
parentdcbf0d299c00ed4f82ea8d6e359ad88a5182f9b8 (diff)
parisc: Add defines for Huge page support
Huge pages on parisc will have the same size as one pmd table, which is on a 64bit kernel 2MB on a kernel with 4K kernel page sizes, and on a 32bit kernel 4MB when used with 4K kernel pages. Since parisc does not physically supports 2MB huge page sizes, emulate it with two consecutive 1MB page sizes instead. Keeping the same huge page size as one pmd will allow us to add transparent huge page support later on. Bit 21 in the pte flags was unused and will now be used to mark a page as huge page (_PAGE_HPAGE_BIT). Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/include/asm/page.h13
-rw-r--r--arch/parisc/include/asm/pgtable.h20
2 files changed, 29 insertions, 4 deletions
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index 60d5d174dfe4..80e742a1c162 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -145,11 +145,22 @@ extern int npmem_ranges;
145#endif /* CONFIG_DISCONTIGMEM */ 145#endif /* CONFIG_DISCONTIGMEM */
146 146
147#ifdef CONFIG_HUGETLB_PAGE 147#ifdef CONFIG_HUGETLB_PAGE
148#define HPAGE_SHIFT 22 /* 4MB (is this fixed?) */ 148#define HPAGE_SHIFT PMD_SHIFT /* fixed for transparent huge pages */
149#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) 149#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
150#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 150#define HPAGE_MASK (~(HPAGE_SIZE - 1))
151#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 151#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
152
153#if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)
154# define REAL_HPAGE_SHIFT 20 /* 20 = 1MB */
155# define _HUGE_PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_1M
156#elif !defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)
157# define REAL_HPAGE_SHIFT 22 /* 22 = 4MB */
158# define _HUGE_PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4M
159#else
160# define REAL_HPAGE_SHIFT 24 /* 24 = 16MB */
161# define _HUGE_PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_16M
152#endif 162#endif
163#endif /* CONFIG_HUGETLB_PAGE */
153 164
154#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 165#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
155 166
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index f93c4a4e6580..638317ae276e 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -167,7 +167,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
167#define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */ 167#define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */
168#define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */ 168#define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */
169#define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */ 169#define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */
170/* bit 21 was formerly the FLUSH bit but is now unused */ 170#define _PAGE_HPAGE_BIT 21 /* (0x400) Software: Huge Page */
171#define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */ 171#define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */
172 172
173/* N.B. The bits are defined in terms of a 32 bit word above, so the */ 173/* N.B. The bits are defined in terms of a 32 bit word above, so the */
@@ -194,6 +194,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
194#define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT)) 194#define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT))
195#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT)) 195#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))
196#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT)) 196#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT))
197#define _PAGE_HUGE (1 << xlate_pabit(_PAGE_HPAGE_BIT))
197#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT)) 198#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))
198 199
199#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED) 200#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)
@@ -217,7 +218,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
217#define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT)) 218#define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT))
218#define PxD_FLAG_MASK (0xf) 219#define PxD_FLAG_MASK (0xf)
219#define PxD_FLAG_SHIFT (4) 220#define PxD_FLAG_SHIFT (4)
220#define PxD_VALUE_SHIFT (8) /* (PAGE_SHIFT-PxD_FLAG_SHIFT) */ 221#define PxD_VALUE_SHIFT (PFN_PTE_SHIFT-PxD_FLAG_SHIFT)
221 222
222#ifndef __ASSEMBLY__ 223#ifndef __ASSEMBLY__
223 224
@@ -363,6 +364,18 @@ static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return
363static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 364static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
364 365
365/* 366/*
367 * Huge pte definitions.
368 */
369#ifdef CONFIG_HUGETLB_PAGE
370#define pte_huge(pte) (pte_val(pte) & _PAGE_HUGE)
371#define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_HUGE))
372#else
373#define pte_huge(pte) (0)
374#define pte_mkhuge(pte) (pte)
375#endif
376
377
378/*
366 * Conversion functions: convert a page and protection to a page entry, 379 * Conversion functions: convert a page and protection to a page entry,
367 * and a page entry and page directory to the page they refer to. 380 * and a page entry and page directory to the page they refer to.
368 */ 381 */
@@ -410,8 +423,9 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
410/* Find an entry in the second-level page table.. */ 423/* Find an entry in the second-level page table.. */
411 424
412#if CONFIG_PGTABLE_LEVELS == 3 425#if CONFIG_PGTABLE_LEVELS == 3
426#define pmd_index(addr) (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
413#define pmd_offset(dir,address) \ 427#define pmd_offset(dir,address) \
414((pmd_t *) pgd_page_vaddr(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1))) 428((pmd_t *) pgd_page_vaddr(*(dir)) + pmd_index(address))
415#else 429#else
416#define pmd_offset(dir,addr) ((pmd_t *) dir) 430#define pmd_offset(dir,addr) ((pmd_t *) dir)
417#endif 431#endif