From patchwork Mon Aug 7 18:35:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 109585 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1952633qge; Mon, 7 Aug 2017 11:38:25 -0700 (PDT) X-Received: by 10.99.173.6 with SMTP id g6mr1413063pgf.1.1502131105407; Mon, 07 Aug 2017 11:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502131105; cv=none; d=google.com; s=arc-20160816; b=sDC+YVFiPhV3Tk2z9rLGwTVNdXIixhWyKy8NhmZxd2DJVjTQ7yyq5sUFJs0Ow5ZjEi UPY4DpD5Sc/dpo1qxNO8yrB3kQn7yRdBC+SAz5dW5lbyfdTsnahrf3/OVqwpgAaXi5XN u190OlGPvZVqaUEopqdqiXJY8MgZwYWGs82lYNALse9blFHPHDuDaLraZHwTN5mCn0DC snBW1H1i+Rj6vchNAqDpBlebZMDzzLwAGaYis9KvuonxPJsQyJdQDg6FWx187mMjAoRU Q/i0/lPVmU5qcRcDugpYiGyK2ABr30BshApAFeRirPQaSbuINKaS/TXXPADFKN8PXDpf GlZA== 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=yJKISsgVl4HGTPASD+hTNs407uxySm+W+brL87+Ynpoxx9IpDGqGy2QUe9Bkm5n4mN EQ9nQiryhSFf5oB22PnvwCvEZ99w2GutU2wtBwRTmvlG5o3jaB2LijfBUHhMZd9TkHaR 7E81mEDlu25xPNETFt+HASXtVOOTNAlrJa3huGbIcwXru1h5AIotPNsUlcFDa2YgMRyG IFbDiTgP5qAORmPQPDk3m18drb04eaYGctnM/bw7DxvEAXlIMQxoC1ylXkczkthDOefO OD4mnPjm2pT5WH36808i9OXSwP2/r6PJKDkiACaDWUo6mNnqt0BiKjvX9v2XJ0cyzqV5 b49A== 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 b3si4879932pgc.821.2017.08.07.11.38.25; Mon, 07 Aug 2017 11:38:25 -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 S1752075AbdHGSiV (ORCPT + 25 others); Mon, 7 Aug 2017 14:38:21 -0400 Received: from foss.arm.com ([217.140.101.70]:52564 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbdHGSiS (ORCPT ); Mon, 7 Aug 2017 14:38:18 -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 0325A165C; Mon, 7 Aug 2017 11:38:18 -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 E30133F577; Mon, 7 Aug 2017 11:38:15 -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 04/14] arm64: factor out PAGE_* and CONT_* definitions Date: Mon, 7 Aug 2017 19:35:55 +0100 Message-Id: <1502130965-18710-5-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 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__