[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/8] xen/arm: p2m: Add p2m_get_entry
Reuse the code of p2m_lookup and add an argument to retrieve the p2m type. Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx> --- xen/arch/arm/p2m.c | 11 ++++++++++- xen/include/asm-arm/p2m.h | 7 ++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 5449a35..1ae2521 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -71,11 +71,17 @@ static lpae_t *p2m_map_first(struct p2m_domain *p2m, paddr_t addr) * There are no processor functions to do a stage 2 only lookup therefore we * do a a software walk. */ -paddr_t p2m_lookup(struct domain *d, paddr_t paddr) +paddr_t p2m_get_entry(struct domain *d, paddr_t paddr, p2m_type_t *t) { struct p2m_domain *p2m = &d->arch.p2m; lpae_t pte, *first = NULL, *second = NULL, *third = NULL; paddr_t maddr = INVALID_PADDR; + p2m_type_t _t; + + /* Allow t to be NULL */ + t = t ?: &_t; + + *t = p2m_invalid; spin_lock(&p2m->lock); @@ -99,7 +105,10 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr) done: if ( pte.p2m.valid ) + { maddr = (pte.bits & PADDR_MASK & PAGE_MASK) | (paddr & ~PAGE_MASK); + *t = pte.p2m.avail; + } if (third) unmap_domain_page(third); if (second) unmap_domain_page(second); diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 1cf7d36..3de69c4 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -49,7 +49,12 @@ int p2m_alloc_table(struct domain *d); void p2m_load_VTTBR(struct domain *d); /* Look up the MFN corresponding to a domain's PFN. */ -paddr_t p2m_lookup(struct domain *d, paddr_t gpfn); +paddr_t p2m_get_entry(struct domain *d, paddr_t gpfn, p2m_type_t *t); + +static inline paddr_t p2m_lookup(struct domain *d, paddr_t gpfn) +{ + return p2m_get_entry(d, gpfn, NULL); +} /* Setup p2m RAM mapping for domain d from start-end. */ int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |