Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6127436ybi; Wed, 31 Jul 2019 08:47:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/bZPZlwk13HKF3oTPaR/imoXyzxUIKH2hQXjUnKFCz0ora0VbraGYHx3iQm1bjGV6oi6h X-Received: by 2002:a62:e308:: with SMTP id g8mr50371612pfh.162.1564588059527; Wed, 31 Jul 2019 08:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564588059; cv=none; d=google.com; s=arc-20160816; b=XdGDZxT59F15TNkq4RynlePerZ6QHUbhvMgoIgwCV44gOmb80hgH6F10yrup00t6DZ LQw6+IxFtLWmKXiWLGnnUOPdcZplN6ahZc39CiWOB16+MMfMasaxHZu4ja5pMhJC17AS PpTsTmeG+MIRhHKwZIyRrYSvghQE9urs5XehtSnzAroloqosGshAboQTKeKdxPOg0W00 a8X01Ewn1etaO0HQOBXUI/zaSAuvcExYvGWxVx4QG8Zmv2S21KzZzlF2BfBWZ27W53ZR mCPXAj5qIdI5U9SzMBX88UQ+szcZ1aLde/j/gEUHp00yGQtRnAqqBF6ON+8KXLa4PhhU f6DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ELwmRF22LLX0tCygT2lvRbCbwdd+dUVbxYOXSRLI/y4=; b=OQJkykyJrSYD5tnivX5LI2wHc7aC/2yAnNhN6GQkGfKK+PQH7a4UpZR+PsscIJuxSp eTog5NaIYUUJ1OLoj2qPgGC7s8I7lHxVq+l4pmM2BiSZPoj5AmFGRQLWdomcyBat5Ef1 afcOoD07UWaQvEg3eolaIYh+dQtjXgXOYMBO6U0DmOsCsynG2UxDb8MAIYhdtqCYaBJQ OmK0kJkqLG0vC5776041BnLf//o2wIHXgF4d5s1t5Ilk4XyVUIfr+w5k7A/Oa9IAnL69 jrn2i+5fqkP4beaBpyhL9vrnfXFFHjf7hl4MfTK2AeM4ZmLLLXqk2jni4bi3gXImplJT NCjw== 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 z9si1715950pju.2.2019.07.31.08.47.24; Wed, 31 Jul 2019 08:47:39 -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 S1727708AbfGaPq3 (ORCPT + 99 others); Wed, 31 Jul 2019 11:46:29 -0400 Received: from foss.arm.com ([217.140.110.172]:49620 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbfGaPq0 (ORCPT ); Wed, 31 Jul 2019 11:46:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6D1621570; Wed, 31 Jul 2019 08:46:26 -0700 (PDT) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6B6463F694; Wed, 31 Jul 2019 08:46:23 -0700 (PDT) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Andrew Morton , Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH v10 05/22] mips: mm: Add p?d_leaf() definitions Date: Wed, 31 Jul 2019 16:45:46 +0100 Message-Id: <20190731154603.41797-6-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731154603.41797-1-steven.price@arm.com> References: <20190731154603.41797-1-steven.price@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org walk_page_range() is going to be allowed to walk page tables other than those of user space. For this it needs to know when it has reached a 'leaf' entry in the page tables. This information is provided by the p?d_leaf() functions/macros. If _PAGE_HUGE is defined we can simply look for it. When not defined we can be confident that there are no leaf pages in existence and fall back on the generic implementation (added in a later patch) which returns 0. CC: Ralf Baechle CC: Paul Burton CC: James Hogan CC: linux-mips@vger.kernel.org Signed-off-by: Steven Price --- arch/mips/include/asm/pgtable.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 7d27194e3b45..238ca243ad31 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -627,6 +627,11 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#ifdef _PAGE_HUGE +#define pmd_leaf(pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0) +#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) +#endif + #define gup_fast_permitted(start, end) (!cpu_has_dc_aliases) #include -- 2.20.1