24 #include <linux/signal.h>
25 #include <linux/sched.h>
26 #include <linux/kernel.h>
27 #include <linux/errno.h>
28 #include <linux/string.h>
29 #include <linux/types.h>
30 #include <linux/mman.h>
33 #include <linux/stddef.h>
41 #include <linux/module.h>
42 #include <linux/poison.h>
45 #include <linux/slab.h>
47 #include <asm/pgalloc.h>
52 #include <asm/mmu_context.h>
53 #include <asm/pgtable.h>
55 #include <asm/uaccess.h>
57 #include <asm/machdep.h>
60 #include <asm/processor.h>
61 #include <asm/mmzone.h>
62 #include <asm/cputable.h>
63 #include <asm/sections.h>
64 #include <asm/iommu.h>
69 #ifdef CONFIG_PPC_STD_MMU_64
70 #if PGTABLE_RANGE > USER_VSID_RANGE
71 #warning Limited user VSID range means pagetable space is wasted
74 #if (TASK_SIZE_USER64 < PGTABLE_RANGE) && (TASK_SIZE_USER64 < USER_VSID_RANGE)
75 #warning TASK_SIZE is smaller than it needs to be.
106 unsigned long table_size =
sizeof(
void *) << shift;
107 unsigned long align = table_size;
129 align =
max_t(
unsigned long, align, minalign);
134 pr_debug(
"Allocated pgtable cache for order %d\n", shift);
143 panic(
"Couldn't allocate pgtable caches");
153 #ifdef CONFIG_SPARSEMEM_VMEMMAP
160 static unsigned long __meminit vmemmap_section_start(
unsigned long page)
165 return (offset /
sizeof(
struct page)) & PAGE_SECTION_MASK;
177 for (; start <
end; start += (PAGES_PER_SECTION *
sizeof(
struct page)))
191 #ifdef CONFIG_PPC_BOOK3E
192 static void __meminit vmemmap_create_mapping(
unsigned long start,
193 unsigned long page_size,
214 static void __meminit vmemmap_create_mapping(
unsigned long start,
215 unsigned long page_size,
219 PAGE_KERNEL, mmu_vmemmap_psize,
233 if (!next || !num_left) {
247 static __meminit void vmemmap_list_populate(
unsigned long phys,
253 vmem_back = vmemmap_list_alloc(node);
261 vmem_back->
list = vmemmap_list;
263 vmemmap_list = vmem_back;
267 unsigned long nr_pages,
int node)
269 unsigned long start = (
unsigned long)start_page;
270 unsigned long end = (
unsigned long)(start_page + nr_pages);
276 pr_debug(
"vmemmap_populate page %p, %ld pages, node %d\n",
277 start_page, nr_pages, node);
278 pr_debug(
" -> map %lx..%lx\n", start, end);
283 if (vmemmap_populated(start, page_size))
290 vmemmap_list_populate(
__pa(p), start, node);
292 pr_debug(
" * %016lx..%016lx allocated at %p\n",
293 start, start + page_size, p);
295 vmemmap_create_mapping(start, page_size,
__pa(p));