Commit b23d9c5b authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Michael Ellerman

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: 2bfd65e4 ("powerpc/mm/radix: Add radix callbacks for early init routines")
Reviewed-by: default avatarBalbir Singh <bsingharora@gmail.com>
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent e568006b
...@@ -228,5 +228,20 @@ extern void radix__vmemmap_remove_mapping(unsigned long start, ...@@ -228,5 +228,20 @@ extern void radix__vmemmap_remove_mapping(unsigned long start,
extern int radix__map_kernel_page(unsigned long ea, unsigned long pa, extern int radix__map_kernel_page(unsigned long ea, unsigned long pa,
pgprot_t flags, unsigned int psz); pgprot_t flags, unsigned int psz);
static inline unsigned long radix__get_tree_size(void)
{
unsigned long rts_field;
/*
* we support 52 bits, hence 52-31 = 21, 0b10101
* RTS encoding details
* bits 0 - 3 of rts -> bits 6 - 8 unsigned long
* bits 4 - 5 of rts -> bits 62 - 63 of unsigned long
*/
rts_field = (0x5UL << 5); /* 6 - 8 bits */
rts_field |= (0x2UL << 61);
return rts_field;
}
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif #endif
...@@ -65,7 +65,7 @@ static int radix__init_new_context(struct mm_struct *mm, int index) ...@@ -65,7 +65,7 @@ static int radix__init_new_context(struct mm_struct *mm, int index)
/* /*
* set the process table entry, * set the process table entry,
*/ */
rts_field = 3ull << PPC_BITLSHIFT(2); rts_field = radix__get_tree_size();
process_tb[index].prtb0 = cpu_to_be64(rts_field | __pa(mm->pgd) | RADIX_PGD_INDEX_SIZE); process_tb[index].prtb0 = cpu_to_be64(rts_field | __pa(mm->pgd) | RADIX_PGD_INDEX_SIZE);
return 0; return 0;
} }
......
...@@ -160,9 +160,8 @@ static void __init radix_init_pgtable(void) ...@@ -160,9 +160,8 @@ static void __init radix_init_pgtable(void)
process_tb = early_alloc_pgtable(1UL << PRTB_SIZE_SHIFT); process_tb = early_alloc_pgtable(1UL << PRTB_SIZE_SHIFT);
/* /*
* Fill in the process table. * Fill in the process table.
* we support 52 bits, hence 52-28 = 24, 11000
*/ */
rts_field = 3ull << PPC_BITLSHIFT(2); rts_field = radix__get_tree_size();
process_tb->prtb0 = cpu_to_be64(rts_field | __pa(init_mm.pgd) | RADIX_PGD_INDEX_SIZE); process_tb->prtb0 = cpu_to_be64(rts_field | __pa(init_mm.pgd) | RADIX_PGD_INDEX_SIZE);
/* /*
* Fill in the partition table. We are suppose to use effective address * Fill in the partition table. We are suppose to use effective address
...@@ -176,10 +175,8 @@ static void __init radix_init_pgtable(void) ...@@ -176,10 +175,8 @@ static void __init radix_init_pgtable(void)
static void __init radix_init_partition_table(void) static void __init radix_init_partition_table(void)
{ {
unsigned long rts_field; unsigned long rts_field;
/*
* we support 52 bits, hence 52-28 = 24, 11000 rts_field = radix__get_tree_size();
*/
rts_field = 3ull << PPC_BITLSHIFT(2);
BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 24), "Partition table size too large."); BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 24), "Partition table size too large.");
partition_tb = early_alloc_pgtable(1UL << PATB_SIZE_SHIFT); partition_tb = early_alloc_pgtable(1UL << PATB_SIZE_SHIFT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment