From: Ian Campbell Date: Wed, 9 Jul 2014 12:07:44 +0000 (+0100) Subject: xen: arm: add some helpers for assessing p2m pte X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4691 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=000a2383613d55315d01e51112d2a9e13b6b08ae;p=xen.git xen: arm: add some helpers for assessing p2m pte Not terribly helpful right now, since they aren't widely used, but makes future patches easier to read. p2m_mapping is unused for the time-being and is therefore commented out (otherwise the compiler complains about an unused function). Signed-off-by: Ian Campbell Acked-by: Julien Grall --- diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 8a6d295ee8..cb22e9cbf3 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -14,6 +14,24 @@ #define P2M_FIRST_ORDER 1 #define P2M_FIRST_ENTRIES (LPAE_ENTRIES<arch.p2m; @@ -139,13 +157,13 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr, p2m_type_t *t) mask = FIRST_MASK; pte = first[first_table_offset(paddr)]; - if ( !pte.p2m.valid || !pte.p2m.table ) + if ( !p2m_table(pte) ) goto done; mask = SECOND_MASK; second = map_domain_page(pte.p2m.base); pte = second[second_table_offset(paddr)]; - if ( !pte.p2m.valid || !pte.p2m.table ) + if ( !p2m_table(pte) ) goto done; mask = THIRD_MASK; @@ -156,11 +174,11 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr, p2m_type_t *t) pte = third[third_table_offset(paddr)]; /* This bit must be one in the level 3 entry */ - if ( !pte.p2m.table ) + if ( !p2m_table(pte) ) pte.bits = 0; done: - if ( pte.p2m.valid ) + if ( p2m_valid(pte) ) { ASSERT(pte.p2m.type != p2m_invalid); maddr = (pte.bits & PADDR_MASK & mask) | (paddr & ~mask); @@ -367,7 +385,7 @@ static int apply_p2m_changes(struct domain *d, cur_first_page = p2m_first_level_index(addr); } - if ( !first[first_table_offset(addr)].p2m.valid ) + if ( !p2m_valid(first[first_table_offset(addr)]) ) { if ( !populate ) { @@ -384,7 +402,7 @@ static int apply_p2m_changes(struct domain *d, } } - BUG_ON(!first[first_table_offset(addr)].p2m.valid); + BUG_ON(!p2m_valid(first[first_table_offset(addr)])); if ( cur_first_offset != first_table_offset(addr) ) { @@ -394,7 +412,7 @@ static int apply_p2m_changes(struct domain *d, } /* else: second already valid */ - if ( !second[second_table_offset(addr)].p2m.valid ) + if ( !p2m_valid(second[second_table_offset(addr)]) ) { if ( !populate ) {