aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2016-06-17 02:10:36 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-06-17 05:50:55 -0400
commitb23d9c5b9c83c05e013aa52460f12a8365062cf4 (patch)
tree4168138d955040013dbe4a053c8559324415f002
parente568006b9d828403397668864d9797dc4bfefd28 (diff)
powerpc/mm/radix: Update Radix tree size as per ISA 3.0
ISA 3.0 updated it to be encoded as Radix tree size = 2^(RTS + 31). We have it encoded as 2^(RTS + 28). Add a helper with the correct encoding and use it instead of opencoding. Fixes: 2bfd65e45e87 ("powerpc/mm/radix: Add radix callbacks for early init routines") Reviewed-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/book3s/64/radix.h15
-rw-r--r--arch/powerpc/mm/mmu_context_book3s64.c2
-rw-r--r--arch/powerpc/mm/pgtable-radix.c9
3 files changed, 19 insertions, 7 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h
index 937d4e247ac3..df294224e280 100644
--- a/arch/powerpc/include/asm/book3s/64/radix.h
+++ b/arch/powerpc/include/asm/book3s/64/radix.h
@@ -228,5 +228,20 @@ extern void radix__vmemmap_remove_mapping(unsigned long start,
228 228
229extern int radix__map_kernel_page(unsigned long ea, unsigned long pa, 229extern int radix__map_kernel_page(unsigned long ea, unsigned long pa,
230 pgprot_t flags, unsigned int psz); 230 pgprot_t flags, unsigned int psz);
231
232static inline unsigned long radix__get_tree_size(void)
233{
234 unsigned long rts_field;
235 /*
236 * we support 52 bits, hence 52-31 = 21, 0b10101
237 * RTS encoding details
238 * bits 0 - 3 of rts -> bits 6 - 8 unsigned long
239 * bits 4 - 5 of rts -> bits 62 - 63 of unsigned long
240 */
241 rts_field = (0x5UL << 5); /* 6 - 8 bits */
242 rts_field |= (0x2UL << 61);
243
244 return rts_field;
245}
231#endif /* __ASSEMBLY__ */ 246#endif /* __ASSEMBLY__ */
232#endif 247#endif
diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c
index 227b2a6c4544..196222227e82 100644
--- a/arch/powerpc/mm/mmu_context_book3s64.c
+++ b/arch/powerpc/mm/mmu_context_book3s64.c
@@ -65,7 +65,7 @@ static int radix__init_new_context(struct mm_struct *mm, int index)
65 /* 65 /*
66 * set the process table entry, 66 * set the process table entry,
67 */ 67 */
68 rts_field = 3ull << PPC_BITLSHIFT(2); 68 rts_field = radix__get_tree_size();
69 process_tb[index].prtb0 = cpu_to_be64(rts_field | __pa(mm->pgd) | RADIX_PGD_INDEX_SIZE); 69 process_tb[index].prtb0 = cpu_to_be64(rts_field | __pa(mm->pgd) | RADIX_PGD_INDEX_SIZE);
70 return 0; 70 return 0;
71} 71}
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index c939e6e57a9e..e58707deef5c 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -160,9 +160,8 @@ redo:
160 process_tb = early_alloc_pgtable(1UL << PRTB_SIZE_SHIFT); 160 process_tb = early_alloc_pgtable(1UL << PRTB_SIZE_SHIFT);
161 /* 161 /*
162 * Fill in the process table. 162 * Fill in the process table.
163 * we support 52 bits, hence 52-28 = 24, 11000
164 */ 163 */
165 rts_field = 3ull << PPC_BITLSHIFT(2); 164 rts_field = radix__get_tree_size();
166 process_tb->prtb0 = cpu_to_be64(rts_field | __pa(init_mm.pgd) | RADIX_PGD_INDEX_SIZE); 165 process_tb->prtb0 = cpu_to_be64(rts_field | __pa(init_mm.pgd) | RADIX_PGD_INDEX_SIZE);
167 /* 166 /*
168 * Fill in the partition table. We are suppose to use effective address 167 * Fill in the partition table. We are suppose to use effective address
@@ -176,10 +175,8 @@ redo:
176static void __init radix_init_partition_table(void) 175static void __init radix_init_partition_table(void)
177{ 176{
178 unsigned long rts_field; 177 unsigned long rts_field;
179 /* 178
180 * we support 52 bits, hence 52-28 = 24, 11000 179 rts_field = radix__get_tree_size();
181 */
182 rts_field = 3ull << PPC_BITLSHIFT(2);
183 180
184 BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 24), "Partition table size too large."); 181 BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 24), "Partition table size too large.");
185 partition_tb = early_alloc_pgtable(1UL << PATB_SIZE_SHIFT); 182 partition_tb = early_alloc_pgtable(1UL << PATB_SIZE_SHIFT);