aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/asm-x86/mm.h
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-06-10 08:18:33 +0100
committerKeir Fraser <keir@xen.org>2011-06-10 08:18:33 +0100
commit922626d29f48bb91824432533d872366919169f0 (patch)
tree70ab23328894a75f285143498dc028b6844f4a70 /xen/include/asm-x86/mm.h
parent3d948756835a327bce13b69c436ceeec75524a89 (diff)
downloadxen-922626d29f48bb91824432533d872366919169f0.tar.gz
xen-922626d29f48bb91824432533d872366919169f0.tar.bz2
xen-922626d29f48bb91824432533d872366919169f0.zip
x86: Disable set_gpfn_from_mfn until m2p table is allocated.
This is a prerequisite for calling set_gpfn_from_mfn() unconditionally from free_heap_pages(). Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/include/asm-x86/mm.h')
-rw-r--r--xen/include/asm-x86/mm.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index bc88a91ffb..40dbbf61e4 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -470,7 +470,7 @@ TYPE_SAFE(unsigned long,mfn);
#ifdef CONFIG_COMPAT
#define compat_machine_to_phys_mapping ((unsigned int *)RDWR_COMPAT_MPT_VIRT_START)
-#define set_gpfn_from_mfn(mfn, pfn) ({ \
+#define _set_gpfn_from_mfn(mfn, pfn) ({ \
struct domain *d = page_get_owner(__mfn_to_page(mfn)); \
unsigned long entry = (d && (d == dom_cow)) ? \
SHARED_M2P_ENTRY : (pfn); \
@@ -479,7 +479,7 @@ TYPE_SAFE(unsigned long,mfn);
machine_to_phys_mapping[(mfn)] = (entry)); \
})
#else
-#define set_gpfn_from_mfn(mfn, pfn) ({ \
+#define _set_gpfn_from_mfn(mfn, pfn) ({ \
struct domain *d = page_get_owner(__mfn_to_page(mfn)); \
if(d && (d == dom_cow)) \
machine_to_phys_mapping[(mfn)] = SHARED_M2P_ENTRY; \
@@ -487,6 +487,17 @@ TYPE_SAFE(unsigned long,mfn);
machine_to_phys_mapping[(mfn)] = (pfn); \
})
#endif
+
+/*
+ * Disable some users of set_gpfn_from_mfn() (e.g., free_heap_pages()) until
+ * the machine_to_phys_mapping is actually set up.
+ */
+extern bool_t machine_to_phys_mapping_valid;
+#define set_gpfn_from_mfn(mfn, pfn) do { \
+ if ( machine_to_phys_mapping_valid ) \
+ _set_gpfn_from_mfn(mfn, pfn); \
+} while (0)
+
#define get_gpfn_from_mfn(mfn) (machine_to_phys_mapping[(mfn)])
#define mfn_to_gmfn(_d, mfn) \