From patchwork Tue Aug 15 12:50:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 110148 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp5439500obb; Tue, 15 Aug 2017 05:53:02 -0700 (PDT) X-Received: by 10.99.109.140 with SMTP id i134mr27230561pgc.368.1502801581947; Tue, 15 Aug 2017 05:53:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502801581; cv=none; d=google.com; s=arc-20160816; b=giW4yAks7ZQGhq6NcqOYpZnM4US0SIX4il32+5MedlKQ+noUgS86TXrBUSDGHHQSWt +99J552+ToI5gq165tg2kx6bldgH+NuUAlVeiCtD7EWTIc5YUlWJ4/dHW+NIJmU299uP M8wdOquqc0zvyXLHI+DhHlo3/nVCG0PfcjuOJ4hgKQ/B6o+jR5x2qeLm5qckM6dHmQ4t PeXSsHQhIgu+JZDmM9kNw0YYybRy2y8895dEDElVMUTNDebBVu92Ty2sJkNvQI7u70Bs vdxjBrpL/2FOFrELQ3EbEYD+lse/dn0Qofm6NsIZvIo3DpOTN1GA7o6GmvRUQe1TF3Yp ocCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=HgCoibxZ1lZ9gSRAUQlmkEOdmHtP4bBo3iPD/JAEm/8=; b=udokWcPMfxF552PDfQMcuPdWqL/tWt2e9cdUQOQQkU8Li/2jltQxRO7GzR8Bg5bzgk JI19w0NPsXBg0ECMeptXaercjx23zuxgvarTcC6AyVelzelB5mHKprRfiGBqkLvlrmjK +vWn044SXCKgQ2j3VXXZtmgBnvYRd+QxXSGp2ZRNh7m4Jk9X2WtdJu155UDL6jYSj+DE NkDnMtpzSA6HQC1YrqqXQKt4MDJVu2UtjUmOx3vgESrwJXJ548OSwZLMRa0frPbh2uPY udf8PgaKvQ6TowUzAc0qq/Rb5AFy2IVhtAYABQ8ryocJqN9s0tAREbDXzsLIrzf2vkD0 rEQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u85si5497400pfi.252.2017.08.15.05.53.01; Tue, 15 Aug 2017 05:53:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbdHOMw7 (ORCPT + 25 others); Tue, 15 Aug 2017 08:52:59 -0400 Received: from foss.arm.com ([217.140.101.70]:51522 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752756AbdHOMwv (ORCPT ); Tue, 15 Aug 2017 08:52:51 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 594A41688; Tue, 15 Aug 2017 05:52:51 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 67C1D3F540; Tue, 15 Aug 2017 05:52:49 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: ard.biesheuvel@linaro.org, catalin.marinas@arm.com, james.morse@arm.com, labbott@redhat.com, linux-kernel@vger.kernel.org, luto@amacapital.net, mark.rutland@arm.com, matt@codeblueprint.co.uk, will.deacon@arm.com, kernel-hardening@lists.openwall.com, keescook@chromium.org Subject: [PATCHv2 07/14] arm64: move SEGMENT_ALIGN to Date: Tue, 15 Aug 2017 13:50:42 +0100 Message-Id: <1502801449-29246-8-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502801449-29246-1-git-send-email-mark.rutland@arm.com> References: <1502801449-29246-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently we define SEGMENT_ALIGN directly in our vmlinux.lds.S. This is unfortunate, as the EFI stub currently open-codes the same number, and in future we'll want to fiddle with this. This patch moves the definition to our , where it can be used by both vmlinux.lds.S and the EFI stub code. Signed-off-by: Mark Rutland Cc: Ard Biesheuvel Cc: Catalin Marinas Cc: James Morse Cc: Laura Abbott Cc: Will Deacon --- arch/arm64/include/asm/memory.h | 19 +++++++++++++++++++ arch/arm64/kernel/vmlinux.lds.S | 16 ---------------- 2 files changed, 19 insertions(+), 16 deletions(-) -- 1.9.1 diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 1fc2453..7fa6ad4 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -113,6 +113,25 @@ #define IRQ_STACK_SIZE THREAD_SIZE /* + * Alignment of kernel segments (e.g. .text, .data). + */ +#if defined(CONFIG_DEBUG_ALIGN_RODATA) +/* + * 4 KB granule: 1 level 2 entry + * 16 KB granule: 128 level 3 entries, with contiguous bit + * 64 KB granule: 32 level 3 entries, with contiguous bit + */ +#define SEGMENT_ALIGN SZ_2M +#else +/* + * 4 KB granule: 16 level 3 entries, with contiguous bit + * 16 KB granule: 4 level 3 entries, without contiguous bit + * 64 KB granule: 1 level 3 entry + */ +#define SEGMENT_ALIGN SZ_64K +#endif + +/* * Memory types available. */ #define MT_DEVICE_nGnRnE 0 diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 987a00e..7156538 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -72,22 +72,6 @@ PECOFF_FILE_ALIGNMENT = 0x200; #define PECOFF_EDATA_PADDING #endif -#if defined(CONFIG_DEBUG_ALIGN_RODATA) -/* - * 4 KB granule: 1 level 2 entry - * 16 KB granule: 128 level 3 entries, with contiguous bit - * 64 KB granule: 32 level 3 entries, with contiguous bit - */ -#define SEGMENT_ALIGN SZ_2M -#else -/* - * 4 KB granule: 16 level 3 entries, with contiguous bit - * 16 KB granule: 4 level 3 entries, without contiguous bit - * 64 KB granule: 1 level 3 entry - */ -#define SEGMENT_ALIGN SZ_64K -#endif - SECTIONS { /*