xen: use host E820 map for dom0
authorIan Campbell <ian.campbell@citrix.com>
Thu, 2 Sep 2010 15:16:00 +0000 (16:16 +0100)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Fri, 22 Oct 2010 20:19:19 +0000 (13:19 -0700)
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>
arch/x86/xen/setup.c

index 7a4ab05cff8ab8bd38c7082a1e42c7dcfe651d74..0ce9d58cb29d3dadb83fb0dcdd820492709fc7b5 100644 (file)
@@ -149,6 +149,7 @@ 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);
@@ -156,7 +157,10 @@ char * __init xen_memory_setup(void)
        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;
@@ -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";
 }