summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2010-10-29 11:28:33 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2010-10-29 11:28:33 +1100
commit3bc12290a0a8f5551ea1e473e73bff8b57ed458f (patch)
tree5988858e8c131fd5644f896641bbbd15bcd31ee0 /arch
parent028551fef7d5566af482ed0778e1267a5f9e1750 (diff)
parent5b6dd91e461dbb17b2bb43d15a638ea3b777e0db (diff)
Merge remote branch 'xen/upstream/xen'
Conflicts: arch/x86/xen/mmu.c
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/xen/setup.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 105db2501050..f0a74b8098fa 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -85,6 +85,22 @@ static unsigned long __init xen_release_chunk(phys_addr_t start_addr,
start = PFN_UP(start_addr);
end = PFN_DOWN(end_addr);
+ /*
+ * Domain 0 maintains a 1-1 P2M mapping for the first megabyte
+ * so do not return such memory to the hypervisor.
+ *
+ * This region can contain various firmware tables and the
+ * like which are often assumed to be always mapped and
+ * available via phys_to_virt.
+ */
+ if (xen_initial_domain()) {
+ if (end < PFN_DOWN(ISA_END_ADDRESS))
+ return 0;
+
+ if (start < PFN_DOWN(ISA_END_ADDRESS))
+ start = PFN_DOWN(ISA_END_ADDRESS);
+ }
+
if (end <= start)
return 0;
@@ -164,6 +180,7 @@ char * __init xen_memory_setup(void)
XENMEM_memory_map;
rc = HYPERVISOR_memory_op(op, &memmap);
if (rc == -ENOSYS) {
+ BUG_ON(xen_initial_domain());
memmap.nr_entries = 1;
map[0].addr = 0ULL;
map[0].size = mem_end;
@@ -201,12 +218,16 @@ char * __init xen_memory_setup(void)
}
/*
- * Even though this is normal, usable memory under Xen, reserve
- * ISA memory anyway because too many things think they can poke
- * about in there.
+ * Even though this is normal, usable memory in a Xen domU,
+ * reserve ISA memory anyway because too many things think
+ * they can poke about in there.
+ *
+ * In dom0 we use the host e820 and therefore do not need to
+ * specially reserved anything.
*/
- e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
- E820_RESERVED);
+ if (!xen_initial_domain())
+ e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
+ E820_RESERVED);
/*
* Reserve Xen bits: