[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Add conversion from a xen map to an mfn



# HG changeset patch
# User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
# Date 1322760084 0
# Node ID 3075955bbea4bf9430a3b800ff157e99ad2d8fd0
# Parent  03279085a0f66856a4a495cdb525254dbc18ad54
x86: Add conversion from a xen map to an mfn

This conversion is a trivial invocation of virt_to_mfn in 64 bits.
In 32 bits it uses the linear_map.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
Signed-off-by: Tim Deegan <tim@xxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---


diff -r 03279085a0f6 -r 3075955bbea4 xen/arch/x86/x86_32/domain_page.c
--- a/xen/arch/x86/x86_32/domain_page.c Thu Dec 01 15:24:19 2011 +0000
+++ b/xen/arch/x86/x86_32/domain_page.c Thu Dec 01 17:21:24 2011 +0000
@@ -265,3 +265,15 @@
     idx = (__va - IOREMAP_VIRT_START) >> PAGE_SHIFT;
     set_bit(idx, garbage);
 }
+
+/* Translate a map-domain-page'd address to the underlying MFN */
+unsigned long domain_page_map_to_mfn(void *va)
+{
+    l1_pgentry_t *l1e;
+
+    ASSERT( (((unsigned long) va) >= MAPCACHE_VIRT_START) &&
+            (((unsigned long) va) <= MAPCACHE_VIRT_END) );
+    l1e = &__linear_l1_table[
+            l1_linear_offset((unsigned long) va)];
+    return l1e_get_pfn(*l1e);
+}
diff -r 03279085a0f6 -r 3075955bbea4 xen/include/xen/domain_page.h
--- a/xen/include/xen/domain_page.h     Thu Dec 01 15:24:19 2011 +0000
+++ b/xen/include/xen/domain_page.h     Thu Dec 01 17:21:24 2011 +0000
@@ -26,6 +26,12 @@
  */
 void unmap_domain_page(const void *va);
 
+
+/* 
+ * Given a VA from map_domain_page(), return its underlying MFN.
+ */
+unsigned long domain_page_map_to_mfn(void *va);
+
 /*
  * Similar to the above calls, except the mapping is accessible in all
  * address spaces (not just within the VCPU that created the mapping). Global
@@ -102,6 +108,7 @@
 #define map_domain_page(mfn)                mfn_to_virt(mfn)
 #define __map_domain_page(pg)               page_to_virt(pg)
 #define unmap_domain_page(va)               ((void)(va))
+#define domain_page_map_to_mfn(va)          virt_to_mfn((unsigned long)(va))
 
 #define map_domain_page_global(mfn)         mfn_to_virt(mfn)
 #define __map_domain_page_global(pg)        page_to_virt(pg)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.