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

[Xen-devel] [PATCH 03 of 11] arm: Implement get_page_from_gfn()



# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1336661656 -3600
# Node ID d774bb5c6326d1a7e88a3bfadc546d154a2ad895
# Parent  e03806b10f0026590e7775008f24d2a96051552e
arm: Implement get_page_from_gfn()

We will be calling this from common code, so add a basic
implementation to arch/arm.

After 4.2 we should reshuffle some of the p2m interface out of
arch/x86 into common headers; for now duplicate a little bit of it.

Signed-off-by: Tim Deegan <tim@xxxxxxx>

diff -r e03806b10f00 -r d774bb5c6326 xen/include/asm-arm/p2m.h
--- a/xen/include/asm-arm/p2m.h Thu May 10 15:54:16 2012 +0100
+++ b/xen/include/asm-arm/p2m.h Thu May 10 15:54:16 2012 +0100
@@ -53,6 +53,28 @@ p2m_pod_decrease_reservation(struct doma
                              xen_pfn_t gpfn,
                              unsigned int order);
 
+/* Look up a GFN and take a reference count on the backing page. */
+typedef int p2m_type_t;
+typedef unsigned int p2m_query_t;
+#define P2M_ALLOC    (1u<<0)   /* Populate PoD and paged-out entries */
+#define P2M_UNSHARE  (1u<<1)   /* Break CoW sharing */
+
+static inline struct page_info *get_page_from_gfn(
+    struct domain *d, unsigned long gfn, p2m_type_t *t, p2m_query_t q)
+{
+    struct page_info *page;
+    unsigned long mfn = gmfn_to_mfn(d, gfn);
+
+    ASSERT(t == NULL);
+
+    if (!mfn_valid(mfn))
+        return NULL;
+    page = mfn_to_page(mfn);
+    if ( !get_page(page, d) )
+        return NULL;
+    return page;
+}
+
 /* Compatibility function exporting the old untyped interface */
 static inline unsigned long get_gfn_untyped(struct domain *d, unsigned long 
gpfn)
 {

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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