aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Yu <yu.c.chen@intel.com>2017-07-02 13:06:28 -0400
committerIngo Molnar <mingo@kernel.org>2017-07-05 04:09:02 -0400
commitb7a67e02cd2b0d632114dcfb4bfb9b1d85dee325 (patch)
tree7c6003415152325670d21279d8fb108cc602dc4f
parent99c13b8c8896d7bcb92753bf0c63a8de4326e78d (diff)
x86/boot/e820: Avoid overwriting e820_table_firmware
The following commit in 2013: 77ea8c948953 ("x86: Reserve setup_data ranges late after parsing memmap cmdline") has fixed the issue of losing setup_data information by deferring the e820_reserve_setup_data() call until the early params have been parsed. But this also introduced a new problem that, during early params parsing, the kexec kernel might fake a mptable and saves it into the e820_table_firmware[] table (without saving the mptable to the e820_table[]), however the subsequent invoking of e820_reserve_setup_data() will overwrite the e820_table_firmware[] according to the e820_table[], thus the fake mptable information is lost. Fix this issue by updating the e820_table_firmware[] according to the setup_data information, but without overwriting it. Signed-off-by: Chen Yu <yu.c.chen@intel.com> Cc: Dave Young <dyoung@redhat.com> Cc: Len Brown <lenb@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Xunlei Pang <xlpang@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/e820.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index d78a586ba8dc..c87223e5b1aa 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -669,6 +669,8 @@ void __init e820__memory_setup_extended(u64 phys_addr, u32 data_len)
669 __append_e820_table(extmap, entries); 669 __append_e820_table(extmap, entries);
670 e820__update_table(e820_table); 670 e820__update_table(e820_table);
671 671
672 memcpy(e820_table_firmware, e820_table, sizeof(*e820_table_firmware));
673
672 early_memunmap(sdata, data_len); 674 early_memunmap(sdata, data_len);
673 pr_info("e820: extended physical RAM map:\n"); 675 pr_info("e820: extended physical RAM map:\n");
674 e820__print_table("extended"); 676 e820__print_table("extended");
@@ -923,13 +925,13 @@ void __init e820__reserve_setup_data(void)
923 while (pa_data) { 925 while (pa_data) {
924 data = early_memremap(pa_data, sizeof(*data)); 926 data = early_memremap(pa_data, sizeof(*data));
925 e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN); 927 e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
928 e820__range_update_firmware(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
926 pa_data = data->next; 929 pa_data = data->next;
927 early_memunmap(data, sizeof(*data)); 930 early_memunmap(data, sizeof(*data));
928 } 931 }
929 932
930 e820__update_table(e820_table); 933 e820__update_table(e820_table);
931 934 e820__update_table(e820_table_firmware);
932 memcpy(e820_table_firmware, e820_table, sizeof(*e820_table_firmware));
933 935
934 pr_info("extended physical RAM map:\n"); 936 pr_info("extended physical RAM map:\n");
935 e820__print_table("reserve setup_data"); 937 e820__print_table("reserve setup_data");