aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-03-04 00:35:43 -0500
committerIngo Molnar <mingo@kernel.org>2015-03-04 00:35:43 -0500
commitd2c032e3dc58137a7261a7824d3acce435db1d66 (patch)
tree7eea1c7c6103eefe879f07472eec99b3c41eb792 /arch/x86/mm/init.c
parent7e8e385aaf6ed5b64b5d9108081cfcdcdd021b78 (diff)
parent13a7a6ac0a11197edcd0f756a035f472b42cdf8b (diff)
Merge tag 'v4.0-rc2' into x86/asm, to refresh the tree
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/mm/init.c')
-rw-r--r--arch/x86/mm/init.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 090499a363cb..52417e771af9 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -173,11 +173,11 @@ static void __init probe_page_size_mask(void)
173 173
174 /* Enable PSE if available */ 174 /* Enable PSE if available */
175 if (cpu_has_pse) 175 if (cpu_has_pse)
176 set_in_cr4(X86_CR4_PSE); 176 cr4_set_bits_and_update_boot(X86_CR4_PSE);
177 177
178 /* Enable PGE if available */ 178 /* Enable PGE if available */
179 if (cpu_has_pge) { 179 if (cpu_has_pge) {
180 set_in_cr4(X86_CR4_PGE); 180 cr4_set_bits_and_update_boot(X86_CR4_PGE);
181 __supported_pte_mask |= _PAGE_GLOBAL; 181 __supported_pte_mask |= _PAGE_GLOBAL;
182 } else 182 } else
183 __supported_pte_mask &= ~_PAGE_GLOBAL; 183 __supported_pte_mask &= ~_PAGE_GLOBAL;
@@ -239,6 +239,31 @@ static void __init_refok adjust_range_page_size_mask(struct map_range *mr,
239 } 239 }
240} 240}
241 241
242static const char *page_size_string(struct map_range *mr)
243{
244 static const char str_1g[] = "1G";
245 static const char str_2m[] = "2M";
246 static const char str_4m[] = "4M";
247 static const char str_4k[] = "4k";
248
249 if (mr->page_size_mask & (1<<PG_LEVEL_1G))
250 return str_1g;
251 /*
252 * 32-bit without PAE has a 4M large page size.
253 * PG_LEVEL_2M is misnamed, but we can at least
254 * print out the right size in the string.
255 */
256 if (IS_ENABLED(CONFIG_X86_32) &&
257 !IS_ENABLED(CONFIG_X86_PAE) &&
258 mr->page_size_mask & (1<<PG_LEVEL_2M))
259 return str_4m;
260
261 if (mr->page_size_mask & (1<<PG_LEVEL_2M))
262 return str_2m;
263
264 return str_4k;
265}
266
242static int __meminit split_mem_range(struct map_range *mr, int nr_range, 267static int __meminit split_mem_range(struct map_range *mr, int nr_range,
243 unsigned long start, 268 unsigned long start,
244 unsigned long end) 269 unsigned long end)
@@ -334,8 +359,7 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
334 for (i = 0; i < nr_range; i++) 359 for (i = 0; i < nr_range; i++)
335 printk(KERN_DEBUG " [mem %#010lx-%#010lx] page %s\n", 360 printk(KERN_DEBUG " [mem %#010lx-%#010lx] page %s\n",
336 mr[i].start, mr[i].end - 1, 361 mr[i].start, mr[i].end - 1,
337 (mr[i].page_size_mask & (1<<PG_LEVEL_1G))?"1G":( 362 page_size_string(&mr[i]));
338 (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
339 363
340 return nr_range; 364 return nr_range;
341} 365}
@@ -609,7 +633,7 @@ void __init init_mem_mapping(void)
609 * 633 *
610 * 634 *
611 * On x86, access has to be given to the first megabyte of ram because that area 635 * On x86, access has to be given to the first megabyte of ram because that area
612 * contains bios code and data regions used by X and dosemu and similar apps. 636 * contains BIOS code and data regions used by X and dosemu and similar apps.
613 * Access has to be given to non-kernel-ram areas as well, these contain the PCI 637 * Access has to be given to non-kernel-ram areas as well, these contain the PCI
614 * mmio resources as well as potential bios/acpi data regions. 638 * mmio resources as well as potential bios/acpi data regions.
615 */ 639 */
@@ -714,6 +738,15 @@ void __init zone_sizes_init(void)
714 free_area_init_nodes(max_zone_pfns); 738 free_area_init_nodes(max_zone_pfns);
715} 739}
716 740
741DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = {
742#ifdef CONFIG_SMP
743 .active_mm = &init_mm,
744 .state = 0,
745#endif
746 .cr4 = ~0UL, /* fail hard if we screw up cr4 shadow initialization */
747};
748EXPORT_SYMBOL_GPL(cpu_tlbstate);
749
717void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache) 750void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache)
718{ 751{
719 /* entry 0 MUST be WB (hardwired to speed up translations) */ 752 /* entry 0 MUST be WB (hardwired to speed up translations) */