From patchwork Fri Dec 16 18:35:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 706520 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tgJt6420yz9t3K for ; Sat, 17 Dec 2016 05:36:14 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758390AbcLPSgK (ORCPT ); Fri, 16 Dec 2016 13:36:10 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:38977 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758298AbcLPSgG (ORCPT ); Fri, 16 Dec 2016 13:36:06 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uBGIZvU5024940 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 16 Dec 2016 18:35:57 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id uBGIZvmh021651 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 16 Dec 2016 18:35:57 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id uBGIZuRW006059; Fri, 16 Dec 2016 18:35:56 GMT Received: from monkey.oracle.com (/50.188.161.229) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 16 Dec 2016 10:35:55 -0800 From: Mike Kravetz To: sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "David S . Miller" , Bob Picco , Nitin Gupta , Vijay Kumar , Julian Calaby , Adam Buchbinder , "Kirill A . Shutemov" , Michal Hocko , Andrew Morton , Mike Kravetz Subject: [RFC PATCH 05/14] sparc64: Add PAGE_SHR_CTX flag Date: Fri, 16 Dec 2016 10:35:28 -0800 Message-Id: <1481913337-9331-6-git-send-email-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481913337-9331-1-git-send-email-mike.kravetz@oracle.com> References: <1481913337-9331-1-git-send-email-mike.kravetz@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org This new page flag is used to identify pages which are associated with a shared context ID. It is needed at page fault time when we only have access to the PTE and need to determine whether the associated TSB entry should be associated with the regular ot shared context TSB. A new helper routine is_sharedctx_pte() is also added. Signed-off-by: Mike Kravetz --- arch/sparc/include/asm/pgtable_64.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 1fb317f..f2fd088 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -166,6 +166,7 @@ bool kern_addr_valid(unsigned long addr); #define _PAGE_EXEC_4V _AC(0x0000000000000080,UL) /* Executable Page */ #define _PAGE_W_4V _AC(0x0000000000000040,UL) /* Writable */ #define _PAGE_SOFT_4V _AC(0x0000000000000030,UL) /* Software bits */ +#define _PAGE_SHR_CTX_4V _AC(0x0000000000000020,UL) /* Shared Context */ #define _PAGE_PRESENT_4V _AC(0x0000000000000010,UL) /* Present */ #define _PAGE_RESV_4V _AC(0x0000000000000008,UL) /* Reserved */ #define _PAGE_SZ16GB_4V _AC(0x0000000000000007,UL) /* 16GB Page */ @@ -426,6 +427,18 @@ static inline bool is_hugetlb_pte(pte_t pte) } #endif +#if defined(CONFIG_SHARED_MMU_CTX) +static inline bool is_sharedctx_pte(pte_t pte) +{ + return !!(pte_val(pte) & _PAGE_SHR_CTX_4V); +} +#else +static inline bool is_sharedctx_pte(pte_t pte) +{ + return false; +} +#endif + static inline pte_t pte_mkdirty(pte_t pte) { unsigned long val = pte_val(pte), tmp;