From patchwork Wed Jun 11 16:40:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 31794 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CF53B2054B for ; Wed, 11 Jun 2014 16:41:35 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id y20sf30912516ier.5 for ; Wed, 11 Jun 2014 09:41:35 -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=OuS8oqyNqBpKSzTYw+0Brnm37TN0HeBXd44T1W7oRP4=; b=QjdM7oU4KO5g3ciRvMOSzyastHu3qKeJk7GLRtNwVHtrMaXPZ53c5/pK/MRmuy3b0h DTpdVFCDIb7Popw7ZY5w8Ihvg4GS0/0QBQ5IC90Ev9rEA7bS9tfoezlYiAceeIG2+NWu hQ7wlgCeDlF92d9syMUcUtTkkZQEee3z4XnSqwFG64Td+hOcTBziSk2iJZsgOanzh4kL v1HVihoy3pIKy4hmnzgTOcFuTgFdF+JzTs1wXkykPWw5fxtMGWqfCUTlixOP6fCVycEC FlFVj5BWYGffBcOZ/gy5Am9guNk1YjCW17yXFjLJgaVTJs6zUEQYwzh+RUDiKGXOr0HD NR6Q== X-Gm-Message-State: ALoCoQm1BfjfMXC7d0oYVSvbcViFNIe0z8VAV5BpEJUOpjwjfUSdWQS72FNT3aclpZuzbcKQ3J8o X-Received: by 10.182.86.5 with SMTP id l5mr20119690obz.32.1402504895301; Wed, 11 Jun 2014 09:41:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.195 with SMTP id f61ls2512744qgf.59.gmail; Wed, 11 Jun 2014 09:41:35 -0700 (PDT) X-Received: by 10.58.77.9 with SMTP id o9mr1031410vew.69.1402504895153; Wed, 11 Jun 2014 09:41:35 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id t10si14400342ven.41.2014.06.11.09.41.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 09:41:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id us18so9453459veb.33 for ; Wed, 11 Jun 2014 09:41:35 -0700 (PDT) X-Received: by 10.221.58.144 with SMTP id wk16mr39459967vcb.23.1402504895070; Wed, 11 Jun 2014 09:41:35 -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.54.6 with SMTP id vs6csp317898vcb; Wed, 11 Jun 2014 09:41:34 -0700 (PDT) X-Received: by 10.140.33.181 with SMTP id j50mr50034384qgj.81.1402504894489; Wed, 11 Jun 2014 09:41:34 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id 110si31263412qgv.9.2014.06.11.09.41.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 11 Jun 2014 09:41:34 -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 1WulZY-00018t-HM; Wed, 11 Jun 2014 16:40:24 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WulZV-000159-Jh for xen-devel@lists.xen.org; Wed, 11 Jun 2014 16:40:21 +0000 Received: from [85.158.137.68:17570] by server-7.bemta-3.messagelabs.com id 73/FD-04151-47688935; Wed, 11 Jun 2014 16:40:20 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1402504818!9471676!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 15138 invoked from network); 11 Jun 2014 16:40:20 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-7.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 11 Jun 2014 16:40:20 -0000 X-IronPort-AV: E=Sophos;i="5.01,459,1400025600"; d="scan'208";a="142556076" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 11 Jun 2014 16:40:05 +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; Wed, 11 Jun 2014 12:40:05 -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 1WulZF-0004h3-1a; Wed, 11 Jun 2014 17:40:05 +0100 From: Ian Campbell To: Date: Wed, 11 Jun 2014 17:40:02 +0100 Message-ID: <1402504804-29173-6-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402504640.16332.50.camel@kazak.uk.xensource.com> References: <1402504640.16332.50.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 v2 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.174 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. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- v2: clarify common on p2m_{table,entry} --- xen/arch/arm/p2m.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 8a6d295..2a93ff9 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -14,6 +14,13 @@ #define P2M_FIRST_ORDER 1 #define P2M_FIRST_ENTRIES (LPAE_ENTRIES<arch.p2m; @@ -139,13 +146,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 +163,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 +374,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 +391,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 +401,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 ) {