Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3138521ybg; Thu, 24 Oct 2019 22:53:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwt9ZuosIWG3ENj5kb3zZOg6ep/DOA7OdnjjNW2uXyytkPt0UelZWx54n7LWpTASUWLoqzP X-Received: by 2002:a50:c2c2:: with SMTP id u2mr2002392edf.133.1571982783279; Thu, 24 Oct 2019 22:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571982783; cv=none; d=google.com; s=arc-20160816; b=ZSFutGRh9jH/O6TEnIrQeb1RPT+gpiMsnqrEFQQw+1O2SLl0MaRxweXEzcGIsdLStX qHsN1divVxGv6tmKI2Qys7QHvPyizZmP4XYtCv2ODpCdoIpND7yJr2fgNmVxn4QnTqCW jTEbVEmf0OhkHqhqBhHsswGTA7q1ap0swLVc0f8Hg2DVAkPAdi0KnYY0vmtBKbaim/FW Xl3MK3OTPR43K/SDHBpE8hIbDHomahw3PB/bpddAOosVUrBxZIPES2fNd0IlzZoZLXOL dLse/KKcPRZAyy7MxFZ1ZNnG2hFyTgU7gj0GoD9WKgekKDx7gGWcbkeMK+9PThZ6lOyu M0Cg== 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=dZ9XXPU2jjxL34c8YS/tHpYjqPyXKm2evNHDnWEBB7I=; b=co5BI5RtS8BO9TuxV7hvDkT2PKX4ez497baoDent33JRXBYnWLBLGUdhgAzvuL4V8f Pky8wERzQpeCSo4zkAZnYcFR2lkZZ+mKVfSFrpXXZguAjKOubyV/yzzVT4/2XGOrzwRJ GPrQtJ+YlRHShFc4aPA0/FbOPxdwTh8UwHeCnf8DOEgkLfAXztoiREKyzzASWiM2qft1 y0X2qSgz8MiF4kyhsG484+nOMLsPLLJhM+XtS6vEsxQdXmSvLECqjUY41Ft1Z8Ibr4to TlaboGGjOdMnRXDs8um5ZULQAWsQrKUz3rtFyjMmZxXt6MMWOdLA8ZO3uI0z02Wt865i RqvA== 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 k20si599685edj.55.2019.10.24.22.52.26; Thu, 24 Oct 2019 22:53:03 -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 S2438602AbfJXJh7 (ORCPT + 99 others); Thu, 24 Oct 2019 05:37:59 -0400 Received: from foss.arm.com ([217.140.110.172]:44444 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438594AbfJXJh6 (ORCPT ); Thu, 24 Oct 2019 05:37:58 -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 C656C492; Thu, 24 Oct 2019 02:37:42 -0700 (PDT) Received: from e112269-lin.cambridge.arm.com (e112269-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C52B33F71F; Thu, 24 Oct 2019 02:37:39 -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 v13 05/22] mips: mm: Add p?d_leaf() definitions Date: Thu, 24 Oct 2019 10:36:59 +0100 Message-Id: <20191024093716.49420-6-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191024093716.49420-1-steven.price@arm.com> References: <20191024093716.49420-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 Acked-by: Paul Burton --- 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 f85bd5b15f51..fff392ea80c7 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -639,6 +639,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