x86/xen: Update e820 table handling to the new core x86 E820 code

Note that I restructured the Xen E820 logic a bit: instead of trying
to sort the boot parameters, only the kernel's E820 table is sorted.

This is how the x86 code does it and it reduces coupling between
the in-kernel E820 code and the (unchanged) boot parameters.

Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: <stefano.stabellini@eu.citrix.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2017-03-01 08:49:47 +01:00
parent 0871d5a66d
commit 687d77a5f7
1 changed files with 13 additions and 14 deletions

View File

@ -76,6 +76,7 @@
#include <asm/mwait.h>
#include <asm/pci_x86.h>
#include <asm/cpu.h>
#include <asm/e820/api.h>
#ifdef CONFIG_ACPI
#include <linux/acpi.h>
@ -1690,34 +1691,32 @@ static void __init init_pvh_bootparams(void)
memset(&pvh_bootparams, 0, sizeof(pvh_bootparams));
memmap.nr_entries = ARRAY_SIZE(pvh_bootparams.e820_map);
set_xen_guest_handle(memmap.buffer, pvh_bootparams.e820_map);
memmap.nr_entries = ARRAY_SIZE(pvh_bootparams.e820_table);
set_xen_guest_handle(memmap.buffer, pvh_bootparams.e820_table);
rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
if (rc) {
xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
BUG();
}
if (memmap.nr_entries < E820MAX - 1) {
pvh_bootparams.e820_map[memmap.nr_entries].addr =
if (memmap.nr_entries < E820_MAX_ENTRIES_ZEROPAGE - 1) {
pvh_bootparams.e820_table[memmap.nr_entries].addr =
ISA_START_ADDRESS;
pvh_bootparams.e820_map[memmap.nr_entries].size =
pvh_bootparams.e820_table[memmap.nr_entries].size =
ISA_END_ADDRESS - ISA_START_ADDRESS;
pvh_bootparams.e820_map[memmap.nr_entries].type =
E820_RESERVED;
pvh_bootparams.e820_table[memmap.nr_entries].type =
E820_TYPE_RESERVED;
memmap.nr_entries++;
} else
xen_raw_printk("Warning: Can fit ISA range into e820\n");
sanitize_e820_map(pvh_bootparams.e820_map,
ARRAY_SIZE(pvh_bootparams.e820_map),
&memmap.nr_entries);
pvh_bootparams.e820_entries = memmap.nr_entries;
for (i = 0; i < pvh_bootparams.e820_entries; i++)
e820_add_region(pvh_bootparams.e820_map[i].addr,
pvh_bootparams.e820_map[i].size,
pvh_bootparams.e820_map[i].type);
e820__range_add(pvh_bootparams.e820_table[i].addr,
pvh_bootparams.e820_table[i].size,
pvh_bootparams.e820_table[i].type);
e820__update_table(e820_table);
pvh_bootparams.hdr.cmd_line_ptr =
pvh_start_info.cmdline_paddr;