From patchwork Wed Jul 12 22:32:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 107536 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1411659qge; Wed, 12 Jul 2017 15:34:19 -0700 (PDT) X-Received: by 10.84.237.8 with SMTP id s8mr6413364plk.163.1499898859612; Wed, 12 Jul 2017 15:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499898859; cv=none; d=google.com; s=arc-20160816; b=XuO4/976PtSkGw6cliH6uurrzAjJ0/RQq179QIZEmX3w/gBjtrVUD/ZpbZZupwbuyT 5yGSephZicti9DEZoH/7MTHEsul4TIsBe47UjkV1VZ9hiRENPsXjQMjLzw+T5DIVofER L7Q2ln83USl09XmqBH0Yj7ibhjvdf1jQyk09wvgMbxlORhOzvwIPRSmslmMNUeGA4Qoi 1/cnrXhNmLX/Ro6fpq/xbs2tB25yguRPJMIvH5YdmYxemOz0Rx7yLcGIhbNhsTO1gHxn Hdd1rC19uP34C9ObCf5z83XPn9pSaRAEkFxRu1Z0pZXElS2aY5f6MA4wBk9kAp2iu/7L oIMQ== 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=sTBRXUXcZSN6KKGRhyYJbKw/CSVp6UFy1fdfuNYKN4A=; b=TdKms7Wq5s8PzmUJmlpLGqOD1Sn7894nXT1cQTogwBAHGqZBUSY7nzXcooGn40RP2W 3RVZ51Xh1DKw5Ej8bD/KMgPLp2WLfHQ689CmnRpXHGNLqHxqiWMNwcdW4yW6Gxk5SU0K y+rEfDHaazpUVZK7gUxJEK08RVLYLg5oeKGbuxfmJ0kT4CBMAeQAG7uOEtxzWZR5iW71 uz9gKqvC05Dbgs38cwCMny6gRFTTlpaONfB3rZb0pJ0wUXBCh0WldaFB/qY0MSJiRofl hIanVD8mKkvhE3wIyzUWX6dGm2e6kfPKCx8nRD/gwiRG3Kcgy6x0fbyl4MkhIwGGR0is vTVw== 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 y2si2966209pli.72.2017.07.12.15.34.19; Wed, 12 Jul 2017 15:34:19 -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 S1752643AbdGLWeP (ORCPT + 25 others); Wed, 12 Jul 2017 18:34:15 -0400 Received: from foss.arm.com ([217.140.101.70]:59086 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbdGLWeO (ORCPT ); Wed, 12 Jul 2017 18:34:14 -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 ABCE515B2; Wed, 12 Jul 2017 15:34:08 -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 D36783F3E1; Wed, 12 Jul 2017 15:34:06 -0700 (PDT) From: Mark Rutland To: ard.biesheuvel@linaro.org, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: akashi.takahiro@linaro.org, catalin.marinas@arm.com, dave.martin@arm.com, james.morse@arm.com, labbott@fedoraproject.org, will.deacon@arm.com, keescook@chromium.org, Mark Rutland Subject: [RFC PATCH 2/6] arm64: avoid open-coding THREAD_SIZE{,_ORDER} Date: Wed, 12 Jul 2017 23:32:59 +0100 Message-Id: <1499898783-25732-3-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499898783-25732-1-git-send-email-mark.rutland@arm.com> References: <1499898783-25732-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 THREAD_SIZE_ORDER dependent on which arm64-specific page size kconfig symbol was selected. This is unfortunate, as it hides the relationship between THREAD_SIZE_ORDER and THREAD_SIZE, and makes it painful more painful than necessary to modify the thread size as we will need to do for some debug configurations. This patch follows arch/metag's approach of consistently defining THREAD_SIZE in terms of THREAD_SIZE_ORDER. This avoids having ifdefs for particular page size configurations, and allows us to change a single definition to change the thread size. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/thread_info.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 1.9.1 diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 141f13e9..6d0c59a 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -23,13 +23,17 @@ #include -#ifdef CONFIG_ARM64_4K_PAGES -#define THREAD_SIZE_ORDER 2 -#elif defined(CONFIG_ARM64_16K_PAGES) +#include + +#define THREAD_SHIFT 14 + +#if THREAD_SHIFT >= PAGE_SHIFT +#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) +#else #define THREAD_SIZE_ORDER 0 #endif -#define THREAD_SIZE 16384 +#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) #define THREAD_START_SP (THREAD_SIZE - 16) #ifndef __ASSEMBLY__