From patchwork Wed Feb 5 19:55:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 24227 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8E685202B2 for ; Wed, 5 Feb 2014 20:02:09 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id tp5sf31708ieb.3 for ; Wed, 05 Feb 2014 12:02:08 -0800 (PST) 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:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=8DbHZr+r9i5scfgiE/O5s26+KPPjrx4wnElfCEvz/o4=; b=m7o75+dJE54fAs4PV4vs1ERhG/BkFm7wE3LVbKNxz1sdLshGfZQOae2kcqWmpx4hEx jrSN5PRl2ObkKr6m9nTR9wSJCEMBcVHIstzoxq3CSpRWOXMS4cRQxAKiHMwthqj3i5y3 yrhcz6W5mULG2DDLhmtskLZTRcqqpMgxG27RucAl3x/MJcWxVDwcEWpohjyN3kMcRzyV q//f3YXMy80HtfyDXTAP0ohRTZsEIDgw6KpH+/TGYbt4FWz66vbua5XI9J01qcMapRZs zaImb/NfeV/b1bRidxbyWlclgH92iyoiOQgKO/codkhgE/oAJTe/LMwjP2W3kuCrQBbY mqng== X-Gm-Message-State: ALoCoQl96ED1r7jqmmpGAayRnpdqFQ7NNctSca+3JKcmY4P/mvE7dl45VGEzsA4Ea573oYY8c2sZ X-Received: by 10.43.79.196 with SMTP id zr4mr1343890icb.3.1391630528806; Wed, 05 Feb 2014 12:02:08 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.70 with SMTP id t64ls291858qge.1.gmail; Wed, 05 Feb 2014 12:02:08 -0800 (PST) X-Received: by 10.220.88.204 with SMTP id b12mr2196199vcm.3.1391630528680; Wed, 05 Feb 2014 12:02:08 -0800 (PST) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id uq6si10023659vcb.75.2014.02.05.12.02.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Feb 2014 12:02:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id cz12so727151veb.12 for ; Wed, 05 Feb 2014 12:02:08 -0800 (PST) X-Received: by 10.58.49.129 with SMTP id u1mr2299030ven.0.1391630528587; Wed, 05 Feb 2014 12:02:08 -0800 (PST) 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.220.174.196 with SMTP id u4csp82020vcz; Wed, 5 Feb 2014 12:02:08 -0800 (PST) X-Received: by 10.180.98.165 with SMTP id ej5mr3797973wib.33.1391630527641; Wed, 05 Feb 2014 12:02:07 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id n3si15744018wjr.169.2014.02.05.12.02.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Feb 2014 12:02:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB8bU-0006Ia-3J; Wed, 05 Feb 2014 19:57:49 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB8az-0007pL-7t; Wed, 05 Feb 2014 19:57:17 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB8aM-0007gR-Fk for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2014 19:56:43 +0000 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.166]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 3133F1401AF; Wed, 5 Feb 2014 13:55:57 -0600 (CST) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v3 05/11] ARM: LPAE: provide an IPA capable pmd_addr_end Date: Wed, 5 Feb 2014 19:55:45 +0000 Message-Id: <1391630151-7875-6-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1391630151-7875-1-git-send-email-marc.zyngier@arm.com> References: <1391630151-7875-1-git-send-email-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140205_145638_784893_D21F37EE X-CRM114-Status: UNSURE ( 8.69 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: catalin.marinas@arm.com, Christoffer Dall X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 The default pmd_addr_end macro uses an unsigned long to represent the VA. When used with KVM and stage-2 translation, the VA is actually an IPA, which is up to 40 bits. This also affect the SMMU driver, which also deals with stage-2 translation. Instead, provide an implementation that can cope with larger VAs by using a u64 instead. This version will overload the default one provided in include/asm-generic/pgtable.h. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/pgtable-3level.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h index 03243f7..594867b 100644 --- a/arch/arm/include/asm/pgtable-3level.h +++ b/arch/arm/include/asm/pgtable-3level.h @@ -262,6 +262,11 @@ static inline int has_transparent_hugepage(void) return 1; } +#define pmd_addr_end(addr, end) \ +({ u64 __boundary = ((addr) + PMD_SIZE) & PMD_MASK; \ + (__boundary - 1 < (end) - 1)? __boundary: (end); \ +}) + #endif /* __ASSEMBLY__ */ #endif /* _ASM_PGTABLE_3LEVEL_H */