|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1 05/13] xen/arm: introduce get_pages_from_gfn
From: Penny Zheng <penny.zheng@xxxxxxx>
In order to getting statically shared pages based on gfn with nr_pages, this
commit introduces a new helper get_pages_from_gfn to acquire a set of pages
based on [gfn, gfn + nr_gfns), with the same P2M type.
Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
---
xen/arch/arm/include/asm/p2m.h | 37 ++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h
index 58590145b0..b23024b9a1 100644
--- a/xen/arch/arm/include/asm/p2m.h
+++ b/xen/arch/arm/include/asm/p2m.h
@@ -370,6 +370,43 @@ static inline struct page_info *get_page_from_gfn(
return page;
}
+static inline int get_pages_from_gfn(struct domain *d, unsigned long gfn,
+ unsigned long nr_gfns,
+ struct page_info **pages, p2m_type_t *t,
+ p2m_query_t q)
+{
+ p2m_type_t _t;
+ unsigned long i = 0;
+ int ret = 0;
+
+ for ( ; i < nr_gfns; i++ )
+ {
+ pages[i] = get_page_from_gfn(d, gfn + i, t, q);
+
+ if ( !pages[i] )
+ {
+ ret = -ENOENT;
+ goto fail_get;
+ }
+
+ if ( i == 0 )
+ _t = *t;
+ /* Check if all pages share the same p2m type. */
+ else if ( *t != _t )
+ {
+ ret = -EINVAL;
+ goto fail_get;
+ }
+ }
+
+ return ret;
+
+ fail_get:
+ while( --i >= 0 )
+ put_page(pages[i]);
+ return ret;
+}
+
int get_page_type(struct page_info *page, unsigned long type);
bool is_iomem_page(mfn_t mfn);
static inline int get_page_and_type(struct page_info *page,
--
2.25.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |