Skip to content

Commit

Permalink
xen: use host E820 map for dom0
Browse files Browse the repository at this point in the history
When running as initial domain, get the real physical memory map from
xen using the XENMEM_machine_memory_map hypercall and use it to setup
the e820 regions.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Ian Campbell authored and Jeremy Fitzhardinge committed Oct 22, 2010
1 parent 375b2a9 commit 9e9a5fc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions arch/x86/xen/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,18 @@ char * __init xen_memory_setup(void)
unsigned long extra_pages = 0;
unsigned long extra_limit;
int i;
int op;

max_pfn = min(MAX_DOMAIN_PAGES, max_pfn);
mem_end = PFN_PHYS(max_pfn);

memmap.nr_entries = E820MAX;
set_xen_guest_handle(memmap.buffer, map);

rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
op = xen_initial_domain() ?
XENMEM_machine_memory_map :
XENMEM_memory_map;
rc = HYPERVISOR_memory_op(op, &memmap);
if (rc == -ENOSYS) {
memmap.nr_entries = 1;
map[0].addr = 0ULL;
Expand Down Expand Up @@ -235,7 +239,8 @@ char * __init xen_memory_setup(void)
else
extra_pages = 0;

xen_add_extra_mem(extra_pages);
if (!xen_initial_domain())
xen_add_extra_mem(extra_pages);

return "Xen";
}
Expand Down

0 comments on commit 9e9a5fc

Please sign in to comment.