diff options
Diffstat (limited to 'arch/x86/mm/init_32.c')
-rw-r--r-- | arch/x86/mm/init_32.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index c483f424207..8655b5bb096 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/highmem.h> | 22 | #include <linux/highmem.h> |
23 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
24 | #include <linux/pci.h> | ||
24 | #include <linux/pfn.h> | 25 | #include <linux/pfn.h> |
25 | #include <linux/poison.h> | 26 | #include <linux/poison.h> |
26 | #include <linux/bootmem.h> | 27 | #include <linux/bootmem.h> |
@@ -67,7 +68,7 @@ static unsigned long __meminitdata table_top; | |||
67 | 68 | ||
68 | static int __initdata after_init_bootmem; | 69 | static int __initdata after_init_bootmem; |
69 | 70 | ||
70 | static __init void *alloc_low_page(unsigned long *phys) | 71 | static __init void *alloc_low_page(void) |
71 | { | 72 | { |
72 | unsigned long pfn = table_end++; | 73 | unsigned long pfn = table_end++; |
73 | void *adr; | 74 | void *adr; |
@@ -77,7 +78,6 @@ static __init void *alloc_low_page(unsigned long *phys) | |||
77 | 78 | ||
78 | adr = __va(pfn * PAGE_SIZE); | 79 | adr = __va(pfn * PAGE_SIZE); |
79 | memset(adr, 0, PAGE_SIZE); | 80 | memset(adr, 0, PAGE_SIZE); |
80 | *phys = pfn * PAGE_SIZE; | ||
81 | return adr; | 81 | return adr; |
82 | } | 82 | } |
83 | 83 | ||
@@ -92,16 +92,17 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd) | |||
92 | pmd_t *pmd_table; | 92 | pmd_t *pmd_table; |
93 | 93 | ||
94 | #ifdef CONFIG_X86_PAE | 94 | #ifdef CONFIG_X86_PAE |
95 | unsigned long phys; | ||
96 | if (!(pgd_val(*pgd) & _PAGE_PRESENT)) { | 95 | if (!(pgd_val(*pgd) & _PAGE_PRESENT)) { |
97 | if (after_init_bootmem) | 96 | if (after_init_bootmem) |
98 | pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE); | 97 | pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE); |
99 | else | 98 | else |
100 | pmd_table = (pmd_t *)alloc_low_page(&phys); | 99 | pmd_table = (pmd_t *)alloc_low_page(); |
101 | paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT); | 100 | paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT); |
102 | set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); | 101 | set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); |
103 | pud = pud_offset(pgd, 0); | 102 | pud = pud_offset(pgd, 0); |
104 | BUG_ON(pmd_table != pmd_offset(pud, 0)); | 103 | BUG_ON(pmd_table != pmd_offset(pud, 0)); |
104 | |||
105 | return pmd_table; | ||
105 | } | 106 | } |
106 | #endif | 107 | #endif |
107 | pud = pud_offset(pgd, 0); | 108 | pud = pud_offset(pgd, 0); |
@@ -126,10 +127,8 @@ static pte_t * __init one_page_table_init(pmd_t *pmd) | |||
126 | if (!page_table) | 127 | if (!page_table) |
127 | page_table = | 128 | page_table = |
128 | (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); | 129 | (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); |
129 | } else { | 130 | } else |
130 | unsigned long phys; | 131 | page_table = (pte_t *)alloc_low_page(); |
131 | page_table = (pte_t *)alloc_low_page(&phys); | ||
132 | } | ||
133 | 132 | ||
134 | paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT); | 133 | paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT); |
135 | set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); | 134 | set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); |
@@ -969,7 +968,7 @@ void __init mem_init(void) | |||
969 | int codesize, reservedpages, datasize, initsize; | 968 | int codesize, reservedpages, datasize, initsize; |
970 | int tmp; | 969 | int tmp; |
971 | 970 | ||
972 | start_periodic_check_for_corruption(); | 971 | pci_iommu_alloc(); |
973 | 972 | ||
974 | #ifdef CONFIG_FLATMEM | 973 | #ifdef CONFIG_FLATMEM |
975 | BUG_ON(!mem_map); | 974 | BUG_ON(!mem_map); |
@@ -1040,11 +1039,25 @@ void __init mem_init(void) | |||
1040 | (unsigned long)&_text, (unsigned long)&_etext, | 1039 | (unsigned long)&_text, (unsigned long)&_etext, |
1041 | ((unsigned long)&_etext - (unsigned long)&_text) >> 10); | 1040 | ((unsigned long)&_etext - (unsigned long)&_text) >> 10); |
1042 | 1041 | ||
1042 | /* | ||
1043 | * Check boundaries twice: Some fundamental inconsistencies can | ||
1044 | * be detected at build time already. | ||
1045 | */ | ||
1046 | #define __FIXADDR_TOP (-PAGE_SIZE) | ||
1047 | #ifdef CONFIG_HIGHMEM | ||
1048 | BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START); | ||
1049 | BUILD_BUG_ON(VMALLOC_END > PKMAP_BASE); | ||
1050 | #endif | ||
1051 | #define high_memory (-128UL << 20) | ||
1052 | BUILD_BUG_ON(VMALLOC_START >= VMALLOC_END); | ||
1053 | #undef high_memory | ||
1054 | #undef __FIXADDR_TOP | ||
1055 | |||
1043 | #ifdef CONFIG_HIGHMEM | 1056 | #ifdef CONFIG_HIGHMEM |
1044 | BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START); | 1057 | BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START); |
1045 | BUG_ON(VMALLOC_END > PKMAP_BASE); | 1058 | BUG_ON(VMALLOC_END > PKMAP_BASE); |
1046 | #endif | 1059 | #endif |
1047 | BUG_ON(VMALLOC_START > VMALLOC_END); | 1060 | BUG_ON(VMALLOC_START >= VMALLOC_END); |
1048 | BUG_ON((unsigned long)high_memory > VMALLOC_START); | 1061 | BUG_ON((unsigned long)high_memory > VMALLOC_START); |
1049 | 1062 | ||
1050 | if (boot_cpu_data.wp_works_ok < 0) | 1063 | if (boot_cpu_data.wp_works_ok < 0) |