[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 1322749288 0
# Node ID 3bc4dfb54666196bd3309263768457f73c875d0c
# Parent  a06cda9fb25f2d7b7b5c7da170813e4a8bb0cd67
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>
Acked-by: Tim Deegan <tim@xxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---


diff -r a06cda9fb25f -r 3bc4dfb54666 xen/include/asm-x86/page.h
--- a/xen/include/asm-x86/page.h        Thu Dec 01 14:17:16 2011 +0000
+++ b/xen/include/asm-x86/page.h        Thu Dec 01 14:21:28 2011 +0000
@@ -272,6 +272,7 @@
 #define pfn_to_paddr(pfn)   __pfn_to_paddr(pfn)
 #define paddr_to_pfn(pa)    __paddr_to_pfn(pa)
 #define paddr_to_pdx(pa)    pfn_to_pdx(paddr_to_pfn(pa))
+#define xen_map_to_mfn(va)  __xen_map_to_mfn(va)
 
 #endif /* !defined(__ASSEMBLY__) */
 
diff -r a06cda9fb25f -r 3bc4dfb54666 xen/include/asm-x86/x86_32/page.h
--- a/xen/include/asm-x86/x86_32/page.h Thu Dec 01 14:17:16 2011 +0000
+++ b/xen/include/asm-x86/x86_32/page.h Thu Dec 01 14:21:28 2011 +0000
@@ -71,6 +71,17 @@
     return (void *)(ma + DIRECTMAP_VIRT_START);
 }
 
+static inline unsigned long __xen_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);
+}
+
 /* read access (should only be used for debug printk's) */
 typedef u64 intpte_t;
 #define PRIpte "016llx"
diff -r a06cda9fb25f -r 3bc4dfb54666 xen/include/asm-x86/x86_64/page.h
--- a/xen/include/asm-x86/x86_64/page.h Thu Dec 01 14:17:16 2011 +0000
+++ b/xen/include/asm-x86/x86_64/page.h Thu Dec 01 14:21:28 2011 +0000
@@ -104,6 +104,11 @@
                      ((ma & ma_top_mask) >> pfn_pdx_hole_shift)));
 }
 
+static inline unsigned long __xen_map_to_mfn(void *va)
+{
+    return (__virt_to_maddr((unsigned long) va) >> PAGE_SHIFT);
+}
+
 /* read access (should only be used for debug printk's) */
 typedef u64 intpte_t;
 #define PRIpte "016lx"

_______________________________________________
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®.