From patchwork Wed Jul 9 12:07:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 33286 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 870F5203F4 for ; Wed, 9 Jul 2014 12:09:00 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id ij19sf24188708vcb.6 for ; Wed, 09 Jul 2014 05:09:00 -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=XRDqD+aJrHrMY4ARIKj/NdgB6tR3IRFiGx0gTfTA9+A=; b=eXFreCHnjl1yhlLa+oSIsNLgIZaVmizmG9Dy3e4312iXaWBR162o9DWmwIGdTFiALg IDtLd31l1kQk9o1tp+g7UTUfZXsokNi3PTYvz4eApcXeACacJ6md8ruqheZpZKsIJyfA ZwsEf5UL9IUP5mvXI9qFTjjQYUIrh8dyjTyV97mVDnsyEuKAHjbAj+2gKuth31UaMTyB bHAKScP9kmXhnBmBB9DLasxIHNH3cbdUzsfVeOrFYb1+SAqvjCgBOSYd3q1BK8OjgUjL 0h2DtOkxoLZt9lD8xDSoGVwhbV4wk0S6lDqyqGY9CFcVK2NNHRM0vZf8eukoJeXe5PyY p8hw== X-Gm-Message-State: ALoCoQn5BoWjJIZuSlu0UxDMdfQ+Q6JZCAEzHy/eUjlu4aDvgdapWlSYEkVaaYgrC4T55D6yLpe/ X-Received: by 10.236.1.198 with SMTP id 46mr17143900yhd.16.1404907740235; Wed, 09 Jul 2014 05:09:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.18 with SMTP id q18ls2583754qgq.70.gmail; Wed, 09 Jul 2014 05:09:00 -0700 (PDT) X-Received: by 10.52.119.179 with SMTP id kv19mr32898562vdb.3.1404907740164; Wed, 09 Jul 2014 05:09:00 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id c2si21389816vcn.74.2014.07.09.05.09.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Jul 2014 05:09:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id la4so6952977vcb.0 for ; Wed, 09 Jul 2014 05:09:00 -0700 (PDT) X-Received: by 10.221.34.13 with SMTP id sq13mr15913173vcb.16.1404907740071; Wed, 09 Jul 2014 05:09:00 -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 tc5csp41876vcb; Wed, 9 Jul 2014 05:08:59 -0700 (PDT) X-Received: by 10.58.49.98 with SMTP id t2mr24307738ven.29.1404907739256; Wed, 09 Jul 2014 05:08:59 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ca9si10166355vdc.71.2014.07.09.05.08.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 09 Jul 2014 05:08:59 -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 1X4qfL-0006O8-N8; Wed, 09 Jul 2014 12:08:03 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X4qfE-0006Jp-1b for xen-devel@lists.xen.org; Wed, 09 Jul 2014 12:07:56 +0000 Received: from [85.158.139.211:13828] by server-13.bemta-5.messagelabs.com id 02/AC-02995-B903DB35; Wed, 09 Jul 2014 12:07:55 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1404907671!11171997!2 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 4777 invoked from network); 9 Jul 2014 12:07:54 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 9 Jul 2014 12:07:54 -0000 X-IronPort-AV: E=Sophos;i="5.01,631,1400025600"; d="scan'208";a="150929470" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 09 Jul 2014 12:07:55 +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; Wed, 9 Jul 2014 08:07:53 -0400 Received: from marilith-n13-p0.uk.xensource.com ([10.80.229.115] helo=localhost.localdomain) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1X4qfA-000112-Iu; Wed, 09 Jul 2014 13:07:53 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Wed, 09 Jul 2014 13:07:52 +0100 From: Ian Campbell To: Date: Wed, 9 Jul 2014 13:07:44 +0100 Message-ID: <1404907666-8594-6-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1404907608.16789.18.camel@kazak.uk.xensource.com> References: <1404907608.16789.18.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v5 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.220.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 --- v5: coding style 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 | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 8a6d295..cb22e9c 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 ) {