From patchwork Mon Aug 7 18:35:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 109595 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1954248qge; Mon, 7 Aug 2017 11:40:11 -0700 (PDT) X-Received: by 10.99.38.193 with SMTP id m184mr1386179pgm.322.1502131211346; Mon, 07 Aug 2017 11:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502131211; cv=none; d=google.com; s=arc-20160816; b=doDD+vjkCDkus//UTO2gaxXZbsudtESeELWfYoaiJVzxZl4ItEHFQEU8ybcMkubwxf 3jsTSuEPvnCii5vGjvIqE/gCNZ1lmDOBBnVAJItvtylGhz1VsGJgeNfjLQ/4vvh9IuZ4 c6pXGRLTTnfg4l+X7eNe6K1KiNAjftJvJZ561d0K62fGMFLszHrEsmg96ZfDrLZ6a0Ej 72RMSutNPXtLUVaD3xILszpohssW7l7xkJhqSqy4ujWQOAO+KgosDcGD2F5kqrpjDd7y XVW46eNHNXAXoGVqgNEtEvLowu2Gk4SWZ0XdJ9Jtl1nuHgfRpCKPE/yE5qHG4u71DIUA axHQ== 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=ykBWHqAz7LOeagjGCK2zEKLuU8jIyfgIVSblve6k10f1EcwxFu7Z/vY0S/dSyOLYvI iszROeykFzSelrJQPEqUIai85j7sOgv2VgMF2P5yjZU4Jwoe1H/JEI/SIKdHMbnOCtJU mERXdPlkOrdSGYCsBrEF2LtddTlivJs7dv2OIkY9ySWY1W/FfK19BjE+j16owsDhAdpg KOc0LoLBFeA9jX9EmVvKNuOZC63AnzEh90y7dTM/Wu48YF8kCpW69bWoSnpYHQDOR19J v/EwfziZJuSrKirgNOO3X+F5VR1tNDf3sVedIRRxaNU+mG8nPkj+K3U1fxaLgppo5KhY GzOw== 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 c66si2595376pga.312.2017.08.07.11.40.11; Mon, 07 Aug 2017 11:40:11 -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 S1752330AbdHGSkI (ORCPT + 25 others); Mon, 7 Aug 2017 14:40:08 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52630 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752107AbdHGSi0 (ORCPT ); Mon, 7 Aug 2017 14:38:26 -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 207E416A0; Mon, 7 Aug 2017 11:38:26 -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 319073F577; Mon, 7 Aug 2017 11:38:24 -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: [PATCH 07/14] arm64: move SEGMENT_ALIGN to Date: Mon, 7 Aug 2017 19:35:58 +0100 Message-Id: <1502130965-18710-8-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502130965-18710-1-git-send-email-mark.rutland@arm.com> References: <1502130965-18710-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 { /*