From patchwork Tue Jul 1 08:26:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 32860 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D0634203C0 for ; Tue, 1 Jul 2014 08:29:27 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id jz11sf22709222veb.0 for ; Tue, 01 Jul 2014 01:29:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=vEFjvrNDUq82tUoJeJ7veakHxF88f7Qu3MRhnbwDsLY=; b=gzGAtUqo1yiGXYQXeE4EYOhpMhZW07croKY+jE5JVt5H3Erl0a0+6v1Be/B4cw4IIB yAnkfAJVPznLd7GNcSNhcRF6oHKr4Kv77watG72UgeiSxf0Fz53GrBtvGCHblnVOiaaY vJ30a6kJUkWpb0z3aYVo6XinkHK2b64QX8fLRtUw7LWdWCSLluqiSM2pGdfcG06qxcK4 0qYjRs38uREWDO6raOl/bZoqrOqJih297LHf2HS9bhyNKIFwgfCUZwmI751e8HyCIbOZ /Rs5xkoFM1GykujyLvHJ7UfOG+lwKtAS/1I373G2hhEZr3KyhMdhm01NdJpkbCKHb/CY sp4A== X-Gm-Message-State: ALoCoQnQM2PQ1oI6jnGIIQ4I0X3mE5I3xm3JoSreEwKbaDMpegDgS6Etn5PLSN3w7rPTcQojh1+d X-Received: by 10.236.165.230 with SMTP id e66mr2840507yhl.6.1404203367658; Tue, 01 Jul 2014 01:29:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.6 with SMTP id j6ls2048394qge.89.gmail; Tue, 01 Jul 2014 01:29:27 -0700 (PDT) X-Received: by 10.220.203.134 with SMTP id fi6mr33151853vcb.18.1404203367521; Tue, 01 Jul 2014 01:29:27 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id xt7si11137789veb.104.2014.07.01.01.29.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Jul 2014 01:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.169 as permitted sender) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so9417382veb.28 for ; Tue, 01 Jul 2014 01:29:27 -0700 (PDT) X-Received: by 10.58.76.225 with SMTP id n1mr115422vew.32.1404203367438; Tue, 01 Jul 2014 01:29:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp198718vcb; Tue, 1 Jul 2014 01:29:27 -0700 (PDT) X-Received: by 10.50.120.65 with SMTP id la1mr22688741igb.23.1404203366699; Tue, 01 Jul 2014 01:29:26 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id np2si15243265igb.30.2014.07.01.01.29.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 01 Jul 2014 01:29:26 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X1tPd-0000lN-SP; Tue, 01 Jul 2014 08:27:37 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X1tPc-0000ka-PX for xen-devel@lists.xen.org; Tue, 01 Jul 2014 08:27:36 +0000 Received: from [193.109.254.147:59545] by server-11.bemta-14.messagelabs.com id 49/5E-12767-8F072B35; Tue, 01 Jul 2014 08:27:36 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-7.tower-27.messagelabs.com!1404203251!14679715!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4632 invoked from network); 1 Jul 2014 08:27:34 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-7.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 1 Jul 2014 08:27:34 -0000 X-IronPort-AV: E=Sophos;i="5.01,580,1400025600"; d="scan'208";a="148822954" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 01 Jul 2014 08:27:03 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Tue, 1 Jul 2014 04:27:03 -0400 Received: from marilith-n13-p0.uk.xensource.com ([10.80.229.115] helo=marilith-n13.uk.xensource.com.) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1X1tP4-0008Hn-OA; Tue, 01 Jul 2014 09:27:02 +0100 From: Ian Campbell To: Date: Tue, 1 Jul 2014 09:26:59 +0100 Message-ID: <1404203222-30111-6-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1404202883.1829.125.camel@dagon.hellion.org.uk> References: <1404202883.1829.125.camel@dagon.hellion.org.uk> MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v4 6/8] xen: arm: add some helpers for assessing p2m pte X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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 --- v3: Use static functions. s/p2m_entry/p2m_mapping/ as its a better name. v2: clarify common on p2m_{table,entry} --- xen/arch/arm/p2m.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 8a6d295..b51dc1b 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -14,6 +14,22 @@ #define P2M_FIRST_ORDER 1 #define P2M_FIRST_ENTRIES (LPAE_ENTRIES<arch.p2m; @@ -139,13 +155,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 +172,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 +383,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 +400,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 +410,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 ) {