Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3092079ybg; Thu, 24 Oct 2019 21:53:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHgpConrVjI+crpPhgTcpxysEHZ9S5KQwmR7fyOKm4HkEQnMz7RvLLxUAZ1Mfuj3BXj7Dv X-Received: by 2002:aa7:cdc6:: with SMTP id h6mr1786890edw.243.1571979234116; Thu, 24 Oct 2019 21:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571979234; cv=none; d=google.com; s=arc-20160816; b=d62SUzO5iM54U+g3o9EuLqvfNFGkphGiGFZ5tcxgcKQhxIS4EVGP0whhuRcKUH1Cad 0nKij8cunx53MqjR9xxkWapTbTzdbzvedCImYEfYMSP1mHhvhJhPXCvHXXBxaSDtd4xU D1ihSg1i4g3BucKMbXEBk54cS66pAI8Ph2sZwH3gLV/d5Lh7DEL5bNYC/aEuYaACOnP6 uCJWLEN1HaRcqhILaHeSwJZ/htXrxwjBOqblS1j46Rxu8Pr097+cMcLnGTFpx73deDW/ 0R317d/ktLypIfkESsik2ThHMsdD3venAl378zD43LJZKFQ8MrHUWhfnGYxhi5le2i0T vwOQ== 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=0rptIVcy7WduI8OiB5v7UZcropwF2uSO+87czUjAri8/hHd5DcMab00QNEvlLfv/yV K0lf9md0VU4wKzawwwpU2FkcAH3QaNHJBVknnMPteRiDMyjEtPB42zeOPRrYuX7cYA7+ ssOQGhuGQZxIujmlZwTFX3HZS7mt7KWH3//Sn71n513/thbknqYF5ctSWyy1ip84Xwuc PavRJoRZmIwypUduLE1wkU1wS5ftsLXYT6y7zHmV8jA99YGxTToNTSdBNH3r9k6wg06m RPaIDCaXw+Nj/9I6FvSqvJE5XY/zRZCLti3i4SWHZk5tneUkhbNiSnn9ygOp92ZmSRis yGtQ== 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 g31si457435eda.325.2019.10.24.21.53.30; Thu, 24 Oct 2019 21:53:54 -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 S2438626AbfJXJiF (ORCPT + 99 others); Thu, 24 Oct 2019 05:38:05 -0400 Received: from foss.arm.com ([217.140.110.172]:44444 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438596AbfJXJh6 (ORCPT ); Thu, 24 Oct 2019 05:37:58 -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 8FB64625; Thu, 24 Oct 2019 02:37:58 -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 058A63F71F; Thu, 24 Oct 2019 02:37:55 -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 v13 10/22] x86: mm: Add p?d_leaf() definitions Date: Thu, 24 Oct 2019 10:37:04 +0100 Message-Id: <20191024093716.49420-11-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191024093716.49420-1-steven.price@arm.com> References: <20191024093716.49420-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