diff options
Diffstat (limited to 'arch/sparc64/mm/init.c')
-rw-r--r-- | arch/sparc64/mm/init.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index f0ab9aab308f..69538d1aa0ad 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -1645,6 +1645,58 @@ EXPORT_SYMBOL(_PAGE_E); | |||
1645 | unsigned long _PAGE_CACHE __read_mostly; | 1645 | unsigned long _PAGE_CACHE __read_mostly; |
1646 | EXPORT_SYMBOL(_PAGE_CACHE); | 1646 | EXPORT_SYMBOL(_PAGE_CACHE); |
1647 | 1647 | ||
1648 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | ||
1649 | |||
1650 | #define VMEMMAP_CHUNK_SHIFT 22 | ||
1651 | #define VMEMMAP_CHUNK (1UL << VMEMMAP_CHUNK_SHIFT) | ||
1652 | #define VMEMMAP_CHUNK_MASK ~(VMEMMAP_CHUNK - 1UL) | ||
1653 | #define VMEMMAP_ALIGN(x) (((x)+VMEMMAP_CHUNK-1UL)&VMEMMAP_CHUNK_MASK) | ||
1654 | |||
1655 | #define VMEMMAP_SIZE ((((1UL << MAX_PHYSADDR_BITS) >> PAGE_SHIFT) * \ | ||
1656 | sizeof(struct page *)) >> VMEMMAP_CHUNK_SHIFT) | ||
1657 | unsigned long vmemmap_table[VMEMMAP_SIZE]; | ||
1658 | |||
1659 | int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node) | ||
1660 | { | ||
1661 | unsigned long vstart = (unsigned long) start; | ||
1662 | unsigned long vend = (unsigned long) (start + nr); | ||
1663 | unsigned long phys_start = (vstart - VMEMMAP_BASE); | ||
1664 | unsigned long phys_end = (vend - VMEMMAP_BASE); | ||
1665 | unsigned long addr = phys_start & VMEMMAP_CHUNK_MASK; | ||
1666 | unsigned long end = VMEMMAP_ALIGN(phys_end); | ||
1667 | unsigned long pte_base; | ||
1668 | |||
1669 | pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4U | | ||
1670 | _PAGE_CP_4U | _PAGE_CV_4U | | ||
1671 | _PAGE_P_4U | _PAGE_W_4U); | ||
1672 | if (tlb_type == hypervisor) | ||
1673 | pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4V | | ||
1674 | _PAGE_CP_4V | _PAGE_CV_4V | | ||
1675 | _PAGE_P_4V | _PAGE_W_4V); | ||
1676 | |||
1677 | for (; addr < end; addr += VMEMMAP_CHUNK) { | ||
1678 | unsigned long *vmem_pp = | ||
1679 | vmemmap_table + (addr >> VMEMMAP_CHUNK_SHIFT); | ||
1680 | void *block; | ||
1681 | |||
1682 | if (!(*vmem_pp & _PAGE_VALID)) { | ||
1683 | block = vmemmap_alloc_block(1UL << 22, node); | ||
1684 | if (!block) | ||
1685 | return -ENOMEM; | ||
1686 | |||
1687 | *vmem_pp = pte_base | __pa(block); | ||
1688 | |||
1689 | printk(KERN_INFO "[%p-%p] page_structs=%lu " | ||
1690 | "node=%d entry=%lu/%lu\n", start, block, nr, | ||
1691 | node, | ||
1692 | addr >> VMEMMAP_CHUNK_SHIFT, | ||
1693 | VMEMMAP_SIZE >> VMEMMAP_CHUNK_SHIFT); | ||
1694 | } | ||
1695 | } | ||
1696 | return 0; | ||
1697 | } | ||
1698 | #endif /* CONFIG_SPARSEMEM_VMEMMAP */ | ||
1699 | |||
1648 | static void prot_init_common(unsigned long page_none, | 1700 | static void prot_init_common(unsigned long page_none, |
1649 | unsigned long page_shared, | 1701 | unsigned long page_shared, |
1650 | unsigned long page_copy, | 1702 | unsigned long page_copy, |