Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp761113ybl; Fri, 6 Dec 2019 05:54:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxjCqUcEbeTr6NsXqRADmVSc6K1q37FPVvft52WR5mLCnL80q6cynKoy8VMnLoR0GjlOTWq X-Received: by 2002:a05:6830:54a:: with SMTP id l10mr10525221otb.249.1575640488037; Fri, 06 Dec 2019 05:54:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575640488; cv=none; d=google.com; s=arc-20160816; b=ESCWRPj9Xs7nzUwvceBfcyvdzFtnxNxpoDklQbnOcAQ9qtEOQNHdYPNu/Vl7huU0Vz UvhRulIPDjQ2lkm7rh4YJ7ZwGOTMbPwF/FdKoTQ2We0F+/b2JvzcC50AKMX9fDS1HMKJ sHPXn7eklMqSgSoqWNLeuO+ZRPcBpKYqzTL+Bn6cTm1iG8Szs0TPsyfYaDg+xejusb9d 1aLlrX72Tl+amgDufS+q0KyTASPwj7oiTryMBeEoHpz7QupJcfNhiuRVipOuO8N39OJp M+fnUzxkIpsbDt1hG5TPNsyveH3ij1G7ExwbiVhx90cFL057PWI9SpHaukHodKCBygrw KnEA== 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=dutLxQaCe+IbeIq836Hhxr0lbxkvf4qF1IyAp7mcvxE=; b=NGQhdI6Mq03h6/0lfdXPb0EVw69LFdJm0hcWKglzDDHhaS18h7Ogr2IRQYfJFgnsCI gOQqL5XVKpN73MLCkvjtdoA4Eg2nuYsf9c8E9BTieL5W7PHXjM61HtMHdiqI6u8rIjyt v+dzPZtkPXyzgdbgKPJfxTExd9ovwsmEzHzxA/cllEs74KbymR6aOM0WanSn6XRPQRLK JX5xUk+RJmCXb2jxUbdkOqKGL4l/FdXruEuGiFWvJ4LtpmCUYVNd/IBmW5ce1CH1cVTQ TtuTx2sWnv6RLWCpcQAio3prwZ3pzQJ03MfubPurvwyTkKHUcu0lVj79H7cWtgyNOc4B 0abA== 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 v67si6610077oia.26.2019.12.06.05.54.36; Fri, 06 Dec 2019 05:54:48 -0800 (PST) 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 S1726511AbfLFNx7 (ORCPT + 99 others); Fri, 6 Dec 2019 08:53:59 -0500 Received: from foss.arm.com ([217.140.110.172]:44498 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726395AbfLFNx6 (ORCPT ); Fri, 6 Dec 2019 08:53:58 -0500 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 8E0B3DA7; Fri, 6 Dec 2019 05:53:57 -0800 (PST) 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 982473F718; Fri, 6 Dec 2019 05:53:54 -0800 (PST) From: Steven Price To: Andrew Morton , 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" , Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH v16 05/25] mips: mm: Add p?d_leaf() definitions Date: Fri, 6 Dec 2019 13:52:56 +0000 Message-Id: <20191206135316.47703-6-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191206135316.47703-1-steven.price@arm.com> References: <20191206135316.47703-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 91b89aab1787..aef5378f909c 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