diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2016-09-17 17:39:26 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-09-21 09:02:12 -0400 |
commit | 475339684ef19e46f4702e2d185a869a5c454688 (patch) | |
tree | d7973d4c3f413888bd5c629f96d57da6f4e3ab78 | |
parent | 8c2103f224216a45c1a4d7aebbc13f3e007cde34 (diff) |
x86/e820: Prepare e280 code for switch to dynamic storage
This patch turns e820 and e820_saved into pointers to e820 tables,
of the same size as before.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/20160917213927.1787-2-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/e820.h | 6 | ||||
-rw-r--r-- | arch/x86/kernel/e820.c | 125 | ||||
-rw-r--r-- | arch/x86/kernel/early-quirks.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/kexec-bzimage64.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/resource.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/tboot.c | 8 | ||||
-rw-r--r-- | arch/x86/mm/init.c | 2 | ||||
-rw-r--r-- | arch/x86/platform/efi/efi.c | 2 | ||||
-rw-r--r-- | arch/x86/xen/setup.c | 2 |
10 files changed, 98 insertions, 65 deletions
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h index 3ab0537872fb..476b574de99e 100644 --- a/arch/x86/include/asm/e820.h +++ b/arch/x86/include/asm/e820.h | |||
@@ -10,8 +10,8 @@ | |||
10 | #include <uapi/asm/e820.h> | 10 | #include <uapi/asm/e820.h> |
11 | #ifndef __ASSEMBLY__ | 11 | #ifndef __ASSEMBLY__ |
12 | /* see comment in arch/x86/kernel/e820.c */ | 12 | /* see comment in arch/x86/kernel/e820.c */ |
13 | extern struct e820map e820; | 13 | extern struct e820map *e820; |
14 | extern struct e820map e820_saved; | 14 | extern struct e820map *e820_saved; |
15 | 15 | ||
16 | extern unsigned long pci_mem_start; | 16 | extern unsigned long pci_mem_start; |
17 | extern int e820_any_mapped(u64 start, u64 end, unsigned type); | 17 | extern int e820_any_mapped(u64 start, u64 end, unsigned type); |
@@ -53,6 +53,8 @@ extern void e820_reserve_resources_late(void); | |||
53 | extern void setup_memory_map(void); | 53 | extern void setup_memory_map(void); |
54 | extern char *default_machine_specific_memory_setup(void); | 54 | extern char *default_machine_specific_memory_setup(void); |
55 | 55 | ||
56 | extern void e820_reallocate_tables(void); | ||
57 | |||
56 | /* | 58 | /* |
57 | * Returns true iff the specified range [s,e) is completely contained inside | 59 | * Returns true iff the specified range [s,e) is completely contained inside |
58 | * the ISA region. | 60 | * the ISA region. |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 4d3dd9a713c7..585000c98d3e 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -40,8 +40,10 @@ | |||
40 | * user can e.g. boot the original kernel with mem=1G while still booting the | 40 | * user can e.g. boot the original kernel with mem=1G while still booting the |
41 | * next kernel with full memory. | 41 | * next kernel with full memory. |
42 | */ | 42 | */ |
43 | struct e820map e820; | 43 | static struct e820map initial_e820; |
44 | struct e820map e820_saved; | 44 | static struct e820map initial_e820_saved; |
45 | struct e820map *e820 = &initial_e820; | ||
46 | struct e820map *e820_saved = &initial_e820_saved; | ||
45 | 47 | ||
46 | /* For PCI or other memory-mapped resources */ | 48 | /* For PCI or other memory-mapped resources */ |
47 | unsigned long pci_mem_start = 0xaeedbabe; | 49 | unsigned long pci_mem_start = 0xaeedbabe; |
@@ -58,8 +60,8 @@ e820_any_mapped(u64 start, u64 end, unsigned type) | |||
58 | { | 60 | { |
59 | int i; | 61 | int i; |
60 | 62 | ||
61 | for (i = 0; i < e820.nr_map; i++) { | 63 | for (i = 0; i < e820->nr_map; i++) { |
62 | struct e820entry *ei = &e820.map[i]; | 64 | struct e820entry *ei = &e820->map[i]; |
63 | 65 | ||
64 | if (type && ei->type != type) | 66 | if (type && ei->type != type) |
65 | continue; | 67 | continue; |
@@ -81,8 +83,8 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type) | |||
81 | { | 83 | { |
82 | int i; | 84 | int i; |
83 | 85 | ||
84 | for (i = 0; i < e820.nr_map; i++) { | 86 | for (i = 0; i < e820->nr_map; i++) { |
85 | struct e820entry *ei = &e820.map[i]; | 87 | struct e820entry *ei = &e820->map[i]; |
86 | 88 | ||
87 | if (type && ei->type != type) | 89 | if (type && ei->type != type) |
88 | continue; | 90 | continue; |
@@ -128,7 +130,7 @@ static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size, | |||
128 | 130 | ||
129 | void __init e820_add_region(u64 start, u64 size, int type) | 131 | void __init e820_add_region(u64 start, u64 size, int type) |
130 | { | 132 | { |
131 | __e820_add_region(&e820, start, size, type); | 133 | __e820_add_region(e820, start, size, type); |
132 | } | 134 | } |
133 | 135 | ||
134 | static void __init e820_print_type(u32 type) | 136 | static void __init e820_print_type(u32 type) |
@@ -164,12 +166,12 @@ void __init e820_print_map(char *who) | |||
164 | { | 166 | { |
165 | int i; | 167 | int i; |
166 | 168 | ||
167 | for (i = 0; i < e820.nr_map; i++) { | 169 | for (i = 0; i < e820->nr_map; i++) { |
168 | printk(KERN_INFO "%s: [mem %#018Lx-%#018Lx] ", who, | 170 | printk(KERN_INFO "%s: [mem %#018Lx-%#018Lx] ", who, |
169 | (unsigned long long) e820.map[i].addr, | 171 | (unsigned long long) e820->map[i].addr, |
170 | (unsigned long long) | 172 | (unsigned long long) |
171 | (e820.map[i].addr + e820.map[i].size - 1)); | 173 | (e820->map[i].addr + e820->map[i].size - 1)); |
172 | e820_print_type(e820.map[i].type); | 174 | e820_print_type(e820->map[i].type); |
173 | printk(KERN_CONT "\n"); | 175 | printk(KERN_CONT "\n"); |
174 | } | 176 | } |
175 | } | 177 | } |
@@ -493,13 +495,13 @@ static u64 __init __e820_update_range(struct e820map *e820x, u64 start, | |||
493 | u64 __init e820_update_range(u64 start, u64 size, unsigned old_type, | 495 | u64 __init e820_update_range(u64 start, u64 size, unsigned old_type, |
494 | unsigned new_type) | 496 | unsigned new_type) |
495 | { | 497 | { |
496 | return __e820_update_range(&e820, start, size, old_type, new_type); | 498 | return __e820_update_range(e820, start, size, old_type, new_type); |
497 | } | 499 | } |
498 | 500 | ||
499 | static u64 __init e820_update_range_saved(u64 start, u64 size, | 501 | static u64 __init e820_update_range_saved(u64 start, u64 size, |
500 | unsigned old_type, unsigned new_type) | 502 | unsigned old_type, unsigned new_type) |
501 | { | 503 | { |
502 | return __e820_update_range(&e820_saved, start, size, old_type, | 504 | return __e820_update_range(e820_saved, start, size, old_type, |
503 | new_type); | 505 | new_type); |
504 | } | 506 | } |
505 | 507 | ||
@@ -521,8 +523,8 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, | |||
521 | e820_print_type(old_type); | 523 | e820_print_type(old_type); |
522 | printk(KERN_CONT "\n"); | 524 | printk(KERN_CONT "\n"); |
523 | 525 | ||
524 | for (i = 0; i < e820.nr_map; i++) { | 526 | for (i = 0; i < e820->nr_map; i++) { |
525 | struct e820entry *ei = &e820.map[i]; | 527 | struct e820entry *ei = &e820->map[i]; |
526 | u64 final_start, final_end; | 528 | u64 final_start, final_end; |
527 | u64 ei_end; | 529 | u64 ei_end; |
528 | 530 | ||
@@ -566,15 +568,15 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, | |||
566 | 568 | ||
567 | void __init update_e820(void) | 569 | void __init update_e820(void) |
568 | { | 570 | { |
569 | if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map)) | 571 | if (sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map)) |
570 | return; | 572 | return; |
571 | printk(KERN_INFO "e820: modified physical RAM map:\n"); | 573 | printk(KERN_INFO "e820: modified physical RAM map:\n"); |
572 | e820_print_map("modified"); | 574 | e820_print_map("modified"); |
573 | } | 575 | } |
574 | static void __init update_e820_saved(void) | 576 | static void __init update_e820_saved(void) |
575 | { | 577 | { |
576 | sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), | 578 | sanitize_e820_map(e820_saved->map, ARRAY_SIZE(e820_saved->map), |
577 | &e820_saved.nr_map); | 579 | &e820_saved->nr_map); |
578 | } | 580 | } |
579 | #define MAX_GAP_END 0x100000000ull | 581 | #define MAX_GAP_END 0x100000000ull |
580 | /* | 582 | /* |
@@ -584,14 +586,14 @@ __init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, | |||
584 | unsigned long start_addr, unsigned long long end_addr) | 586 | unsigned long start_addr, unsigned long long end_addr) |
585 | { | 587 | { |
586 | unsigned long long last; | 588 | unsigned long long last; |
587 | int i = e820.nr_map; | 589 | int i = e820->nr_map; |
588 | int found = 0; | 590 | int found = 0; |
589 | 591 | ||
590 | last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END; | 592 | last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END; |
591 | 593 | ||
592 | while (--i >= 0) { | 594 | while (--i >= 0) { |
593 | unsigned long long start = e820.map[i].addr; | 595 | unsigned long long start = e820->map[i].addr; |
594 | unsigned long long end = start + e820.map[i].size; | 596 | unsigned long long end = start + e820->map[i].size; |
595 | 597 | ||
596 | if (end < start_addr) | 598 | if (end < start_addr) |
597 | continue; | 599 | continue; |
@@ -649,6 +651,33 @@ __init void e820_setup_gap(void) | |||
649 | gapstart, gapstart + gapsize - 1); | 651 | gapstart, gapstart + gapsize - 1); |
650 | } | 652 | } |
651 | 653 | ||
654 | /* | ||
655 | * Called late during init, in free_initmem(). | ||
656 | * | ||
657 | * Initial e820 and e820_saved are largish __initdata arrays. | ||
658 | * Copy them to (usually much smaller) dynamically allocated area. | ||
659 | * This is done after all tweaks we ever do to them: | ||
660 | * all functions which modify them are __init functions, | ||
661 | * they won't exist after this point. | ||
662 | */ | ||
663 | __init void e820_reallocate_tables(void) | ||
664 | { | ||
665 | struct e820map *n; | ||
666 | int size; | ||
667 | |||
668 | size = offsetof(struct e820map, map) + sizeof(struct e820entry) * e820->nr_map; | ||
669 | n = kmalloc(size, GFP_KERNEL); | ||
670 | BUG_ON(!n); | ||
671 | memcpy(n, e820, size); | ||
672 | e820 = n; | ||
673 | |||
674 | size = offsetof(struct e820map, map) + sizeof(struct e820entry) * e820_saved->nr_map; | ||
675 | n = kmalloc(size, GFP_KERNEL); | ||
676 | BUG_ON(!n); | ||
677 | memcpy(n, e820_saved, size); | ||
678 | e820_saved = n; | ||
679 | } | ||
680 | |||
652 | /** | 681 | /** |
653 | * Because of the size limitation of struct boot_params, only first | 682 | * Because of the size limitation of struct boot_params, only first |
654 | * 128 E820 memory entries are passed to kernel via | 683 | * 128 E820 memory entries are passed to kernel via |
@@ -665,7 +694,7 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len) | |||
665 | entries = sdata->len / sizeof(struct e820entry); | 694 | entries = sdata->len / sizeof(struct e820entry); |
666 | extmap = (struct e820entry *)(sdata->data); | 695 | extmap = (struct e820entry *)(sdata->data); |
667 | __append_e820_map(extmap, entries); | 696 | __append_e820_map(extmap, entries); |
668 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 697 | sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); |
669 | early_memunmap(sdata, data_len); | 698 | early_memunmap(sdata, data_len); |
670 | printk(KERN_INFO "e820: extended physical RAM map:\n"); | 699 | printk(KERN_INFO "e820: extended physical RAM map:\n"); |
671 | e820_print_map("extended"); | 700 | e820_print_map("extended"); |
@@ -686,8 +715,8 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn) | |||
686 | int i; | 715 | int i; |
687 | unsigned long pfn = 0; | 716 | unsigned long pfn = 0; |
688 | 717 | ||
689 | for (i = 0; i < e820.nr_map; i++) { | 718 | for (i = 0; i < e820->nr_map; i++) { |
690 | struct e820entry *ei = &e820.map[i]; | 719 | struct e820entry *ei = &e820->map[i]; |
691 | 720 | ||
692 | if (pfn < PFN_UP(ei->addr)) | 721 | if (pfn < PFN_UP(ei->addr)) |
693 | register_nosave_region(pfn, PFN_UP(ei->addr)); | 722 | register_nosave_region(pfn, PFN_UP(ei->addr)); |
@@ -712,8 +741,8 @@ static int __init e820_mark_nvs_memory(void) | |||
712 | { | 741 | { |
713 | int i; | 742 | int i; |
714 | 743 | ||
715 | for (i = 0; i < e820.nr_map; i++) { | 744 | for (i = 0; i < e820->nr_map; i++) { |
716 | struct e820entry *ei = &e820.map[i]; | 745 | struct e820entry *ei = &e820->map[i]; |
717 | 746 | ||
718 | if (ei->type == E820_NVS) | 747 | if (ei->type == E820_NVS) |
719 | acpi_nvs_register(ei->addr, ei->size); | 748 | acpi_nvs_register(ei->addr, ei->size); |
@@ -760,8 +789,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn) | |||
760 | unsigned long last_pfn = 0; | 789 | unsigned long last_pfn = 0; |
761 | unsigned long max_arch_pfn = MAX_ARCH_PFN; | 790 | unsigned long max_arch_pfn = MAX_ARCH_PFN; |
762 | 791 | ||
763 | for (i = 0; i < e820.nr_map; i++) { | 792 | for (i = 0; i < e820->nr_map; i++) { |
764 | struct e820entry *ei = &e820.map[i]; | 793 | struct e820entry *ei = &e820->map[i]; |
765 | unsigned long start_pfn; | 794 | unsigned long start_pfn; |
766 | unsigned long end_pfn; | 795 | unsigned long end_pfn; |
767 | 796 | ||
@@ -856,7 +885,7 @@ static int __init parse_memmap_one(char *p) | |||
856 | */ | 885 | */ |
857 | saved_max_pfn = e820_end_of_ram_pfn(); | 886 | saved_max_pfn = e820_end_of_ram_pfn(); |
858 | #endif | 887 | #endif |
859 | e820.nr_map = 0; | 888 | e820->nr_map = 0; |
860 | userdef = 1; | 889 | userdef = 1; |
861 | return 0; | 890 | return 0; |
862 | } | 891 | } |
@@ -903,8 +932,8 @@ early_param("memmap", parse_memmap_opt); | |||
903 | void __init finish_e820_parsing(void) | 932 | void __init finish_e820_parsing(void) |
904 | { | 933 | { |
905 | if (userdef) { | 934 | if (userdef) { |
906 | if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), | 935 | if (sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), |
907 | &e820.nr_map) < 0) | 936 | &e820->nr_map) < 0) |
908 | early_panic("Invalid user supplied memory map"); | 937 | early_panic("Invalid user supplied memory map"); |
909 | 938 | ||
910 | printk(KERN_INFO "e820: user-defined physical RAM map:\n"); | 939 | printk(KERN_INFO "e820: user-defined physical RAM map:\n"); |
@@ -991,35 +1020,35 @@ void __init e820_reserve_resources(void) | |||
991 | struct resource *res; | 1020 | struct resource *res; |
992 | u64 end; | 1021 | u64 end; |
993 | 1022 | ||
994 | res = alloc_bootmem(sizeof(struct resource) * e820.nr_map); | 1023 | res = alloc_bootmem(sizeof(struct resource) * e820->nr_map); |
995 | e820_res = res; | 1024 | e820_res = res; |
996 | for (i = 0; i < e820.nr_map; i++) { | 1025 | for (i = 0; i < e820->nr_map; i++) { |
997 | end = e820.map[i].addr + e820.map[i].size - 1; | 1026 | end = e820->map[i].addr + e820->map[i].size - 1; |
998 | if (end != (resource_size_t)end) { | 1027 | if (end != (resource_size_t)end) { |
999 | res++; | 1028 | res++; |
1000 | continue; | 1029 | continue; |
1001 | } | 1030 | } |
1002 | res->name = e820_type_to_string(e820.map[i].type); | 1031 | res->name = e820_type_to_string(e820->map[i].type); |
1003 | res->start = e820.map[i].addr; | 1032 | res->start = e820->map[i].addr; |
1004 | res->end = end; | 1033 | res->end = end; |
1005 | 1034 | ||
1006 | res->flags = e820_type_to_iomem_type(e820.map[i].type); | 1035 | res->flags = e820_type_to_iomem_type(e820->map[i].type); |
1007 | res->desc = e820_type_to_iores_desc(e820.map[i].type); | 1036 | res->desc = e820_type_to_iores_desc(e820->map[i].type); |
1008 | 1037 | ||
1009 | /* | 1038 | /* |
1010 | * don't register the region that could be conflicted with | 1039 | * don't register the region that could be conflicted with |
1011 | * pci device BAR resource and insert them later in | 1040 | * pci device BAR resource and insert them later in |
1012 | * pcibios_resource_survey() | 1041 | * pcibios_resource_survey() |
1013 | */ | 1042 | */ |
1014 | if (do_mark_busy(e820.map[i].type, res)) { | 1043 | if (do_mark_busy(e820->map[i].type, res)) { |
1015 | res->flags |= IORESOURCE_BUSY; | 1044 | res->flags |= IORESOURCE_BUSY; |
1016 | insert_resource(&iomem_resource, res); | 1045 | insert_resource(&iomem_resource, res); |
1017 | } | 1046 | } |
1018 | res++; | 1047 | res++; |
1019 | } | 1048 | } |
1020 | 1049 | ||
1021 | for (i = 0; i < e820_saved.nr_map; i++) { | 1050 | for (i = 0; i < e820_saved->nr_map; i++) { |
1022 | struct e820entry *entry = &e820_saved.map[i]; | 1051 | struct e820entry *entry = &e820_saved->map[i]; |
1023 | firmware_map_add_early(entry->addr, | 1052 | firmware_map_add_early(entry->addr, |
1024 | entry->addr + entry->size, | 1053 | entry->addr + entry->size, |
1025 | e820_type_to_string(entry->type)); | 1054 | e820_type_to_string(entry->type)); |
@@ -1051,7 +1080,7 @@ void __init e820_reserve_resources_late(void) | |||
1051 | struct resource *res; | 1080 | struct resource *res; |
1052 | 1081 | ||
1053 | res = e820_res; | 1082 | res = e820_res; |
1054 | for (i = 0; i < e820.nr_map; i++) { | 1083 | for (i = 0; i < e820->nr_map; i++) { |
1055 | if (!res->parent && res->end) | 1084 | if (!res->parent && res->end) |
1056 | insert_resource_expand_to_fit(&iomem_resource, res); | 1085 | insert_resource_expand_to_fit(&iomem_resource, res); |
1057 | res++; | 1086 | res++; |
@@ -1061,8 +1090,8 @@ void __init e820_reserve_resources_late(void) | |||
1061 | * Try to bump up RAM regions to reasonable boundaries to | 1090 | * Try to bump up RAM regions to reasonable boundaries to |
1062 | * avoid stolen RAM: | 1091 | * avoid stolen RAM: |
1063 | */ | 1092 | */ |
1064 | for (i = 0; i < e820.nr_map; i++) { | 1093 | for (i = 0; i < e820->nr_map; i++) { |
1065 | struct e820entry *entry = &e820.map[i]; | 1094 | struct e820entry *entry = &e820->map[i]; |
1066 | u64 start, end; | 1095 | u64 start, end; |
1067 | 1096 | ||
1068 | if (entry->type != E820_RAM) | 1097 | if (entry->type != E820_RAM) |
@@ -1110,7 +1139,7 @@ char *__init default_machine_specific_memory_setup(void) | |||
1110 | who = "BIOS-e801"; | 1139 | who = "BIOS-e801"; |
1111 | } | 1140 | } |
1112 | 1141 | ||
1113 | e820.nr_map = 0; | 1142 | e820->nr_map = 0; |
1114 | e820_add_region(0, LOWMEMSIZE(), E820_RAM); | 1143 | e820_add_region(0, LOWMEMSIZE(), E820_RAM); |
1115 | e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM); | 1144 | e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM); |
1116 | } | 1145 | } |
@@ -1124,7 +1153,7 @@ void __init setup_memory_map(void) | |||
1124 | char *who; | 1153 | char *who; |
1125 | 1154 | ||
1126 | who = x86_init.resources.memory_setup(); | 1155 | who = x86_init.resources.memory_setup(); |
1127 | memcpy(&e820_saved, &e820, sizeof(struct e820map)); | 1156 | memcpy(e820_saved, e820, sizeof(struct e820map)); |
1128 | printk(KERN_INFO "e820: BIOS-provided physical RAM map:\n"); | 1157 | printk(KERN_INFO "e820: BIOS-provided physical RAM map:\n"); |
1129 | e820_print_map(who); | 1158 | e820_print_map(who); |
1130 | } | 1159 | } |
@@ -1141,8 +1170,8 @@ void __init memblock_x86_fill(void) | |||
1141 | */ | 1170 | */ |
1142 | memblock_allow_resize(); | 1171 | memblock_allow_resize(); |
1143 | 1172 | ||
1144 | for (i = 0; i < e820.nr_map; i++) { | 1173 | for (i = 0; i < e820->nr_map; i++) { |
1145 | struct e820entry *ei = &e820.map[i]; | 1174 | struct e820entry *ei = &e820->map[i]; |
1146 | 1175 | ||
1147 | end = ei->addr + ei->size; | 1176 | end = ei->addr + ei->size; |
1148 | if (end != (resource_size_t)end) | 1177 | if (end != (resource_size_t)end) |
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index de7501edb21c..18bb3a639197 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -555,7 +555,7 @@ intel_graphics_stolen(int num, int slot, int func, | |||
555 | 555 | ||
556 | /* Mark this space as reserved */ | 556 | /* Mark this space as reserved */ |
557 | e820_add_region(base, size, E820_RESERVED); | 557 | e820_add_region(base, size, E820_RESERVED); |
558 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 558 | sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); |
559 | } | 559 | } |
560 | 560 | ||
561 | static void __init intel_graphics_quirks(int num, int slot, int func) | 561 | static void __init intel_graphics_quirks(int num, int slot, int func) |
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index f2356bda2b05..3407b148c240 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c | |||
@@ -99,14 +99,14 @@ static int setup_e820_entries(struct boot_params *params) | |||
99 | { | 99 | { |
100 | unsigned int nr_e820_entries; | 100 | unsigned int nr_e820_entries; |
101 | 101 | ||
102 | nr_e820_entries = e820_saved.nr_map; | 102 | nr_e820_entries = e820_saved->nr_map; |
103 | 103 | ||
104 | /* TODO: Pass entries more than E820MAX in bootparams setup data */ | 104 | /* TODO: Pass entries more than E820MAX in bootparams setup data */ |
105 | if (nr_e820_entries > E820MAX) | 105 | if (nr_e820_entries > E820MAX) |
106 | nr_e820_entries = E820MAX; | 106 | nr_e820_entries = E820MAX; |
107 | 107 | ||
108 | params->e820_entries = nr_e820_entries; | 108 | params->e820_entries = nr_e820_entries; |
109 | memcpy(¶ms->e820_map, &e820_saved.map, | 109 | memcpy(¶ms->e820_map, &e820_saved->map, |
110 | nr_e820_entries * sizeof(struct e820entry)); | 110 | nr_e820_entries * sizeof(struct e820entry)); |
111 | 111 | ||
112 | return 0; | 112 | return 0; |
diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c index 80eab01c1a68..2408c1603438 100644 --- a/arch/x86/kernel/resource.c +++ b/arch/x86/kernel/resource.c | |||
@@ -27,8 +27,8 @@ static void remove_e820_regions(struct resource *avail) | |||
27 | int i; | 27 | int i; |
28 | struct e820entry *entry; | 28 | struct e820entry *entry; |
29 | 29 | ||
30 | for (i = 0; i < e820.nr_map; i++) { | 30 | for (i = 0; i < e820->nr_map; i++) { |
31 | entry = &e820.map[i]; | 31 | entry = &e820->map[i]; |
32 | 32 | ||
33 | resource_clip(avail, entry->addr, | 33 | resource_clip(avail, entry->addr, |
34 | entry->addr + entry->size - 1); | 34 | entry->addr + entry->size - 1); |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 0fa60f5f5a16..cc43d660c990 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -458,8 +458,8 @@ static void __init e820_reserve_setup_data(void) | |||
458 | early_memunmap(data, sizeof(*data)); | 458 | early_memunmap(data, sizeof(*data)); |
459 | } | 459 | } |
460 | 460 | ||
461 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 461 | sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); |
462 | memcpy(&e820_saved, &e820, sizeof(struct e820map)); | 462 | memcpy(e820_saved, e820, sizeof(struct e820map)); |
463 | printk(KERN_INFO "extended physical RAM map:\n"); | 463 | printk(KERN_INFO "extended physical RAM map:\n"); |
464 | e820_print_map("reserve setup_data"); | 464 | e820_print_map("reserve setup_data"); |
465 | } | 465 | } |
@@ -763,7 +763,7 @@ static void __init trim_bios_range(void) | |||
763 | */ | 763 | */ |
764 | e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); | 764 | e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); |
765 | 765 | ||
766 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 766 | sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); |
767 | } | 767 | } |
768 | 768 | ||
769 | /* called before trim_bios_range() to spare extra sanitize */ | 769 | /* called before trim_bios_range() to spare extra sanitize */ |
@@ -1032,7 +1032,7 @@ void __init setup_arch(char **cmdline_p) | |||
1032 | if (ppro_with_ram_bug()) { | 1032 | if (ppro_with_ram_bug()) { |
1033 | e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, | 1033 | e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, |
1034 | E820_RESERVED); | 1034 | E820_RESERVED); |
1035 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 1035 | sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); |
1036 | printk(KERN_INFO "fixed physical RAM map:\n"); | 1036 | printk(KERN_INFO "fixed physical RAM map:\n"); |
1037 | e820_print_map("bad_ppro"); | 1037 | e820_print_map("bad_ppro"); |
1038 | } | 1038 | } |
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index 654f6c66fe45..8402907825b0 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c | |||
@@ -188,12 +188,12 @@ static int tboot_setup_sleep(void) | |||
188 | 188 | ||
189 | tboot->num_mac_regions = 0; | 189 | tboot->num_mac_regions = 0; |
190 | 190 | ||
191 | for (i = 0; i < e820.nr_map; i++) { | 191 | for (i = 0; i < e820->nr_map; i++) { |
192 | if ((e820.map[i].type != E820_RAM) | 192 | if ((e820->map[i].type != E820_RAM) |
193 | && (e820.map[i].type != E820_RESERVED_KERN)) | 193 | && (e820->map[i].type != E820_RESERVED_KERN)) |
194 | continue; | 194 | continue; |
195 | 195 | ||
196 | add_mac_region(e820.map[i].addr, e820.map[i].size); | 196 | add_mac_region(e820->map[i].addr, e820->map[i].size); |
197 | } | 197 | } |
198 | 198 | ||
199 | tboot->acpi_sinfo.kernel_s3_resume_vector = | 199 | tboot->acpi_sinfo.kernel_s3_resume_vector = |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index d28a2d741f9e..167deae767cb 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -701,6 +701,8 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
701 | 701 | ||
702 | void free_initmem(void) | 702 | void free_initmem(void) |
703 | { | 703 | { |
704 | /* e820_reallocate_tables(); - disabled for now */ | ||
705 | |||
704 | free_init_pages("unused kernel", | 706 | free_init_pages("unused kernel", |
705 | (unsigned long)(&__init_begin), | 707 | (unsigned long)(&__init_begin), |
706 | (unsigned long)(&__init_end)); | 708 | (unsigned long)(&__init_end)); |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 1fbb408e2e72..2e3433444b65 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -166,7 +166,7 @@ static void __init do_add_efi_memmap(void) | |||
166 | } | 166 | } |
167 | e820_add_region(start, size, e820_type); | 167 | e820_add_region(start, size, e820_type); |
168 | } | 168 | } |
169 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 169 | sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); |
170 | } | 170 | } |
171 | 171 | ||
172 | int __init efi_memblock_x86_reserve_range(void) | 172 | int __init efi_memblock_x86_reserve_range(void) |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 176425233e4d..f8960fca0827 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -861,7 +861,7 @@ char * __init xen_memory_setup(void) | |||
861 | e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, | 861 | e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, |
862 | E820_RESERVED); | 862 | E820_RESERVED); |
863 | 863 | ||
864 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 864 | sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); |
865 | 865 | ||
866 | /* | 866 | /* |
867 | * Check whether the kernel itself conflicts with the target E820 map. | 867 | * Check whether the kernel itself conflicts with the target E820 map. |