Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7413050ybi; Mon, 22 Jul 2019 12:43:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtSTrPijJ2TQ/oYHic5tena4Fe1vuHfKBc+dERjnQ2s8VVRo7sMJqpE4rY+eoJoO6Pqsbg X-Received: by 2002:a63:24c1:: with SMTP id k184mr74591730pgk.120.1563824609362; Mon, 22 Jul 2019 12:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563824609; cv=none; d=google.com; s=arc-20160816; b=dTbkk10kcqTuX4NKygmD57zCFM2PI0huf0KeHRNQK+USM8W1pR5RqsXxFRyUE6CW7y n9f8xGugxNFAzq6truFkA4TZ5ju0GgExXbUEabWeQgA8n+hXxeTWnFV2zEoDne6gtOfR UrBc92I+fsCLsL2x/Tq9yFUqVcmrtvHo5/CGihrA/cZopyYD49thIg/58rFJFz3/GwIS y9Rx3CY0gaDOGf0ID8+VUxPWMFwYFLxOjgoWArZG69x8klUXYI3UoQyK88aUvGnfLKB2 aYeMMQf64B4EZXDCflz8NvlybMZYy2F8r+5GempVW4pfur3fyRUtWQds78cFZtHgHYme qVMw== 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=Q2U1SXB7Oq2/7iYxzuZYtQ22DEwYP7SPl5zcFKLdiuGnUwXpBfBxMJafOtz7jOTXmV IvxjOhcxOJJ4wxZpotqh/GwDRPEq2g+QO4Jx2dtx2ifsOKPQGDbqhza9PWmNlrho+t7Y dI8lrgpRozWoPBKmvkAKrXo7IyfrCooRRozuWAJnCL34qooKur3Fk7L+ttAHtSHi8yqO X7BueNI9Xd+zyiOqLn/LIDVIY3IbPYz3DI9WwzLpAMfVcihaKwph8GJr2PChxLcmGwIs +MZWeP9DS2ff08TDsFHmxQwAUqHHfSts+8Da9+k9HiRFh7pDQnnidOMmfphh8W1BVwHx cNRw== 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 b15si9302093pgm.230.2019.07.22.12.43.13; Mon, 22 Jul 2019 12:43:29 -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 S1729851AbfGVPmx (ORCPT + 99 others); Mon, 22 Jul 2019 11:42:53 -0400 Received: from foss.arm.com ([217.140.110.172]:40264 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729797AbfGVPmv (ORCPT ); Mon, 22 Jul 2019 11:42:51 -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 CE1BE15A2; Mon, 22 Jul 2019 08:42:50 -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 430953F694; Mon, 22 Jul 2019 08:42:48 -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 v9 09/21] x86: mm: Add p?d_leaf() definitions Date: Mon, 22 Jul 2019 16:41:58 +0100 Message-Id: <20190722154210.42799-10-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 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