
Ian.Campbell at citrix
May 10, 2012, 8:21 AM
Post #2 of 2
(46 views)
Permalink
|
|
Re: [PATCH 03 of 11] arm: Implement get_page_from_gfn()
[In reply to]
|
|
On Thu, 2012-05-10 at 15:59 +0100, Tim Deegan wrote: > # HG changeset patch > # User Tim Deegan <tim [at] xen> > # 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 [at] xen> Acked-by: Ian Campbell <ian.campbell [at] citrix> Feel free to commit along with the rest of the series. Ian. > > 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 [at] lists > http://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel [at] lists http://lists.xen.org/xen-devel
|