From patchwork Tue Apr 11 17:42:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 9675873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 907ED60231 for ; Tue, 11 Apr 2017 17:43:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88AE328538 for ; Tue, 11 Apr 2017 17:43:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D9CC28598; Tue, 11 Apr 2017 17:43:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 285D428538 for ; Tue, 11 Apr 2017 17:43:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 06CC22095C3D7; Tue, 11 Apr 2017 10:43:03 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4787E21939224 for ; Tue, 11 Apr 2017 10:43:02 -0700 (PDT) Received: by mail-pg0-x243.google.com with SMTP id 79so695438pgf.0 for ; Tue, 11 Apr 2017 10:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KZb83K0KDmhoxjP95MLKqKnSDK5x/Ozv9NwbqUJMnZ8=; b=cP+dTHXldRzyqxem2BdEoy8m4MkI3q8DzUp76aXm287Anjkfp3xeix+nN3Da2uAI2A RLvm1EvNq0TR2COOhG+/yK3qHTb/AlaE1hkspfSBRPLGxDrK2hbSzumheUb0VJJqJHR3 WlEGI7uCGRUFEGrdoghIPubbTIjZWRXniGXvcvlmyWPCwhUz4J/U0w2XhddBdyTtG/7Y FmY+UxtCdbVH8BvpDoFoM41LJWOLYoSnLxWNgmtqR4l9FiJeGbNVf66VBlqnKyHUhyRI zUQe0G8XyLb9aHHN+NFP7SwOPmistB4Qb4hDBGkOqG/Qd5qzoTHT8NQ6AzgqEIFDwNiw gTYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KZb83K0KDmhoxjP95MLKqKnSDK5x/Ozv9NwbqUJMnZ8=; b=loptAJ//hE0nX6aPCrgwCHG0nvaZs+QlJsAX4VrDcboNGukantrREi6TxdbAKEU7OQ uweKzftuukCV1AeuLPaPN3AV88uSfyhuAJumQhS57dy8rlq05PqsUor19F0Yoe+c8+pm D2E7X5kwGDO8QSnb0d+LX0Yf74RHhqB33/ePDYr3Ir4BHcVvLsMltrH1o24vm2YBKNOc CceYtPH5ZBxQ/Q6PWRYspORwwNZFlj8ilICeLm9SuxZUjd9DHw1HDQjWUOTnMWWNP/cn fULlXoMagCyK/8seRmZShQySlgYLVA2h30YHobLBR+tc5G3GSRREsLAPZp8M38vCPuf9 Kl9A== X-Gm-Message-State: AFeK/H2/Zx4ZiBqHkaDUFElRprN/hFrZrWBbMwr7vFVDGDxM8OodNVqipy6VaPFy43PZew== X-Received: by 10.84.137.1 with SMTP id 1mr76352970plm.68.1491932581952; Tue, 11 Apr 2017 10:43:01 -0700 (PDT) Received: from localhost.localdomain ([103.57.0.128]) by smtp.gmail.com with ESMTPSA id r185sm20182582pfr.72.2017.04.11.10.42.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 10:43:01 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 3/9] powerpc/mm: Add _PAGE_DEVMAP for ppc64. Date: Wed, 12 Apr 2017 03:42:27 +1000 Message-Id: <20170411174233.21902-4-oohall@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170411174233.21902-1-oohall@gmail.com> References: <20170411174233.21902-1-oohall@gmail.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bsingharora@gmail.com, "Aneesh Kumar K.V" , arbab@linux.vnet.ibm.com, linux-nvdimm@lists.01.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP From: "Aneesh Kumar K.V" Add a _PAGE_DEVMAP bit for PTE and DAX PMD entires. PowerPC doesn't currently support PUD faults so we haven't extended it to the PUD level. Cc: Aneesh Kumar K.V Signed-off-by: Oliver O'Halloran Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/pgtable.h | 37 +++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index fb72ff6b98e6..b5fc6337649e 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -78,6 +78,9 @@ #define _PAGE_SOFT_DIRTY _RPAGE_SW3 /* software: software dirty tracking */ #define _PAGE_SPECIAL _RPAGE_SW2 /* software: special page */ +#define _PAGE_DEVMAP _RPAGE_SW1 +#define __HAVE_ARCH_PTE_DEVMAP + /* * Drivers request for cache inhibited pte mapping using _PAGE_NO_CACHE * Instead of fixing all of them, add an alternate define which @@ -602,6 +605,16 @@ static inline pte_t pte_mkhuge(pte_t pte) return pte; } +static inline pte_t pte_mkdevmap(pte_t pte) +{ + return __pte(pte_val(pte) | _PAGE_SPECIAL|_PAGE_DEVMAP); +} + +static inline int pte_devmap(pte_t pte) +{ + return !!(pte_raw(pte) & cpu_to_be64(_PAGE_DEVMAP)); +} + static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { /* FIXME!! check whether this need to be a conditional */ @@ -966,6 +979,9 @@ static inline pte_t *pmdp_ptep(pmd_t *pmd) #define pmd_mk_savedwrite(pmd) pte_pmd(pte_mk_savedwrite(pmd_pte(pmd))) #define pmd_clear_savedwrite(pmd) pte_pmd(pte_clear_savedwrite(pmd_pte(pmd))) +#define pud_pfn(...) (0) +#define pgd_pfn(...) (0) + #ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY #define pmd_soft_dirty(pmd) pte_soft_dirty(pmd_pte(pmd)) #define pmd_mksoft_dirty(pmd) pte_pmd(pte_mksoft_dirty(pmd_pte(pmd))) @@ -1140,7 +1156,6 @@ static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, return true; } - #define arch_needs_pgtable_deposit arch_needs_pgtable_deposit static inline bool arch_needs_pgtable_deposit(void) { @@ -1149,6 +1164,26 @@ static inline bool arch_needs_pgtable_deposit(void) return true; } +static inline pmd_t pmd_mkdevmap(pmd_t pmd) +{ + return pte_pmd(pte_mkdevmap(pmd_pte(pmd))); +} + +static inline int pmd_devmap(pmd_t pmd) +{ + return pte_devmap(pmd_pte(pmd)); +} + +static inline int pud_devmap(pud_t pud) +{ + return 0; +} + +static inline int pgd_devmap(pgd_t pgd) +{ + return 0; +} + #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ */