From patchwork Wed Oct 12 11:23:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77549 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp401615qge; Wed, 12 Oct 2016 04:26:45 -0700 (PDT) X-Received: by 10.98.64.76 with SMTP id n73mr933914pfa.33.1476271605442; Wed, 12 Oct 2016 04:26:45 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id f17si7388419pag.87.2016.10.12.04.26.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Oct 2016 04:26:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1buHfG-0005kE-5U; Wed, 12 Oct 2016 11:25:38 +0000 Received: from mail-qt0-f181.google.com ([209.85.216.181]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1buHf5-0004QF-66 for linux-arm-kernel@lists.infradead.org; Wed, 12 Oct 2016 11:25:29 +0000 Received: by mail-qt0-f181.google.com with SMTP id s49so12236476qta.0 for ; Wed, 12 Oct 2016 04:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gqMkXJiBdwebiJVsfUrm2JMFFaYVVPlzb4eNJNVg50c=; b=CF2mptcMq05Q0Wj9hH4mxwyINl0ZnMCWEvxGnoXr6sBmRsH0uu8E0VkdhqAegehq++ 94mKkhZO58LfMXYd8aT5Zig9OpDLeQ3ARx14YQiSoc1Z+UM6O/440nbZjFMjdkWFdXAC DQcgEsMDwFnreM0P2uhrH8+rrqGLyKmi6aV4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gqMkXJiBdwebiJVsfUrm2JMFFaYVVPlzb4eNJNVg50c=; b=X17tQjcb0A0QnUdWRroi3euLdMRuCXlJtW63av4DG3Yf6nQv6EnR4PK6DGm78IY+vw oDjt0U2VaqmFhQka1vzcAlZqLpCrvXnXCjaVRr3CaBzvCiPhKCLC1W39Sr+bTQpSh0X4 TZQDpV28/NEZ3ClPxGXFlQ11o9tnLYAuL+PPoaiGu0C6Q9drdo7G2DaB41guSGhsBkBx 4kUMrzxC8DE75AQaKHHAREufsTSlzyJfrCBtKSVe5bdsMC/FQ/XjXi+jYg3q0Gc2LUdM /qTcTzwikjy/4r7MbggrqTvApEOhHuOtslirHjSC3mOPotvqEfMgwwMBzuEwVCqqKxed oEWA== X-Gm-Message-State: AA6/9RmCVVgKiSgJDoh/GvBwuZYFskTWi5Ke+C8MozrNDnkAicAovEQvpk6fBUBYvOb9m1a3 X-Received: by 10.194.171.225 with SMTP id ax1mr824072wjc.48.1476271445950; Wed, 12 Oct 2016 04:24:05 -0700 (PDT) Received: from localhost.localdomain ([196.67.25.208]) by smtp.gmail.com with ESMTPSA id jt8sm12034690wjc.33.2016.10.12.04.24.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Oct 2016 04:24:05 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH v3 5/5] arm64: mm: round memstart_addr to contiguous PUD/PMD size Date: Wed, 12 Oct 2016 12:23:45 +0100 Message-Id: <1476271425-19401-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476271425-19401-1-git-send-email-ard.biesheuvel@linaro.org> References: <1476271425-19401-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161012_042527_512159_D3BE32B3 X-CRM114-Status: GOOD ( 11.55 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.181 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.216.181 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: steve.capper@linaro.org, jeremy.linton@arm.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Given that contiguous PUDs/PMDs allow the linear region to be mapped more efficiently, ensure that the relative alignment between the linear virtual and physical mappings of system RAM are equal modulo the contiguous PUD size (or contiguous PMD size, for 16k/64k granule size). Note that this reduces the KASLR randomization of the linear range by PUD_SHIFT (or PMD_SHIFT) bits. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/kernel-pgtable.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h index 7e51d1b57c0c..71dbd9e1e809 100644 --- a/arch/arm64/include/asm/kernel-pgtable.h +++ b/arch/arm64/include/asm/kernel-pgtable.h @@ -83,16 +83,13 @@ /* * To make optimal use of block mappings when laying out the linear * mapping, round down the base of physical memory to a size that can - * be mapped efficiently, i.e., either PUD_SIZE (4k granule) or PMD_SIZE - * (64k granule), or a multiple that can be mapped using contiguous bits - * in the page tables: 32 * PMD_SIZE (16k granule) + * be mapped efficiently, i.e., either CONT_PUD_SIZE (4k granule) or + * CONT_PMD_SIZE (16k/64k granules) */ #if defined(CONFIG_ARM64_4K_PAGES) -#define ARM64_MEMSTART_SHIFT PUD_SHIFT -#elif defined(CONFIG_ARM64_16K_PAGES) -#define ARM64_MEMSTART_SHIFT (PMD_SHIFT + 5) +#define ARM64_MEMSTART_SHIFT (PUD_SHIFT + CONT_PUD_SHIFT) #else -#define ARM64_MEMSTART_SHIFT PMD_SHIFT +#define ARM64_MEMSTART_SHIFT (PMD_SHIFT + CONT_PMD_SHIFT) #endif /*