Commit 738662c3 authored by Alex Thorlton's avatar Alex Thorlton Committed by Juergen Gross

xen/x86: Increase xen_e820_map to E820_X_MAX possible entries

On systems with sufficiently large e820 tables, and several IOAPICs, it
is possible for the XENMEM_machine_memory_map callback (and its
counterpart, XENMEM_memory_map) to attempt to return an e820 table with
more than 128 entries.  This callback adds entries to the BIOS-provided
e820 table to account for IOAPIC registers, which, on sufficiently large
systems, can result in an e820 table that is too large to copy back into
xen_e820_map.

This change simply increases the size of xen_e820_map to E820_X_MAX to
ensure that there is enough room to store the entire e820 map returned
from this callback.
Signed-off-by: default avatarAlex Thorlton <athorlton@sgi.com>
Suggested-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
parent 9d2f86c6
...@@ -41,7 +41,7 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata; ...@@ -41,7 +41,7 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
unsigned long xen_released_pages; unsigned long xen_released_pages;
/* E820 map used during setting up memory. */ /* E820 map used during setting up memory. */
static struct e820entry xen_e820_map[E820MAX] __initdata; static struct e820entry xen_e820_map[E820_X_MAX] __initdata;
static u32 xen_e820_map_entries __initdata; static u32 xen_e820_map_entries __initdata;
/* /*
...@@ -750,7 +750,7 @@ char * __init xen_memory_setup(void) ...@@ -750,7 +750,7 @@ char * __init xen_memory_setup(void)
max_pfn = min(max_pfn, xen_start_info->nr_pages); max_pfn = min(max_pfn, xen_start_info->nr_pages);
mem_end = PFN_PHYS(max_pfn); mem_end = PFN_PHYS(max_pfn);
memmap.nr_entries = E820MAX; memmap.nr_entries = ARRAY_SIZE(xen_e820_map);
set_xen_guest_handle(memmap.buffer, xen_e820_map); set_xen_guest_handle(memmap.buffer, xen_e820_map);
op = xen_initial_domain() ? op = xen_initial_domain() ?
...@@ -923,7 +923,7 @@ char * __init xen_auto_xlated_memory_setup(void) ...@@ -923,7 +923,7 @@ char * __init xen_auto_xlated_memory_setup(void)
int i; int i;
int rc; int rc;
memmap.nr_entries = E820MAX; memmap.nr_entries = ARRAY_SIZE(xen_e820_map);
set_xen_guest_handle(memmap.buffer, xen_e820_map); set_xen_guest_handle(memmap.buffer, xen_e820_map);
rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
......
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