Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6128565ybi; Wed, 31 Jul 2019 08:49:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5h+tj9mB/YLFLRvFB1TN7JL3zs60T2L/wayXAAfmgtF6UQH10EMXmrji7rCTS5D3xKL2r X-Received: by 2002:a17:902:9a84:: with SMTP id w4mr1908021plp.160.1564588140311; Wed, 31 Jul 2019 08:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564588140; cv=none; d=google.com; s=arc-20160816; b=NLpgsm1J6Zv9pXHj1r+QRVo/9Cmh0N50NBiRCGeSz2++bT8Ah5IdMDjO9EOCYoGKL3 0kfjLk9aMfjZe4jUDphUgpy21atFfyZJidIw5UeHi6vVqRv5OPdML+KgdEy76aYJ20OD DFaoACeVdSQ7kg2YSyIGRR4NbL0hsBhF9Oo8seZTCJw5nI0es0Y/ODG9O4NeG4pHXbuH S7tepcaJJecml1Bm1+PNtOw7EuW9uERiTEYan0TzbIz7/2AL8nkY6NmHY4LGvsKu1Pak 5s+Eh9niMp57ktKIgwSbVlr6FqY7cHKliYmAPvMUVWO7NTYS0GZnjUU+8DlrnbGI5Fz1 5qkA== 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=nxKy+dHCcQ52WwJbQmiHduBQhK1uZKwGIaDaQ5m0n9k=; b=NGDUAAokMbygy6dHYgxXgTOKJP5JElxm7RNxXnj666F15tKsGq1QxcLB8KTtGGEeJn EaKfBtblv1HobHSDS3Vf+KZ7VlLiqxWO9Ol6lC5GBsGf0mNGpi/CvUbBxh6XoZyIP5E8 xySbxsSIz3mUiOVk3dVvPfOu1BDLrXn/OpWkZ2LXnWwiOv92aDSHFYGOFqOsR30IUk3Y GACEXjhPOLupHzCni4B0dIk79xkKNDLQ2rYCsPvjXquNyEkmb/IJigZ8ACkcnWyFazKN NsFPZcyZf890Wq39K9KNlGvmVwe3sLt39qf20FDbGwVUeLpIJbUsk/IqgleF6CNVKtmO zggw== 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 u2si32491315pgm.242.2019.07.31.08.48.44; Wed, 31 Jul 2019 08:49:00 -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 S1729912AbfGaPqp (ORCPT + 99 others); Wed, 31 Jul 2019 11:46:45 -0400 Received: from foss.arm.com ([217.140.110.172]:49806 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729758AbfGaPqm (ORCPT ); Wed, 31 Jul 2019 11:46:42 -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 E5E021596; Wed, 31 Jul 2019 08:46:41 -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 5CED33F694; Wed, 31 Jul 2019 08:46: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 Subject: [PATCH v10 10/22] x86: mm: Add p?d_leaf() definitions Date: Wed, 31 Jul 2019 16:45:51 +0100 Message-Id: <20190731154603.41797-11-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. For x86 we already have p?d_large() functions, so simply add macros to provide the generic p?d_leaf() names for the generic code. Signed-off-by: Steven Price --- arch/x86/include/asm/pgtable.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 0bc530c4eb13..6986a451619e 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -239,6 +239,7 @@ static inline unsigned long pgd_pfn(pgd_t pgd) return (pgd_val(pgd) & PTE_PFN_MASK) >> PAGE_SHIFT; } +#define p4d_leaf p4d_large static inline int p4d_large(p4d_t p4d) { /* No 512 GiB pages yet */ @@ -247,6 +248,7 @@ static inline int p4d_large(p4d_t p4d) #define pte_page(pte) pfn_to_page(pte_pfn(pte)) +#define pmd_leaf pmd_large static inline int pmd_large(pmd_t pte) { return pmd_flags(pte) & _PAGE_PSE; @@ -874,6 +876,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address) return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address); } +#define pud_leaf pud_large static inline int pud_large(pud_t pud) { return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) == @@ -885,6 +888,7 @@ static inline int pud_bad(pud_t pud) return (pud_flags(pud) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0; } #else +#define pud_leaf pud_large static inline int pud_large(pud_t pud) { return 0; @@ -1233,6 +1237,7 @@ static inline bool pgdp_maps_userspace(void *__ptr) return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START); } +#define pgd_leaf pgd_large static inline int pgd_large(pgd_t pgd) { return 0; } #ifdef CONFIG_PAGE_TABLE_ISOLATION -- 2.20.1