Commit abacaadc authored by David Vrabel's avatar David Vrabel

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: default avatarDavid Vrabel <david.vrabel@citrix.com>
Acked-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
Tested-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
parent 77945ca7
...@@ -1537,7 +1537,10 @@ asmlinkage void __init xen_start_kernel(void) ...@@ -1537,7 +1537,10 @@ asmlinkage void __init xen_start_kernel(void)
if (!xen_pvh_domain()) if (!xen_pvh_domain())
pv_cpu_ops = xen_cpu_ops; pv_cpu_ops = xen_cpu_ops;
x86_init.resources.memory_setup = xen_memory_setup; if (xen_feature(XENFEAT_auto_translated_physmap))
x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
else
x86_init.resources.memory_setup = xen_memory_setup;
x86_init.oem.arch_setup = xen_arch_setup; x86_init.oem.arch_setup = xen_arch_setup;
x86_init.oem.banner = xen_banner; x86_init.oem.banner = xen_banner;
......
...@@ -517,6 +517,35 @@ char * __init xen_memory_setup(void) ...@@ -517,6 +517,35 @@ char * __init xen_memory_setup(void)
return "Xen"; return "Xen";
} }
/*
* Machine specific memory setup for auto-translated guests.
*/
char * __init xen_auto_xlated_memory_setup(void)
{
static struct e820entry map[E820MAX] __initdata;
struct xen_memory_map memmap;
int i;
int rc;
memmap.nr_entries = E820MAX;
set_xen_guest_handle(memmap.buffer, map);
rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
if (rc < 0)
panic("No memory map (%d)\n", rc);
sanitize_e820_map(map, ARRAY_SIZE(map), &memmap.nr_entries);
for (i = 0; i < memmap.nr_entries; i++)
e820_add_region(map[i].addr, map[i].size, map[i].type);
memblock_reserve(__pa(xen_start_info->mfn_list),
xen_start_info->pt_base - xen_start_info->mfn_list);
return "Xen";
}
/* /*
* Set the bit indicating "nosegneg" library variants should be used. * Set the bit indicating "nosegneg" library variants should be used.
* We only need to bother in pure 32-bit mode; compat 32-bit processes * We only need to bother in pure 32-bit mode; compat 32-bit processes
......
...@@ -36,6 +36,7 @@ void xen_mm_unpin_all(void); ...@@ -36,6 +36,7 @@ void xen_mm_unpin_all(void);
void xen_set_pat(u64); void xen_set_pat(u64);
char * __init xen_memory_setup(void); char * __init xen_memory_setup(void);
char * xen_auto_xlated_memory_setup(void);
void __init xen_arch_setup(void); void __init xen_arch_setup(void);
void xen_enable_sysenter(void); void xen_enable_sysenter(void);
void xen_enable_syscall(void); void xen_enable_syscall(void);
......
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