summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2019-04-26 01:59:39 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2019-05-02 11:20:23 -0400
commit5874cabe29079b72b192a28d266adf1a460fc5d6 (patch)
treece006f905e1822b45b04eb0e9b14bd55c34b27bc
parenta521c44c3ded9fe184c5de3eed3a442af2d26f00 (diff)
powerpc/64: only book3s/64 supports CONFIG_PPC_64K_PAGES
CONFIG_PPC_64K_PAGES cannot be selected by nohash/64. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/include/asm/nohash/64/pgalloc.h3
-rw-r--r--arch/powerpc/include/asm/nohash/64/pgtable.h4
-rw-r--r--arch/powerpc/include/asm/nohash/pte-book3e.h5
-rw-r--r--arch/powerpc/include/asm/pgtable-be-types.h9
-rw-r--r--arch/powerpc/include/asm/pgtable-types.h9
-rw-r--r--arch/powerpc/include/asm/task_size_64.h2
-rw-r--r--arch/powerpc/mm/nohash/tlb.c13
-rw-r--r--arch/powerpc/mm/nohash/tlb_low_64e.S31
9 files changed, 5 insertions, 72 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2d0be82c3061..5d8e692d6470 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -375,7 +375,6 @@ config ZONE_DMA
375config PGTABLE_LEVELS 375config PGTABLE_LEVELS
376 int 376 int
377 default 2 if !PPC64 377 default 2 if !PPC64
378 default 3 if PPC_64K_PAGES && !PPC_BOOK3S_64
379 default 4 378 default 4
380 379
381source "arch/powerpc/sysdev/Kconfig" 380source "arch/powerpc/sysdev/Kconfig"
diff --git a/arch/powerpc/include/asm/nohash/64/pgalloc.h b/arch/powerpc/include/asm/nohash/64/pgalloc.h
index 66d086f85bd5..ded453f9b5a8 100644
--- a/arch/powerpc/include/asm/nohash/64/pgalloc.h
+++ b/arch/powerpc/include/asm/nohash/64/pgalloc.h
@@ -171,12 +171,9 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
171 171
172#define __pmd_free_tlb(tlb, pmd, addr) \ 172#define __pmd_free_tlb(tlb, pmd, addr) \
173 pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX) 173 pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX)
174#ifndef CONFIG_PPC_64K_PAGES
175#define __pud_free_tlb(tlb, pud, addr) \ 174#define __pud_free_tlb(tlb, pud, addr) \
176 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE) 175 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE)
177 176
178#endif /* CONFIG_PPC_64K_PAGES */
179
180#define check_pgt_cache() do { } while (0) 177#define check_pgt_cache() do { } while (0)
181 178
182#endif /* _ASM_POWERPC_PGALLOC_64_H */ 179#endif /* _ASM_POWERPC_PGALLOC_64_H */
diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/include/asm/nohash/64/pgtable.h
index c8e6a9a5bc33..b9f66cf15c31 100644
--- a/arch/powerpc/include/asm/nohash/64/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/64/pgtable.h
@@ -10,10 +10,6 @@
10#include <asm/barrier.h> 10#include <asm/barrier.h>
11#include <asm/asm-const.h> 11#include <asm/asm-const.h>
12 12
13#ifdef CONFIG_PPC_64K_PAGES
14#error "Page size not supported"
15#endif
16
17#define FIRST_USER_ADDRESS 0UL 13#define FIRST_USER_ADDRESS 0UL
18 14
19/* 15/*
diff --git a/arch/powerpc/include/asm/nohash/pte-book3e.h b/arch/powerpc/include/asm/nohash/pte-book3e.h
index dd40d200f274..813918f40765 100644
--- a/arch/powerpc/include/asm/nohash/pte-book3e.h
+++ b/arch/powerpc/include/asm/nohash/pte-book3e.h
@@ -60,13 +60,8 @@
60#define _PAGE_SPECIAL _PAGE_SW0 60#define _PAGE_SPECIAL _PAGE_SW0
61 61
62/* Base page size */ 62/* Base page size */
63#ifdef CONFIG_PPC_64K_PAGES
64#define _PAGE_PSIZE _PAGE_PSIZE_64K
65#define PTE_RPN_SHIFT (28)
66#else
67#define _PAGE_PSIZE _PAGE_PSIZE_4K 63#define _PAGE_PSIZE _PAGE_PSIZE_4K
68#define PTE_RPN_SHIFT (24) 64#define PTE_RPN_SHIFT (24)
69#endif
70 65
71#define PTE_WIMGE_SHIFT (19) 66#define PTE_WIMGE_SHIFT (19)
72#define PTE_BAP_SHIFT (2) 67#define PTE_BAP_SHIFT (2)
diff --git a/arch/powerpc/include/asm/pgtable-be-types.h b/arch/powerpc/include/asm/pgtable-be-types.h
index a89c67b62680..b169bbf95fcb 100644
--- a/arch/powerpc/include/asm/pgtable-be-types.h
+++ b/arch/powerpc/include/asm/pgtable-be-types.h
@@ -33,11 +33,7 @@ static inline __be64 pmd_raw(pmd_t x)
33 return x.pmd; 33 return x.pmd;
34} 34}
35 35
36/* 36/* 64 bit always use 4 level table. */
37 * 64 bit hash always use 4 level table. Everybody else use 4 level
38 * only for 4K page size.
39 */
40#if defined(CONFIG_PPC_BOOK3S_64) || !defined(CONFIG_PPC_64K_PAGES)
41typedef struct { __be64 pud; } pud_t; 37typedef struct { __be64 pud; } pud_t;
42#define __pud(x) ((pud_t) { cpu_to_be64(x) }) 38#define __pud(x) ((pud_t) { cpu_to_be64(x) })
43#define __pud_raw(x) ((pud_t) { (x) }) 39#define __pud_raw(x) ((pud_t) { (x) })
@@ -51,7 +47,6 @@ static inline __be64 pud_raw(pud_t x)
51 return x.pud; 47 return x.pud;
52} 48}
53 49
54#endif /* CONFIG_PPC_BOOK3S_64 || !CONFIG_PPC_64K_PAGES */
55#endif /* CONFIG_PPC64 */ 50#endif /* CONFIG_PPC64 */
56 51
57/* PGD level */ 52/* PGD level */
@@ -77,7 +72,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
77 * With hash config 64k pages additionally define a bigger "real PTE" type that 72 * With hash config 64k pages additionally define a bigger "real PTE" type that
78 * gathers the "second half" part of the PTE for pseudo 64k pages 73 * gathers the "second half" part of the PTE for pseudo 64k pages
79 */ 74 */
80#if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_PPC_BOOK3S_64) 75#ifdef CONFIG_PPC_64K_PAGES
81typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; 76typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
82#else 77#else
83typedef struct { pte_t pte; } real_pte_t; 78typedef struct { pte_t pte; } real_pte_t;
diff --git a/arch/powerpc/include/asm/pgtable-types.h b/arch/powerpc/include/asm/pgtable-types.h
index 3b0edf041b2e..d11b4c61d686 100644
--- a/arch/powerpc/include/asm/pgtable-types.h
+++ b/arch/powerpc/include/asm/pgtable-types.h
@@ -23,18 +23,13 @@ static inline unsigned long pmd_val(pmd_t x)
23 return x.pmd; 23 return x.pmd;
24} 24}
25 25
26/* 26/* 64 bit always use 4 level table. */
27 * 64 bit hash always use 4 level table. Everybody else use 4 level
28 * only for 4K page size.
29 */
30#if defined(CONFIG_PPC_BOOK3S_64) || !defined(CONFIG_PPC_64K_PAGES)
31typedef struct { unsigned long pud; } pud_t; 27typedef struct { unsigned long pud; } pud_t;
32#define __pud(x) ((pud_t) { (x) }) 28#define __pud(x) ((pud_t) { (x) })
33static inline unsigned long pud_val(pud_t x) 29static inline unsigned long pud_val(pud_t x)
34{ 30{
35 return x.pud; 31 return x.pud;
36} 32}
37#endif /* CONFIG_PPC_BOOK3S_64 || !CONFIG_PPC_64K_PAGES */
38#endif /* CONFIG_PPC64 */ 33#endif /* CONFIG_PPC64 */
39 34
40/* PGD level */ 35/* PGD level */
@@ -54,7 +49,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
54 * With hash config 64k pages additionally define a bigger "real PTE" type that 49 * With hash config 64k pages additionally define a bigger "real PTE" type that
55 * gathers the "second half" part of the PTE for pseudo 64k pages 50 * gathers the "second half" part of the PTE for pseudo 64k pages
56 */ 51 */
57#if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_PPC_BOOK3S_64) 52#ifdef CONFIG_PPC_64K_PAGES
58typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; 53typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
59#else 54#else
60typedef struct { pte_t pte; } real_pte_t; 55typedef struct { pte_t pte; } real_pte_t;
diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h
index eab4779f6b84..c993482237ed 100644
--- a/arch/powerpc/include/asm/task_size_64.h
+++ b/arch/powerpc/include/asm/task_size_64.h
@@ -20,7 +20,7 @@
20/* 20/*
21 * For now 512TB is only supported with book3s and 64K linux page size. 21 * For now 512TB is only supported with book3s and 64K linux page size.
22 */ 22 */
23#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_64K_PAGES) 23#ifdef CONFIG_PPC_64K_PAGES
24/* 24/*
25 * Max value currently used: 25 * Max value currently used:
26 */ 26 */
diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
index c2494b838008..24f88efb05bf 100644
--- a/arch/powerpc/mm/nohash/tlb.c
+++ b/arch/powerpc/mm/nohash/tlb.c
@@ -433,11 +433,7 @@ void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address)
433 unsigned long rid = (address & rmask) | 0x1000000000000000ul; 433 unsigned long rid = (address & rmask) | 0x1000000000000000ul;
434 unsigned long vpte = address & ~rmask; 434 unsigned long vpte = address & ~rmask;
435 435
436#ifdef CONFIG_PPC_64K_PAGES
437 vpte = (vpte >> (PAGE_SHIFT - 4)) & ~0xfffful;
438#else
439 vpte = (vpte >> (PAGE_SHIFT - 3)) & ~0xffful; 436 vpte = (vpte >> (PAGE_SHIFT - 3)) & ~0xffful;
440#endif
441 vpte |= rid; 437 vpte |= rid;
442 __flush_tlb_page(tlb->mm, vpte, tsize, 0); 438 __flush_tlb_page(tlb->mm, vpte, tsize, 0);
443 } 439 }
@@ -625,21 +621,12 @@ static void early_init_this_mmu(void)
625 621
626 case PPC_HTW_IBM: 622 case PPC_HTW_IBM:
627 mas4 |= MAS4_INDD; 623 mas4 |= MAS4_INDD;
628#ifdef CONFIG_PPC_64K_PAGES
629 mas4 |= BOOK3E_PAGESZ_256M << MAS4_TSIZED_SHIFT;
630 mmu_pte_psize = MMU_PAGE_256M;
631#else
632 mas4 |= BOOK3E_PAGESZ_1M << MAS4_TSIZED_SHIFT; 624 mas4 |= BOOK3E_PAGESZ_1M << MAS4_TSIZED_SHIFT;
633 mmu_pte_psize = MMU_PAGE_1M; 625 mmu_pte_psize = MMU_PAGE_1M;
634#endif
635 break; 626 break;
636 627
637 case PPC_HTW_NONE: 628 case PPC_HTW_NONE:
638#ifdef CONFIG_PPC_64K_PAGES
639 mas4 |= BOOK3E_PAGESZ_64K << MAS4_TSIZED_SHIFT;
640#else
641 mas4 |= BOOK3E_PAGESZ_4K << MAS4_TSIZED_SHIFT; 629 mas4 |= BOOK3E_PAGESZ_4K << MAS4_TSIZED_SHIFT;
642#endif
643 mmu_pte_psize = mmu_virtual_psize; 630 mmu_pte_psize = mmu_virtual_psize;
644 break; 631 break;
645 } 632 }
diff --git a/arch/powerpc/mm/nohash/tlb_low_64e.S b/arch/powerpc/mm/nohash/tlb_low_64e.S
index 9ed90064f542..58959ce15415 100644
--- a/arch/powerpc/mm/nohash/tlb_low_64e.S
+++ b/arch/powerpc/mm/nohash/tlb_low_64e.S
@@ -24,11 +24,7 @@
24#include <asm/kvm_booke_hv_asm.h> 24#include <asm/kvm_booke_hv_asm.h>
25#include <asm/feature-fixups.h> 25#include <asm/feature-fixups.h>
26 26
27#ifdef CONFIG_PPC_64K_PAGES
28#define VPTE_PMD_SHIFT (PTE_INDEX_SIZE+1)
29#else
30#define VPTE_PMD_SHIFT (PTE_INDEX_SIZE) 27#define VPTE_PMD_SHIFT (PTE_INDEX_SIZE)
31#endif
32#define VPTE_PUD_SHIFT (VPTE_PMD_SHIFT + PMD_INDEX_SIZE) 28#define VPTE_PUD_SHIFT (VPTE_PMD_SHIFT + PMD_INDEX_SIZE)
33#define VPTE_PGD_SHIFT (VPTE_PUD_SHIFT + PUD_INDEX_SIZE) 29#define VPTE_PGD_SHIFT (VPTE_PUD_SHIFT + PUD_INDEX_SIZE)
34#define VPTE_INDEX_SIZE (VPTE_PGD_SHIFT + PGD_INDEX_SIZE) 30#define VPTE_INDEX_SIZE (VPTE_PGD_SHIFT + PGD_INDEX_SIZE)
@@ -167,13 +163,11 @@ MMU_FTR_SECTION_ELSE
167 ldx r14,r14,r15 /* grab pgd entry */ 163 ldx r14,r14,r15 /* grab pgd entry */
168ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV) 164ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV)
169 165
170#ifndef CONFIG_PPC_64K_PAGES
171 rldicl r15,r16,64-PUD_SHIFT+3,64-PUD_INDEX_SIZE-3 166 rldicl r15,r16,64-PUD_SHIFT+3,64-PUD_INDEX_SIZE-3
172 clrrdi r15,r15,3 167 clrrdi r15,r15,3
173 cmpdi cr0,r14,0 168 cmpdi cr0,r14,0
174 bge tlb_miss_fault_bolted /* Bad pgd entry or hugepage; bail */ 169 bge tlb_miss_fault_bolted /* Bad pgd entry or hugepage; bail */
175 ldx r14,r14,r15 /* grab pud entry */ 170 ldx r14,r14,r15 /* grab pud entry */
176#endif /* CONFIG_PPC_64K_PAGES */
177 171
178 rldicl r15,r16,64-PMD_SHIFT+3,64-PMD_INDEX_SIZE-3 172 rldicl r15,r16,64-PMD_SHIFT+3,64-PMD_INDEX_SIZE-3
179 clrrdi r15,r15,3 173 clrrdi r15,r15,3
@@ -682,18 +676,7 @@ normal_tlb_miss:
682 * order to handle the weird page table format used by linux 676 * order to handle the weird page table format used by linux
683 */ 677 */
684 ori r10,r15,0x1 678 ori r10,r15,0x1
685#ifdef CONFIG_PPC_64K_PAGES
686 /* For the top bits, 16 bytes per PTE */
687 rldicl r14,r16,64-(PAGE_SHIFT-4),PAGE_SHIFT-4+4
688 /* Now create the bottom bits as 0 in position 0x8000 and
689 * the rest calculated for 8 bytes per PTE
690 */
691 rldicl r15,r16,64-(PAGE_SHIFT-3),64-15
692 /* Insert the bottom bits in */
693 rlwimi r14,r15,0,16,31
694#else
695 rldicl r14,r16,64-(PAGE_SHIFT-3),PAGE_SHIFT-3+4 679 rldicl r14,r16,64-(PAGE_SHIFT-3),PAGE_SHIFT-3+4
696#endif
697 sldi r15,r10,60 680 sldi r15,r10,60
698 clrrdi r14,r14,3 681 clrrdi r14,r14,3
699 or r10,r15,r14 682 or r10,r15,r14
@@ -732,11 +715,7 @@ finish_normal_tlb_miss:
732 715
733 /* Check page size, if not standard, update MAS1 */ 716 /* Check page size, if not standard, update MAS1 */
734 rldicl r11,r14,64-8,64-8 717 rldicl r11,r14,64-8,64-8
735#ifdef CONFIG_PPC_64K_PAGES
736 cmpldi cr0,r11,BOOK3E_PAGESZ_64K
737#else
738 cmpldi cr0,r11,BOOK3E_PAGESZ_4K 718 cmpldi cr0,r11,BOOK3E_PAGESZ_4K
739#endif
740 beq- 1f 719 beq- 1f
741 mfspr r11,SPRN_MAS1 720 mfspr r11,SPRN_MAS1
742 rlwimi r11,r14,31,21,24 721 rlwimi r11,r14,31,21,24
@@ -857,14 +836,12 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_TLBRSRV)
857 cmpdi cr0,r15,0 836 cmpdi cr0,r15,0
858 bge virt_page_table_tlb_miss_fault 837 bge virt_page_table_tlb_miss_fault
859 838
860#ifndef CONFIG_PPC_64K_PAGES
861 /* Get to PUD entry */ 839 /* Get to PUD entry */
862 rldicl r11,r16,64-VPTE_PUD_SHIFT,64-PUD_INDEX_SIZE-3 840 rldicl r11,r16,64-VPTE_PUD_SHIFT,64-PUD_INDEX_SIZE-3
863 clrrdi r10,r11,3 841 clrrdi r10,r11,3
864 ldx r15,r10,r15 842 ldx r15,r10,r15
865 cmpdi cr0,r15,0 843 cmpdi cr0,r15,0
866 bge virt_page_table_tlb_miss_fault 844 bge virt_page_table_tlb_miss_fault
867#endif /* CONFIG_PPC_64K_PAGES */
868 845
869 /* Get to PMD entry */ 846 /* Get to PMD entry */
870 rldicl r11,r16,64-VPTE_PMD_SHIFT,64-PMD_INDEX_SIZE-3 847 rldicl r11,r16,64-VPTE_PMD_SHIFT,64-PMD_INDEX_SIZE-3
@@ -1106,14 +1083,12 @@ htw_tlb_miss:
1106 cmpdi cr0,r15,0 1083 cmpdi cr0,r15,0
1107 bge htw_tlb_miss_fault 1084 bge htw_tlb_miss_fault
1108 1085
1109#ifndef CONFIG_PPC_64K_PAGES
1110 /* Get to PUD entry */ 1086 /* Get to PUD entry */
1111 rldicl r11,r16,64-(PUD_SHIFT-3),64-PUD_INDEX_SIZE-3 1087 rldicl r11,r16,64-(PUD_SHIFT-3),64-PUD_INDEX_SIZE-3
1112 clrrdi r10,r11,3 1088 clrrdi r10,r11,3
1113 ldx r15,r10,r15 1089 ldx r15,r10,r15
1114 cmpdi cr0,r15,0 1090 cmpdi cr0,r15,0
1115 bge htw_tlb_miss_fault 1091 bge htw_tlb_miss_fault
1116#endif /* CONFIG_PPC_64K_PAGES */
1117 1092
1118 /* Get to PMD entry */ 1093 /* Get to PMD entry */
1119 rldicl r11,r16,64-(PMD_SHIFT-3),64-PMD_INDEX_SIZE-3 1094 rldicl r11,r16,64-(PMD_SHIFT-3),64-PMD_INDEX_SIZE-3
@@ -1132,9 +1107,7 @@ htw_tlb_miss:
1132 * 4K page we need to extract a bit from the virtual address and 1107 * 4K page we need to extract a bit from the virtual address and
1133 * insert it into the "PA52" bit of the RPN. 1108 * insert it into the "PA52" bit of the RPN.
1134 */ 1109 */
1135#ifndef CONFIG_PPC_64K_PAGES
1136 rlwimi r15,r16,32-9,20,20 1110 rlwimi r15,r16,32-9,20,20
1137#endif
1138 /* Now we build the MAS: 1111 /* Now we build the MAS:
1139 * 1112 *
1140 * MAS 0 : Fully setup with defaults in MAS4 and TLBnCFG 1113 * MAS 0 : Fully setup with defaults in MAS4 and TLBnCFG
@@ -1144,11 +1117,7 @@ htw_tlb_miss:
1144 * MAS 2 : Use defaults 1117 * MAS 2 : Use defaults
1145 * MAS 3+7 : Needs to be done 1118 * MAS 3+7 : Needs to be done
1146 */ 1119 */
1147#ifdef CONFIG_PPC_64K_PAGES
1148 ori r10,r15,(BOOK3E_PAGESZ_64K << MAS3_SPSIZE_SHIFT)
1149#else
1150 ori r10,r15,(BOOK3E_PAGESZ_4K << MAS3_SPSIZE_SHIFT) 1120 ori r10,r15,(BOOK3E_PAGESZ_4K << MAS3_SPSIZE_SHIFT)
1151#endif
1152 1121
1153BEGIN_MMU_FTR_SECTION 1122BEGIN_MMU_FTR_SECTION
1154 srdi r16,r10,32 1123 srdi r16,r10,32