Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp761548ybl; Fri, 6 Dec 2019 05:55:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzACXizOORs29IM+4wQ3ujryUIKcqdxXydmbaBcWZcVRn2D8j+rEUf9jDDDscdhIZl7dhgj X-Received: by 2002:aca:4e87:: with SMTP id c129mr11764559oib.153.1575640520948; Fri, 06 Dec 2019 05:55:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575640520; cv=none; d=google.com; s=arc-20160816; b=oz/oCQ834VvuSaBNqS+XyCpOaGWDvoLxHNLAxyOwwRciMAHWlEEVcbL7IjCoGHOIWo YOGpVXJl5ySUn9mGq5QGxQo1V7zsNQLWbyGpY+M3wTmjTLkxpE7rmKqHYbdFfXPI++ef 7TX8XyHvdfBFQWhEyloBs8neo7FrSEzUUKjlmDblhpx9hACc0HjnS96VIa7g2PTlrMtR pdkC1/SFJ0z9KPvt99Ml86OA+GN2txpgiqcfvObZVuovEqU8OlecrUmc/gjScnT7UFkM AVNiOHPH1Zbp6tIZYz8T7AmNUs283VV/SodssN4pn6ZomTCPAAp1BBjj/Xz/HjRX5e6c ya/Q== 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=Yk320M4qjY/9jmCTB9w5xNor3rCLFgolVRiAvSkSGRA=; b=MODHcq7jwKNOykc1Lt8/VzELgdgRukeQmgr5Rig2dbq9Tmr8LuR23mYx63YA8/GXAZ PoVamsat7CGN/zApbU+9VtS6GCUSNmhs2iBwwSEljMDv8PffD1JvboR0wprjseZlI8Mx 498W+YGtVALMJ6q3fPNvDHYuSSpGdsrgpe/2BNnSXkHvD2j/MYKyFYredbNU79bh096o NdNJAeJZyMcDAtfgC9RPRQXytw8Cv/iaDd0EmakVvOko4HRLXkkQCrVWbdsBfKKwyCze IADRho3HGcFUyKtLqhQn3YPnWGsswaQbN50sSKXdM2eRCB38ciunS4Ak+fszH5gUc9Y/ J+hg== 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 q126si6697065oia.8.2019.12.06.05.55.09; Fri, 06 Dec 2019 05:55:20 -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 S1726706AbfLFNyR (ORCPT + 99 others); Fri, 6 Dec 2019 08:54:17 -0500 Received: from foss.arm.com ([217.140.110.172]:44690 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726678AbfLFNyO (ORCPT ); Fri, 6 Dec 2019 08:54:14 -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 78DDD1FB; Fri, 6 Dec 2019 05:54:13 -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 ED5BE3F718; Fri, 6 Dec 2019 05:54:10 -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" Subject: [PATCH v16 10/25] x86: mm: Add p?d_leaf() definitions Date: Fri, 6 Dec 2019 13:53:01 +0000 Message-Id: <20191206135316.47703-11-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. 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 ad97dc155195..8091a1c62596 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