From patchwork Tue Aug 15 12:50:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 110146 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp5439302obb; Tue, 15 Aug 2017 05:52:50 -0700 (PDT) X-Received: by 10.99.9.67 with SMTP id 64mr27684469pgj.12.1502801569964; Tue, 15 Aug 2017 05:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502801569; cv=none; d=google.com; s=arc-20160816; b=KsKJkKEOda0TbYhSkwNEe3nZLKL5O2seqa/0V/JiKdRsDRHK1fcMNhbUKfQTKhbapo nrB1l+h+zWbkdPF2Qxq1ilf60ncYMSjt/KVqq2q/hNCnGIyZ7LHJsPEPa+TOc8oiuDMd D75nAliLmx6cJ2YDLQlJ8VgBZT35RucS2QAQGJbF9zTahgFrWxIn86rTOudq/8hBS0GK KEZ9tTVGXQ7+EfSB63sVSKj5yryhKN4yMWnuBdem1cIAP575FrR5+q+qRtmzXPhu3UZL y5lL9SA2GJ4lVLElOWlC1vV7/G/qSj0XspLOBsnXNAdkPKL/CYz5+M1wwcLG5mHMXEFS kQzw== 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=xZxIgwWSIG+gEpPyUVmKMU91P/VJjpt3tlccCECSW+k=; b=njCdu1BTdDboNypT+BDox7lacBh/+N3H6wb65pZhXJ8ql/z6aCy+1lz+gl6bXdq0HA cVFTQtfKTk84tMyWyYtsVLz2wieaNgfGjciP8hHPzT9mWKdLFF6uRgqpJ670yYfdrKaD qMJCggj/u/6157vtg4COfblZeIOT53Ff+LKaGYQNMwBLhaN83tYWQLM98BwUhm+E6w19 1vN5DZ/ifyETAS317IC8qLrltMbzl6ezPvx2RquzdiA69JvH0Y8t7XeOCqrigMOJFIJG IX64VknTbuzrZ9G3oIHtw7SfjGX0jcL2RVY1Rn3IrPt39oEKE8Lmu87vexqcTafi8ucb +hiw== 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 y100si6239345plh.900.2017.08.15.05.52.49; Tue, 15 Aug 2017 05:52:49 -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 S1752751AbdHOMwr (ORCPT + 25 others); Tue, 15 Aug 2017 08:52:47 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:51466 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752664AbdHOMwn (ORCPT ); Tue, 15 Aug 2017 08:52:43 -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 AB085164F; Tue, 15 Aug 2017 05:52:42 -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 9897C3F540; Tue, 15 Aug 2017 05:52:40 -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 04/14] arm64: factor out PAGE_* and CONT_* definitions Date: Tue, 15 Aug 2017 13:50:39 +0100 Message-Id: <1502801449-29246-5-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 Some headers rely on PAGE_* definitions from , but cannot include this due to potential circular includes. For example, a number of definitions in rely on PAGE_SHIFT, and includes . This requires users of these definitions to include both headers, which is fragile and error-prone. This patch ameliorates matters by moving the basic definitions out to a new header, . Both and are updated to include this, avoiding this fragility, and avoiding the possibility of circular include dependencies. 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 | 1 + arch/arm64/include/asm/page-def.h | 34 ++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/page.h | 12 +----------- 3 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 arch/arm64/include/asm/page-def.h -- 1.9.1 diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 32f827233..77d55dc 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -25,6 +25,7 @@ #include #include #include +#include #include /* diff --git a/arch/arm64/include/asm/page-def.h b/arch/arm64/include/asm/page-def.h new file mode 100644 index 0000000..01591a2 --- /dev/null +++ b/arch/arm64/include/asm/page-def.h @@ -0,0 +1,34 @@ +/* + * Based on arch/arm/include/asm/page.h + * + * Copyright (C) 1995-2003 Russell King + * Copyright (C) 2017 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef __ASM_PAGE_DEF_H +#define __ASM_PAGE_DEF_H + +#include + +/* PAGE_SHIFT determines the page size */ +/* CONT_SHIFT determines the number of pages which can be tracked together */ +#define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT +#define CONT_SHIFT CONFIG_ARM64_CONT_SHIFT +#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#define CONT_SIZE (_AC(1, UL) << (CONT_SHIFT + PAGE_SHIFT)) +#define CONT_MASK (~(CONT_SIZE-1)) + +#endif /* __ASM_PAGE_DEF_H */ diff --git a/arch/arm64/include/asm/page.h b/arch/arm64/include/asm/page.h index 8472c6d..60d02c8 100644 --- a/arch/arm64/include/asm/page.h +++ b/arch/arm64/include/asm/page.h @@ -19,17 +19,7 @@ #ifndef __ASM_PAGE_H #define __ASM_PAGE_H -#include - -/* PAGE_SHIFT determines the page size */ -/* CONT_SHIFT determines the number of pages which can be tracked together */ -#define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT -#define CONT_SHIFT CONFIG_ARM64_CONT_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) - -#define CONT_SIZE (_AC(1, UL) << (CONT_SHIFT + PAGE_SHIFT)) -#define CONT_MASK (~(CONT_SIZE-1)) +#include #ifndef __ASSEMBLY__