From patchwork Tue Apr 21 02:34:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 11500279 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA0D292C for ; Tue, 21 Apr 2020 02:35:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 915B022241 for ; Tue, 21 Apr 2020 02:35:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 915B022241 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8BEFA8E0006; Mon, 20 Apr 2020 22:35:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 847E98E0003; Mon, 20 Apr 2020 22:35:34 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 737F48E0006; Mon, 20 Apr 2020 22:35:34 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 5BB268E0003 for ; Mon, 20 Apr 2020 22:35:34 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 08A6A181AEF09 for ; Tue, 21 Apr 2020 02:35:34 +0000 (UTC) X-FDA: 76730296188.30.mom89_4da827e2e705a X-Spam-Summary: 2,0,0,8f69034d415eeda5,d41d8cd98f00b204,anshuman.khandual@arm.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1431:1437:1534:1541:1711:1730:1747:1777:1792:1963:2393:2559:2562:3138:3139:3140:3141:3142:3352:3867:3871:4321:5007:6261:8634:10004:11026:11657:11658:11914:12043:12296:12297:12438:12555:12895:12986:13069:13311:13357:13846:14096:14181:14384:14394:14721:21080:21451:21627:21990:30054:30070,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-64.100.201.201 62.2.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: mom89_4da827e2e705a X-Filterd-Recvd-Size: 2346 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Tue, 21 Apr 2020 02:35:33 +0000 (UTC) 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 B5657C14; Mon, 20 Apr 2020 19:35:32 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 102F73F73D; Mon, 20 Apr 2020 19:35:29 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Thomas Gleixner , Andrew Morton , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org, "Kirill A . Shutemov" Subject: [PATCH V17 1/2] x86/mm: Define mm_p4d_folded() Date: Tue, 21 Apr 2020 08:04:54 +0530 Message-Id: <1587436495-22033-2-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587436495-22033-1-git-send-email-anshuman.khandual@arm.com> References: <1587436495-22033-1-git-send-email-anshuman.khandual@arm.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This just defines mm_p4d_folded() to check whether P4D page table level is folded at runtime. Cc: Thomas Gleixner Cc: Andrew Morton Cc: Ingo Molnar Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Kirill A. Shutemov Signed-off-by: Anshuman Khandual --- arch/x86/include/asm/pgtable_64.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index df1373415f11..8d03ffd43794 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h @@ -53,6 +53,12 @@ static inline void sync_initial_page_table(void) { } struct mm_struct; +#define mm_p4d_folded mm_p4d_folded +static inline bool mm_p4d_folded(struct mm_struct *mm) +{ + return !pgtable_l5_enabled(); +} + void set_pte_vaddr_p4d(p4d_t *p4d_page, unsigned long vaddr, pte_t new_pte); void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);