aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2014-06-02 12:58:01 -0400
committerDavid Vrabel <david.vrabel@citrix.com>2014-06-05 09:22:27 -0400
commitabacaadc4144a8849782cc0917a624a7114ffbb1 (patch)
treef9c47de717c40deb7b3ef1793b57b7e61ff5204b /arch
parent77945ca73e9a66cae25882fcab33ae0c6692763f (diff)
x86/xen: fix memory setup for PVH dom0
Since af06d66ee32b (x86: fix setup of PVH Dom0 memory map) in Xen, PVH dom0 need only use the memory memory provided by Xen which has already setup all the correct holes. xen_memory_setup() then ends up being trivial for a PVH guest so introduce a new function (xen_auto_xlated_memory_setup()). Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Tested-by: Roger Pau Monné <roger.pau@citrix.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/xen/enlighten.c5
-rw-r--r--arch/x86/xen/setup.c29
-rw-r--r--arch/x86/xen/xen-ops.h1
3 files changed, 34 insertions, 1 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 662bdcbbbd18..3123d1f74415 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1537,7 +1537,10 @@ asmlinkage void __init xen_start_kernel(void)
1537 if (!xen_pvh_domain()) 1537 if (!xen_pvh_domain())
1538 pv_cpu_ops = xen_cpu_ops; 1538 pv_cpu_ops = xen_cpu_ops;
1539 1539
1540 x86_init.resources.memory_setup = xen_memory_setup; 1540 if (xen_feature(XENFEAT_auto_translated_physmap))
1541 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
1542 else
1543 x86_init.resources.memory_setup = xen_memory_setup;
1541 x86_init.oem.arch_setup = xen_arch_setup; 1544 x86_init.oem.arch_setup = xen_arch_setup;
1542 x86_init.oem.banner = xen_banner; 1545 x86_init.oem.banner = xen_banner;
1543 1546
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 210426a26cc0..37cfbfacd59a 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -518,6 +518,35 @@ char * __init xen_memory_setup(void)
518} 518}
519 519
520/* 520/*
521 * Machine specific memory setup for auto-translated guests.
522 */
523char * __init xen_auto_xlated_memory_setup(void)
524{
525 static struct e820entry map[E820MAX] __initdata;
526
527 struct xen_memory_map memmap;
528 int i;
529 int rc;
530
531 memmap.nr_entries = E820MAX;
532 set_xen_guest_handle(memmap.buffer, map);
533
534 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
535 if (rc < 0)
536 panic("No memory map (%d)\n", rc);
537
538 sanitize_e820_map(map, ARRAY_SIZE(map), &memmap.nr_entries);
539
540 for (i = 0; i < memmap.nr_entries; i++)
541 e820_add_region(map[i].addr, map[i].size, map[i].type);
542
543 memblock_reserve(__pa(xen_start_info->mfn_list),
544 xen_start_info->pt_base - xen_start_info->mfn_list);
545
546 return "Xen";
547}
548
549/*
521 * Set the bit indicating "nosegneg" library variants should be used. 550 * Set the bit indicating "nosegneg" library variants should be used.
522 * We only need to bother in pure 32-bit mode; compat 32-bit processes 551 * We only need to bother in pure 32-bit mode; compat 32-bit processes
523 * can have un-truncated segments, so wrapping around is allowed. 552 * can have un-truncated segments, so wrapping around is allowed.
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index c834d4b231f0..97d87659f779 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -36,6 +36,7 @@ void xen_mm_unpin_all(void);
36void xen_set_pat(u64); 36void xen_set_pat(u64);
37 37
38char * __init xen_memory_setup(void); 38char * __init xen_memory_setup(void);
39char * xen_auto_xlated_memory_setup(void);
39void __init xen_arch_setup(void); 40void __init xen_arch_setup(void);
40void xen_enable_sysenter(void); 41void xen_enable_sysenter(void);
41void xen_enable_syscall(void); 42void xen_enable_syscall(void);