Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1729068ybg; Sat, 19 Oct 2019 01:13:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRQ13m/9ngOct+qOivgPs/KoV2BWWLxdJbuSwVUUGqCQIpR9H+wU2mHS4p5ghrmy3LVdLX X-Received: by 2002:a50:afa1:: with SMTP id h30mr9744934edd.126.1571472835330; Sat, 19 Oct 2019 01:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472835; cv=none; d=google.com; s=arc-20160816; b=avUfcm6r971cF+47b93Mf03PXlh/GsvRhsK0VzdHoiQcGhyzYngDRuS1V9N806DBAW RCoEd3gZFZDiJNPRnastWgfOBWwFaLRkvDQd9Ka7/egCgFaRwForJxvxOezLoSMmOOLf beCYCAgTJSKSpoNV+7v9mslEfv6BPKUcSBUn2wNbiVsMUCTVI+uFRHoh0NOICkfA9m/M IXSYzSOeLEJ6ukjuRtoLqd2CiKm3g3UEYQFJncqfgTY8JD4kIkGa2/uLceb8XdSFqqCa +AC5YBHTyKf7+UKM3MRI3Ekx0BJ2PfXKOEvAQtIDavGsW15Xqs6hvcexn/HWvKdgJdZt tFpQ== 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=M48TcJ2ct+UjyMaGrnSy68mExOgrmiKl6tWjOIuRYlmLqGEx+uLwJ8l8xfDGoFthti wDO/jANoSqgVTvXRS65Qflwf1KGtLlXa20FXacgpcDOmb3qm0uha+Zi2uIWvhjfWzMWi ZbTAgaQ1YFOtSsNRQMiLgZDok0ztVclmKn6Y8Lb1gho8fOnA2Kje8M8pgE+f/xHZY9hQ E6uODSx6OsDLN8BbfUzwNsvNsLr01IbHfb9jySWPngjR1wMcogVcxD1fsXSJP67Thk5b hGJkH7qAat0IAiJ9DOlMLan2+maVIa99Sn5+EEyIO7wdVg6Y5eoriZ6gtu2qpKarfWes vWlQ== 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 x19si4818549eju.15.2019.10.19.01.13.32; Sat, 19 Oct 2019 01:13:55 -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 S2405191AbfJRKPF (ORCPT + 99 others); Fri, 18 Oct 2019 06:15:05 -0400 Received: from [217.140.110.172] ([217.140.110.172]:60988 "EHLO foss.arm.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S2442461AbfJRKNr (ORCPT ); Fri, 18 Oct 2019 06:13:47 -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 9DCC64C9; Fri, 18 Oct 2019 03:13:15 -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 9BDC73F6C4; Fri, 18 Oct 2019 03:13:12 -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 v12 05/22] mips: mm: Add p?d_leaf() definitions Date: Fri, 18 Oct 2019 11:12:31 +0100 Message-Id: <20191018101248.33727-6-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191018101248.33727-1-steven.price@arm.com> References: <20191018101248.33727-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