From patchwork Wed Jun 11 16:40:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 31792 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5A6BB2054B for ; Wed, 11 Jun 2014 16:41:26 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rd18sf4583iec.2 for ; Wed, 11 Jun 2014 09:41:25 -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=TLdQO9zRFKq1pOCX3nJh4SIGstex8Ex3StIPsCmHLmVAFB3f4riWcDhxQWb7PLUYYX Z5YiMTwMNhTm9bM8ybVRYbzVkIJG9oZlB1OQxZo3yNVa31Gc7ASE7LKHC150zA+EFvy4 L5b+uiO5ZYWngs8prYkqenbaIXcO7NBujUK1b08+t3TbyAxX6k+Rz+gunqiTGqt3qoKP JUF3AUvnOyo7SLb+duyX+0ATfXNtrP1NH8e+QqSCeqXBj7vzXDe9ptbup1WbXil9wEGB tIX5a2Oe0SQQq9n7Zg/QpbNp0t6M8d5UPrybRzWT8vDJzEu3ER1Rg3VNZX1BYzXpASDJ o7pQ== X-Gm-Message-State: ALoCoQkBcHkWUJVkXuvMUjdmr7Ok4T0AsCp12CzRNpQEf+k9JvDcL+hmEFkq0uyip5vbkxs/oMiq X-Received: by 10.50.50.178 with SMTP id d18mr14483980igo.2.1402504885532; Wed, 11 Jun 2014 09:41:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.118 with SMTP id f109ls2472561qge.8.gmail; Wed, 11 Jun 2014 09:41:25 -0700 (PDT) X-Received: by 10.221.64.80 with SMTP id xh16mr3783922vcb.35.1402504885387; Wed, 11 Jun 2014 09:41:25 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id qi12si14355865vdb.82.2014.06.11.09.41.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 09:41:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jz11so1592veb.3 for ; Wed, 11 Jun 2014 09:41:25 -0700 (PDT) X-Received: by 10.220.85.1 with SMTP id m1mr3617729vcl.42.1402504885231; Wed, 11 Jun 2014 09:41:25 -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 vs6csp317888vcb; Wed, 11 Jun 2014 09:41:24 -0700 (PDT) X-Received: by 10.224.29.211 with SMTP id r19mr51985140qac.47.1402504884655; Wed, 11 Jun 2014 09:41:24 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id b3si32131221qam.38.2014.06.11.09.41.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 11 Jun 2014 09:41:24 -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 1WulZc-0001BD-0G; Wed, 11 Jun 2014 16:40:28 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WulZW-00015b-AT for xen-devel@lists.xen.org; Wed, 11 Jun 2014 16:40:22 +0000 Received: from [85.158.143.35:10150] by server-3.bemta-4.messagelabs.com id F9/10-13602-47688935; Wed, 11 Jun 2014 16:40:20 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-5.tower-21.messagelabs.com!1402504816!10734442!4 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 8502 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-5.tower-21.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="142556075" 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-0o; Wed, 11 Jun 2014 17:40:05 +0100 From: Ian Campbell To: Date: Wed, 11 Jun 2014 17:40:01 +0100 Message-ID: <1402504804-29173-5-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 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.172 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; }