Commit b7a67e02 authored by Chen Yu's avatar Chen Yu Committed by Ingo Molnar

x86/boot/e820: Avoid overwriting e820_table_firmware

The following commit in 2013:

  77ea8c94 ("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: default avatarChen 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: default avatarIngo Molnar <mingo@kernel.org>
parent 99c13b8c
...@@ -669,6 +669,8 @@ void __init e820__memory_setup_extended(u64 phys_addr, u32 data_len) ...@@ -669,6 +669,8 @@ void __init e820__memory_setup_extended(u64 phys_addr, u32 data_len)
__append_e820_table(extmap, entries); __append_e820_table(extmap, entries);
e820__update_table(e820_table); e820__update_table(e820_table);
memcpy(e820_table_firmware, e820_table, sizeof(*e820_table_firmware));
early_memunmap(sdata, data_len); early_memunmap(sdata, data_len);
pr_info("e820: extended physical RAM map:\n"); pr_info("e820: extended physical RAM map:\n");
e820__print_table("extended"); e820__print_table("extended");
...@@ -923,13 +925,13 @@ void __init e820__reserve_setup_data(void) ...@@ -923,13 +925,13 @@ void __init e820__reserve_setup_data(void)
while (pa_data) { while (pa_data) {
data = early_memremap(pa_data, sizeof(*data)); data = early_memremap(pa_data, sizeof(*data));
e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN); e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
e820__range_update_firmware(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
pa_data = data->next; pa_data = data->next;
early_memunmap(data, sizeof(*data)); early_memunmap(data, sizeof(*data));
} }
e820__update_table(e820_table); e820__update_table(e820_table);
e820__update_table(e820_table_firmware);
memcpy(e820_table_firmware, e820_table, sizeof(*e820_table_firmware));
pr_info("extended physical RAM map:\n"); pr_info("extended physical RAM map:\n");
e820__print_table("reserve setup_data"); e820__print_table("reserve setup_data");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment