Skip to content

Commit d9225ad

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm/radix: Add radix callbacks for vmemmap and map_kernel page()
Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 31a14fa commit d9225ad

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,20 +725,32 @@ void pgtable_cache_init(void);
725725
static inline int map_kernel_page(unsigned long ea, unsigned long pa,
726726
unsigned long flags)
727727
{
728+
if (radix_enabled()) {
729+
#if defined(CONFIG_PPC_RADIX_MMU) && defined(DEBUG_VM)
730+
unsigned long page_size = 1 << mmu_psize_defs[mmu_io_psize].shift;
731+
WARN((page_size != PAGE_SIZE), "I/O page size != PAGE_SIZE");
732+
#endif
733+
return radix__map_kernel_page(ea, pa, __pgprot(flags), PAGE_SIZE);
734+
}
728735
return hash__map_kernel_page(ea, pa, flags);
729736
}
730737

731738
static inline int __meminit vmemmap_create_mapping(unsigned long start,
732739
unsigned long page_size,
733740
unsigned long phys)
734741
{
742+
if (radix_enabled())
743+
return radix__vmemmap_create_mapping(start, page_size, phys);
735744
return hash__vmemmap_create_mapping(start, page_size, phys);
736745
}
737746

738747
#ifdef CONFIG_MEMORY_HOTPLUG
739748
static inline void vmemmap_remove_mapping(unsigned long start,
740749
unsigned long page_size)
741750
{
751+
752+
if (radix_enabled())
753+
return radix__vmemmap_remove_mapping(start, page_size);
742754
return hash__vmemmap_remove_mapping(start, page_size);
743755
}
744756
#endif

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ static inline int radix__pmd_trans_huge(pmd_t pmd)
130130

131131
#endif
132132

133+
extern int __meminit radix__vmemmap_create_mapping(unsigned long start,
134+
unsigned long page_size,
135+
unsigned long phys);
136+
extern void radix__vmemmap_remove_mapping(unsigned long start,
137+
unsigned long page_size);
138+
133139
extern int radix__map_kernel_page(unsigned long ea, unsigned long pa,
134140
pgprot_t flags, unsigned int psz);
135141
#endif /* __ASSEMBLY__ */

arch/powerpc/mm/pgtable-radix.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,23 @@ void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
354354
/* Finally limit subsequent allocations */
355355
memblock_set_current_limit(first_memblock_base + first_memblock_size);
356356
}
357+
358+
#ifdef CONFIG_SPARSEMEM_VMEMMAP
359+
int __meminit radix__vmemmap_create_mapping(unsigned long start,
360+
unsigned long page_size,
361+
unsigned long phys)
362+
{
363+
/* Create a PTE encoding */
364+
unsigned long flags = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_KERNEL_RW;
365+
366+
BUG_ON(radix__map_kernel_page(start, phys, __pgprot(flags), page_size));
367+
return 0;
368+
}
369+
370+
#ifdef CONFIG_MEMORY_HOTPLUG
371+
void radix__vmemmap_remove_mapping(unsigned long start, unsigned long page_size)
372+
{
373+
/* FIXME!! intel does more. We should free page tables mapping vmemmap ? */
374+
}
375+
#endif
376+
#endif

0 commit comments

Comments
 (0)