From patchwork Thu Jun 26 10:17:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 32549 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5DDF52066E for ; Thu, 26 Jun 2014 10:19:16 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id rq2sf12707171pbb.10 for ; Thu, 26 Jun 2014 03:19:15 -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=GxmsB0k277J/nfvfMHEEQYzK83bjUGnrd+E94Jz00Yk=; b=G/mz3kVYxilTLITMnUexnhCjgw/BQWG9uiyXPv1OwGm4+Fc0LMgQ/Zirwnp9vF60nl phsB2DkxP+YU4WhcIi9s0uyzWKjr6LcEHhMwZHomViJEdudd+CMMyKgRl6wf6XUELpNR O020SplWs7/vCnHEmaQpCfiMOjvBI6Tf2rwdt0R245epKrK4eeA18GwxjAmU9q0itRwW gZdQMAcQBG3JzopjyPItI5SNL6STowHhnIgy16gPFbdJGf9gp7Ce6PDRaMiGa8NwIrW3 bCFqNic9vrekzI8ul69ZoaI+DooDmWydlu+vluT/AEEvgqpfblJCHWbZ7d6s2P6v8vVG d/Lw== X-Gm-Message-State: ALoCoQn12I6lJQse3Bv2JEBWCqRXI9pOfuBdiLBLRc7w3tTHyFPoZ3CMMBSfD7PcLa6C1QxyunFx X-Received: by 10.66.220.34 with SMTP id pt2mr7616579pac.8.1403777955677; Thu, 26 Jun 2014 03:19:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.245 with SMTP id j108ls155695qgf.51.gmail; Thu, 26 Jun 2014 03:19:15 -0700 (PDT) X-Received: by 10.58.210.168 with SMTP id mv8mr9465856vec.12.1403777955573; Thu, 26 Jun 2014 03:19:15 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id xl2si4073976vec.25.2014.06.26.03.19.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 03:19:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id i13so3374699veh.22 for ; Thu, 26 Jun 2014 03:19:15 -0700 (PDT) X-Received: by 10.52.253.131 with SMTP id aa3mr6428536vdd.25.1403777955498; Thu, 26 Jun 2014 03:19:15 -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 tc5csp19471vcb; Thu, 26 Jun 2014 03:19:15 -0700 (PDT) X-Received: by 10.42.122.208 with SMTP id o16mr12403229icr.39.1403777954911; Thu, 26 Jun 2014 03:19:14 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id fy1si1637661igd.33.2014.06.26.03.19.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 26 Jun 2014 03:19:14 -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 1X06k6-00065j-LX; Thu, 26 Jun 2014 10:17:22 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X06k5-000657-1Y for xen-devel@lists.xen.org; Thu, 26 Jun 2014 10:17:21 +0000 Received: from [85.158.143.35:58500] by server-1.bemta-4.messagelabs.com id 02/04-09496-033FBA35; Thu, 26 Jun 2014 10:17:20 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1403777838!5974012!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 12600 invoked from network); 26 Jun 2014 10:17:19 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-2.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 26 Jun 2014 10:17:19 -0000 X-IronPort-AV: E=Sophos;i="5.01,552,1400025600"; d="scan'208";a="147517489" 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-Jd; Thu, 26 Jun 2014 11:17:17 +0100 From: Ian Campbell To: Date: Thu, 26 Jun 2014 11:17:14 +0100 Message-ID: <1403777837-16779-5-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 5/8] xen: arm: handle superpage mappings in p2m_lookup 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.177 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: Currently none are actually created, but they will be shortly. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- xen/arch/arm/p2m.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index ea05b6d..8a6d295 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -123,6 +123,7 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr, p2m_type_t *t) struct p2m_domain *p2m = &d->arch.p2m; lpae_t pte, *first = NULL, *second = NULL, *third = NULL; paddr_t maddr = INVALID_PADDR; + paddr_t mask; p2m_type_t _t; /* Allow t to be NULL */ @@ -136,15 +137,21 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr, p2m_type_t *t) if ( !first ) goto err; + mask = FIRST_MASK; pte = first[first_table_offset(paddr)]; if ( !pte.p2m.valid || !pte.p2m.table ) 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 ) goto done; + mask = THIRD_MASK; + + BUILD_BUG_ON(THIRD_MASK != PAGE_MASK); + third = map_domain_page(pte.p2m.base); pte = third[third_table_offset(paddr)]; @@ -156,7 +163,7 @@ done: if ( pte.p2m.valid ) { ASSERT(pte.p2m.type != p2m_invalid); - maddr = (pte.bits & PADDR_MASK & PAGE_MASK) | (paddr & ~PAGE_MASK); + maddr = (pte.bits & PADDR_MASK & mask) | (paddr & ~mask); *t = pte.p2m.type; }