Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7412694ybi; Mon, 22 Jul 2019 12:43:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5y/gx1W2ae7/hmf5h+ALK4qygzhwIf3OXZfAz4gBA4CPSlV3nwaVHpfy81ccG1IA6GEPl X-Received: by 2002:a65:52ca:: with SMTP id z10mr22504712pgp.424.1563824583056; Mon, 22 Jul 2019 12:43:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563824583; cv=none; d=google.com; s=arc-20160816; b=ibqWvte0rxS4PKdlmzVQrbbYjth2nSHiAXuzGF3fP3g8uOjJACildQ2DJquHyWDtmq 9Uvls28Ql8ss26B6FC7zTeAJSOZBY3AxDVCdu4CP/yCRwd57fkI3b/KgWaBA+nLGEvfJ 643OofdAXvKW0CBuX+UAk5Pq2Ox/kZGohzbSRXyKTuHcxbcYukLC0HFP3cPcq70LdW00 ygn4NcLyb0X8pWd9jwUVK5xQ+sbDWQpE6DXK6fVwZz1dwsjTckf3DtfKnxpQSQEPcADq VgVxKr95jc3WRWMFt8sOQsQ/cUdnGz3aGdvHFedj4jPeH1NTGPOZG4FcIYTAWL3U5GTS 3naw== 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=GFoSGCQZUb3PnmR959rCzy1mnzvRnBqgnRMQdV1X/EU=; b=Kk+ScPUmzLCqWY9GuB32rtHnHiTym4A7AhQ0kg9XrpNm0Pn74diO5hmIwvHQGlppWt wLxasxtrX8Cz8fIlyflnHhWKazLVtFwoCxE8/aOXKOBOBJf2EKfBP9GUX85DIBImHSuw v0iUGaah0qF/yIMWy8iy6dwV4vjDBwvLuu+2eedVn804vTPxrRBEUNihZFQEZC3kzF/8 S29fbK/5MvQYdQ3DUIXwIolCbp+35qt6OicfJIJ8zYzfUPvXdmqi4MWrvyvm21cwEC1a bFszp3gp67g8hT5q4K1oeljTsXy2sF3jG/dLlOQGPUd5je+7oUzeyC8GyPtD8FsGP4u3 qq3A== 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 t189si11863714pgt.428.2019.07.22.12.42.09; Mon, 22 Jul 2019 12:43: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 S1729713AbfGVPmh (ORCPT + 99 others); Mon, 22 Jul 2019 11:42:37 -0400 Received: from foss.arm.com ([217.140.110.172]:40092 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbfGVPmf (ORCPT ); Mon, 22 Jul 2019 11:42:35 -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 740AF15A1; Mon, 22 Jul 2019 08:42:35 -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 71F6A3F694; Mon, 22 Jul 2019 08:42:32 -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 v9 04/21] mips: mm: Add p?d_leaf() definitions Date: Mon, 22 Jul 2019 16:41:53 +0100 Message-Id: <20190722154210.42799-5-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190722154210.42799-1-steven.price@arm.com> References: <20190722154210.42799-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. For mips, we only support large pages on 64 bit. For 64 bit 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-64.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 93a9dce31f25..2bdbf8652b5f 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -273,6 +273,10 @@ static inline int pmd_present(pmd_t pmd) return pmd_val(pmd) != (unsigned long) invalid_pte_table; } +#ifdef _PAGE_HUGE +#define pmd_leaf(pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0) +#endif + static inline void pmd_clear(pmd_t *pmdp) { pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); @@ -297,6 +301,10 @@ static inline int pud_present(pud_t pud) return pud_val(pud) != (unsigned long) invalid_pmd_table; } +#ifdef _PAGE_HUGE +#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) +#endif + static inline void pud_clear(pud_t *pudp) { pud_val(*pudp) = ((unsigned long) invalid_pmd_table); -- 2.20.1