From patchwork Thu Jun 26 10:17:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 32550 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BD2452066E for ; Thu, 26 Jun 2014 10:19:18 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf11374607pdi.2 for ; Thu, 26 Jun 2014 03:19:18 -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=FLISG3KcmRzZB6qgxGfGHrH25vjlXQDLmVEAQQ8WfakYMDHGNT7TrW82ATsGl/RSx6 BnN80kzOzpjGYnR3c60wMlIhxsJlB6VQg9aHj0kSpiaw5/a9Lzr+0bWD6F8Qux2Acx6r p2/09keoVXrWp5w5eeqTSgSDraU3sNgKcSxB/r6ccFjd3BqPAJTFzvvMswRAm5Q/d7BP yLIIfONProc35kS3wuhep4mQZiyGpUhqbCAzspAjVCZ4JnGVp/UtT/nKOVLhVKKTg0kU sTjrgLdR5DOIt001N/ZK1TOZOVyD1nTDwsBXsitqwU8rG7+FkQjeLY85Tcah6dLcvDca TeoA== X-Gm-Message-State: ALoCoQlxVMyXUKQ8bv5ObQw6wRpOOz3TogWkux1LwulSFGsHgwT2zuUC5ZSlJrH6BD/AlxecQt3u X-Received: by 10.66.220.34 with SMTP id pt2mr7616661pac.8.1403777958087; Thu, 26 Jun 2014 03:19:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.179 with SMTP id i48ls166678qge.82.gmail; Thu, 26 Jun 2014 03:19:18 -0700 (PDT) X-Received: by 10.58.29.234 with SMTP id n10mr12590063veh.16.1403777957989; Thu, 26 Jun 2014 03:19:17 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id om8si4051429vcb.90.2014.06.26.03.19.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 03:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id oy12so3396605veb.41 for ; Thu, 26 Jun 2014 03:19:17 -0700 (PDT) X-Received: by 10.53.12.229 with SMTP id et5mr10388311vdd.32.1403777957905; Thu, 26 Jun 2014 03:19:17 -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 tc5csp19472vcb; Thu, 26 Jun 2014 03:19:17 -0700 (PDT) X-Received: by 10.50.73.228 with SMTP id o4mr3101641igv.6.1403777957161; Thu, 26 Jun 2014 03:19:17 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id h5si1626628igq.54.2014.06.26.03.19.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 26 Jun 2014 03:19:17 -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 1X06k8-00067H-Oa; Thu, 26 Jun 2014 10:17:24 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X06k6-00065d-OP for xen-devel@lists.xen.org; Thu, 26 Jun 2014 10:17:22 +0000 Received: from [193.109.254.147:3557] by server-8.bemta-14.messagelabs.com id 6E/1B-01877-233FBA35; Thu, 26 Jun 2014 10:17:22 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1403777840!13847762!1 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 11904 invoked from network); 26 Jun 2014 10:17:21 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 26 Jun 2014 10:17:21 -0000 X-IronPort-AV: E=Sophos;i="5.01,552,1400025600"; d="scan'208";a="147517492" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 26 Jun 2014 10:17:18 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Thu, 26 Jun 2014 06:17:17 -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 1X06k1-0004Wh-KV; Thu, 26 Jun 2014 11:17:17 +0100 From: Ian Campbell To: Date: Thu, 26 Jun 2014 11:17:15 +0100 Message-ID: <1403777837-16779-6-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403777793.16595.21.camel@kazak.uk.xensource.com> References: <1403777793.16595.21.camel@kazak.uk.xensource.com> 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 v3 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.182 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 ) {