Skip to content

Commit 2bfd65e

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm/radix: Add radix callbacks for early init routines
This adds routines for early setup for radix. We use device tree property "ibm,processor-radix-AP-encodings" to find supported page sizes. If we don't find the above we consider 64K and 4K as supported page sizes. We do map vmemap using 2M page size if we can. The linear mapping is done such that we use required page size for that range. For example memory of 3.5G is mapped such that we use 1G mapping till 3G range and use 2M mapping for the rest. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 756d08d commit 2bfd65e

File tree

6 files changed

+380
-2
lines changed

6 files changed

+380
-2
lines changed

arch/powerpc/include/asm/book3s/64/mmu.h

+16-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ struct mmu_psize_def {
1616
int penc[MMU_PAGE_COUNT]; /* HPTE encoding */
1717
unsigned int tlbiel; /* tlbiel supported for that page size */
1818
unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
19-
unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
19+
union {
20+
unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
21+
unsigned long ap; /* Ap encoding used by PowerISA 3.0 */
22+
};
2023
};
2124
extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
2225

@@ -98,22 +101,34 @@ extern int mmu_vmemmap_psize;
98101
extern int mmu_io_psize;
99102

100103
/* MMU initialization */
104+
extern void radix_init_native(void);
101105
extern void hash__early_init_mmu(void);
106+
extern void radix__early_init_mmu(void);
102107
static inline void early_init_mmu(void)
103108
{
109+
if (radix_enabled())
110+
return radix__early_init_mmu();
104111
return hash__early_init_mmu();
105112
}
106113
extern void hash__early_init_mmu_secondary(void);
114+
extern void radix__early_init_mmu_secondary(void);
107115
static inline void early_init_mmu_secondary(void)
108116
{
117+
if (radix_enabled())
118+
return radix__early_init_mmu_secondary();
109119
return hash__early_init_mmu_secondary();
110120
}
111121

112122
extern void hash__setup_initial_memory_limit(phys_addr_t first_memblock_base,
113123
phys_addr_t first_memblock_size);
124+
extern void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
125+
phys_addr_t first_memblock_size);
114126
static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base,
115127
phys_addr_t first_memblock_size)
116128
{
129+
if (radix_enabled())
130+
return radix__setup_initial_memory_limit(first_memblock_base,
131+
first_memblock_size);
117132
return hash__setup_initial_memory_limit(first_memblock_base,
118133
first_memblock_size);
119134
}

arch/powerpc/include/asm/book3s/64/radix.h

+2
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,7 @@ static inline int radix__pmd_trans_huge(pmd_t pmd)
130130

131131
#endif
132132

133+
extern int radix__map_kernel_page(unsigned long ea, unsigned long pa,
134+
pgprot_t flags, unsigned int psz);
133135
#endif /* __ASSEMBLY__ */
134136
#endif

arch/powerpc/include/asm/reg.h

+1
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@
347347
#define LPCR_LPES_SH 2
348348
#define LPCR_RMI 0x00000002 /* real mode is cache inhibit */
349349
#define LPCR_HDICE 0x00000001 /* Hyp Decr enable (HV,PR,EE) */
350+
#define LPCR_UPRT 0x00400000 /* Use Process Table (ISA 3) */
350351
#ifndef SPRN_LPID
351352
#define SPRN_LPID 0x13F /* Logical Partition Identifier */
352353
#endif

arch/powerpc/mm/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ obj-$(CONFIG_PPC_BOOK3E) += tlb_low_$(CONFIG_WORD_SIZE)e.o
1515
hash64-$(CONFIG_PPC_NATIVE) := hash_native_64.o
1616
obj-$(CONFIG_PPC_BOOK3E_64) += pgtable-book3e.o
1717
obj-$(CONFIG_PPC_STD_MMU_64) += pgtable-hash64.o hash_utils_64.o slb_low.o slb.o $(hash64-y)
18+
obj-$(CONFIG_PPC_RADIX_MMU) += pgtable-radix.o
1819
obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o hash_low_32.o
1920
obj-$(CONFIG_PPC_STD_MMU) += tlb_hash$(CONFIG_WORD_SIZE).o \
2021
mmu_context_hash$(CONFIG_WORD_SIZE).o

0 commit comments

Comments
 (0)