[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 02/23] x86/mm: export get_page_from_mfn
It will be used later in multiple files. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/mm.c | 16 ---------------- xen/include/asm-x86/mm.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 8d2a4682c9..faa161b767 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -705,22 +705,6 @@ bool map_ldt_shadow_page(unsigned int offset) return true; } - -static bool get_page_from_mfn(mfn_t mfn, struct domain *d) -{ - struct page_info *page = mfn_to_page(mfn); - - if ( unlikely(!mfn_valid(mfn)) || unlikely(!get_page(page, d)) ) - { - gdprintk(XENLOG_WARNING, - "Could not get page ref for mfn %"PRI_mfn"\n", mfn_x(mfn)); - return false; - } - - return true; -} - - static int get_page_and_type_from_mfn( mfn_t mfn, unsigned long type, struct domain *d, int partial, int preemptible) diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index bef45e8e9f..7670912e0a 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -369,6 +369,20 @@ int get_page_from_l1e( l1_pgentry_t l1e, struct domain *l1e_owner, struct domain *pg_owner); void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner); +static inline bool get_page_from_mfn(mfn_t mfn, struct domain *d) +{ + struct page_info *page = __mfn_to_page(mfn_x(mfn)); + + if ( unlikely(!mfn_valid(mfn)) || unlikely(!get_page(page, d)) ) + { + gdprintk(XENLOG_WARNING, + "Could not get page ref for mfn %"PRI_mfn"\n", mfn_x(mfn)); + return false; + } + + return true; +} + static inline void put_page_and_type(struct page_info *page) { put_page_type(page); -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |