From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 5/6] xen: arm: add some helpers for assessing p2m pte Date: Tue, 10 Jun 2014 12:46:46 +0100 Message-ID: <1402400806.1250.63.camel@kazak.uk.xensource.com> References: <1402394127.29980.52.camel@kazak.uk.xensource.com> <1402394278-9850-5-git-send-email-ian.campbell@citrix.com> <5396EE10.8060804@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5396EE10.8060804@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: stefano.stabellini@eu.citrix.com, tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, 2014-06-10 at 12:37 +0100, Julien Grall wrote: > On 06/10/2014 10:57 AM, Ian Campbell wrote: > > 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 +161,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) ) > > Regardless the current check, I think this should be p2m_entry(pte) to > help code comprehension. > > Indeed, the can only get the address if the pte is pointed to a memory > block. Yes, but an L3 PTE has the table bit set, which would make p2m_entry(pte) false...