Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1728984ybg; Sat, 19 Oct 2019 01:13:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4TAp7D+aBoUaLffrl4KypeHT0+mmryaw0pPFd97/dpWHURZs8yfgRc8/rF5ZLgZ/7MxM9 X-Received: by 2002:a17:906:1942:: with SMTP id b2mr12567320eje.36.1571472829155; Sat, 19 Oct 2019 01:13:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472829; cv=none; d=google.com; s=arc-20160816; b=A7VOuIg6c8LLnz+mYrlzMsTShz7LT162bpPwgj755EJ6KlSbdWWNawWWBqRBmPl8aO mMDxtIHh9VMLw64EU1K3WW6GyHMSRfIqspjbEgX1+k1FslEiOJNqsUm+ax/wGUe94yp4 0ByGnoZqYTN+zFEcEklqTAiW5XaG715jcOpXDqVcshINMBIOKHlGf5/Sj3sR4tqYuyma jqPQpZTXdbA8gPg2s31whz3N4WqQrOnb20JzfwoP5qU4ZKak4X37oWCCum3MlKIb+isA UxCCkVGR8pIQEwEu2KNjAUbRhAFjLIj0CyiRDtvawB9qbEkj/x/KLyfX+yUM4DY34NSp 35gQ== 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=ZfK8yYx0yg6+qg7RQY72ByrGuFB2epJ5g/ga6TKBhCGexfQhNwDpebzGdTJ8PxX+2Z rGrLMzBqY/B3CTUvy7zjrKhwoIfBPZtRDgvPdengXZFZgQFD+W1LeAMcbx7W3FN3GPMO EQ2zgk7mdZN1MzKhRC+0lfg6/5wf1raZxjHumfJF1iCl1kVFBi9FWL5Req0B3qthcqhh jpm/M7IFJVcEZwNyhFQPvL9Wq09F3qsrVsXLVnAGjHhpxPaarn9AllJhvq1phFImi7yh LKlRjMSKVgAeIWbEbKx9zSV2lxZaNsSgokRc0kmDnxWvTdEfTWgBOimtTmrNlj86omU4 cNhg== 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 w11si4826957eji.160.2019.10.19.01.13.26; Sat, 19 Oct 2019 01:13:49 -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 S2633553AbfJRKOv (ORCPT + 99 others); Fri, 18 Oct 2019 06:14:51 -0400 Received: from [217.140.110.172] ([217.140.110.172]:32838 "EHLO foss.arm.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S2633409AbfJRKN5 (ORCPT ); Fri, 18 Oct 2019 06:13:57 -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 5B20A68D; Fri, 18 Oct 2019 03:13:31 -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 C20F53F6C4; Fri, 18 Oct 2019 03:13:28 -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 v12 10/22] x86: mm: Add p?d_leaf() definitions Date: Fri, 18 Oct 2019 11:12:36 +0100 Message-Id: <20191018101248.33727-11-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. 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