Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4454033ybp; Mon, 7 Oct 2019 08:40:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhtVE1++KsyIxyEO/K3ycay14Z6ZTksIGZvOEXVqMR6GXtXEvi4pLo4Q5LNSHdS+1v6/KO X-Received: by 2002:aa7:c5c2:: with SMTP id h2mr30177665eds.260.1570462808070; Mon, 07 Oct 2019 08:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570462808; cv=none; d=google.com; s=arc-20160816; b=FM7uADWBVXu1j9Lhs2KQMAtXzRCP6y0AnuXOvGQC8k5a744Pix+z4eGi8GRIhO1C2Y BKv2c7VegzWl0x3KCKFR46MqMM1NTYbUcTa+zAnS3AYn85wcNLVf2dP2A0yo61iCUYlQ YO/acSIOHOaqNijVzEv3WvrKSC0Isb2CP9hGbGWJDMNBII1ASPnWYR+k7kg3ggs9bcI9 QQHebAablXrpVR3G2n/fWBPF6U8LU6ZhWNJ/P7O9aQrfqaN5+QWTsO5Yj8jzQfZNX1ff CLYwOtzSCRrv/mp4FvpjOmjVVece7ulxb+e9WxSAfhV7IUd90Jm2w0exLszy1kmYqnqo i1Ug== 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=q7AHDh47OZoZhErdQSu2RDCrmB5GPOQmORLygQwMy+OKNCOl5SHWWejFeIT9hQUEe9 g1r6P2D9nmgTQcqRMJZBMYvU9cAuWhK3I26nLIPP6VxpAmsilyU7iqJkh0xH+YxdAbsn EcCVUHX8wKEbEJV0aPowFfM7aWVPLNNMGJB90StlCCbIhQXyfr0mJaBJ16lCt78ydd7g cUvQJTOqit/bu9QQ53qXci4TUObJH+JggmEXDVWEAowOpJQ0cwZ6GX1aT4cgoUqKOsNn JU9IJlEOSJEnGzpuL+vOBhKywa7BZrvMBjsKA4UOx8TV+HSrS6tJqnBQ1ZGfukohmkoz klqA== 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 ce9si7176223ejb.347.2019.10.07.08.39.44; Mon, 07 Oct 2019 08:40:08 -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 S1729031AbfJGPjM (ORCPT + 99 others); Mon, 7 Oct 2019 11:39:12 -0400 Received: from foss.arm.com ([217.140.110.172]:38546 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728981AbfJGPjM (ORCPT ); Mon, 7 Oct 2019 11:39:12 -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 B7FF215AB; Mon, 7 Oct 2019 08:39:11 -0700 (PDT) Received: from e112269-lin.arm.com (unknown [10.1.197.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B56E3F6C4; Mon, 7 Oct 2019 08:39:09 -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 v11 10/22] x86: mm: Add p?d_leaf() definitions Date: Mon, 7 Oct 2019 16:38:10 +0100 Message-Id: <20191007153822.16518-11-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191007153822.16518-1-steven.price@arm.com> References: <20191007153822.16518-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