Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5647147imm; Wed, 12 Sep 2018 09:01:48 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda4Oyr7y+PCiXWMI+uiVXswSuUBaPSj1jO1eg2COuBDTGjNBVkyTD1JOh5z2f9RkDatzYiX X-Received: by 2002:a62:6003:: with SMTP id u3-v6mr3168884pfb.114.1536768108460; Wed, 12 Sep 2018 09:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536768108; cv=none; d=google.com; s=arc-20160816; b=ZbcK3dcJZV6wFESnF85p+ukXGbSzn5hrWJmkEVJn9OBHPyWbFhrg69wNtb3Qd5ajPG dKoIh49XgV/bhu64N9FlyT0aUv2UzuP8Xf9XaQYG7bCY2UVC2zf8WlihAPcBJ5UllFht F8pmAXYObs6f8z5IyoSHfKUXx/Q7JFAsvenhvdyjlTS6BQgWrfRQzu+qKlnnRMz7GbuS pQ/isppp3sNNuxNSdgAgG9rYZCbpKC9cAmAZy7uAmcx53s9PSw4ZS+PJawQkns9aHehf yaWL+Pvo/TxePrpt66ff0Tqufi3tz97mClfx05d5AJx3/kKotAkuoieF5JqurdOwZQsG SmFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=Or3ZGLtV3yGZBVuWSFK8ZnDoVcVvo/QSDyFBQDh9WiU=; b=fF9N2qVcHZmQTn3x10wFwNKz8Agi/c9RSOqqVHVAmCASVKwL2vggTHAmaghXTnG0Qe qM4Em8nHy1o1EcKjZW8zh4Oa1dCsPbzroqm674V6CxlvzKCAZpBU9z/BihBb3Q7GfA5/ hFSlfslSXc5upKU3U3sJY/D2T0Az4IO7CdFqJPzXKN4IXMlkH8q/CmPNlcey1dywPkDF gzdRe0gpUHF1tmq25R/4IOKVV5i5fCnLt2x8Xs4A8etv5wN1e9UNJzb9mkorwVjtwVnV 29ECSfbI9MlroNkwEInTkKjTQm+P5woOvEA9SBr1cgoawNnyPJkfbAMXXIocjwZ51S5w dTHg== 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 u5-v6si1440908pgc.459.2018.09.12.09.01.33; Wed, 12 Sep 2018 09:01:48 -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 S1727716AbeILVFu (ORCPT + 99 others); Wed, 12 Sep 2018 17:05:50 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:3450 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728217AbeILVDn (ORCPT ); Wed, 12 Sep 2018 17:03:43 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 429RK45H2rz9ttRq; Wed, 12 Sep 2018 17:58:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id D0iUiNodzumK; Wed, 12 Sep 2018 17:58:32 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 429RK44jY5z9ttBm; Wed, 12 Sep 2018 17:58:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2A7DE8B86F; Wed, 12 Sep 2018 17:58:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id CG1gLWGjWqbE; Wed, 12 Sep 2018 17:58:33 +0200 (CEST) Received: from pc16082vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 98FA78B858; Wed, 12 Sep 2018 17:58:32 +0200 (CEST) Received: by pc16082vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 48F1571913; Wed, 12 Sep 2018 15:58:32 +0000 (UTC) Message-Id: <31dea7ecceb9737932beaa4dc3339c7808356872.1536692743.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 09/24] powerpc/mm: move some nohash pte helpers in nohash/[32:64]/pgtable.h To: Bartlomiej Zolnierkiewicz , Benjamin Herrenschmidt , Dominik Brodowski , Geoff Levand , Jens Axboe , Kumar Gala , Li Yang , Michael Ellerman , Nicholas Piggin , Paul Mackerras , Scott Wood , aneesh.kumar@linux.vnet.ibm.com Cc: linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, dri-devel@lists.freedesktop.org Date: Wed, 12 Sep 2018 15:58:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to allow their use in nohash/32/pgtable.h, we have to move the following helpers in nohash/[32:64]/pgtable.h: - pte_mkwrite() - pte_mkdirty() - pte_mkyoung() - pte_wrprotect() Reviewed-by: Aneesh Kumar K.V Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/pgtable.h | 28 ++++++++++++++++++++++++++++ arch/powerpc/include/asm/nohash/64/pgtable.h | 20 ++++++++++++++++++++ arch/powerpc/include/asm/nohash/pgtable.h | 28 ---------------------------- 3 files changed, 48 insertions(+), 28 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index a7f44498ab6f..4373f8c44b6d 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -136,6 +136,34 @@ extern int icache_44x_need_flush; #define pte_clear(mm, addr, ptep) \ do { pte_update(ptep, ~0, 0); } while (0) +static inline pte_t pte_mkwrite(pte_t pte) +{ + pte_basic_t ptev; + + ptev = pte_val(pte) & ~_PAGE_RO; + ptev |= _PAGE_RW; + return __pte(ptev); +} + +static inline pte_t pte_mkdirty(pte_t pte) +{ + return __pte(pte_val(pte) | _PAGE_DIRTY); +} + +static inline pte_t pte_mkyoung(pte_t pte) +{ + return __pte(pte_val(pte) | _PAGE_ACCESSED); +} + +static inline pte_t pte_wrprotect(pte_t pte) +{ + pte_basic_t ptev; + + ptev = pte_val(pte) & ~(_PAGE_RW | _PAGE_HWWRITE); + ptev |= _PAGE_RO; + return __pte(ptev); +} + #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) (pmd_val(pmd) & _PMD_BAD) #define pmd_present(pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK) diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/include/asm/nohash/64/pgtable.h index 513b6e9e62c6..72dac522aa66 100644 --- a/arch/powerpc/include/asm/nohash/64/pgtable.h +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h @@ -94,6 +94,26 @@ #ifndef __ASSEMBLY__ /* pte_clear moved to later in this file */ +static inline pte_t pte_mkwrite(pte_t pte) +{ + return __pte(pte_val(pte) | _PAGE_RW); +} + +static inline pte_t pte_mkdirty(pte_t pte) +{ + return __pte(pte_val(pte) | _PAGE_DIRTY); +} + +static inline pte_t pte_mkyoung(pte_t pte) +{ + return __pte(pte_val(pte) | _PAGE_ACCESSED); +} + +static inline pte_t pte_wrprotect(pte_t pte) +{ + return __pte(pte_val(pte) & ~_PAGE_RW); +} + #define PMD_BAD_BITS (PTE_TABLE_SIZE-1) #define PUD_BAD_BITS (PMD_TABLE_SIZE-1) diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h index 5b82e44c4231..c746e9e784cd 100644 --- a/arch/powerpc/include/asm/nohash/pgtable.h +++ b/arch/powerpc/include/asm/nohash/pgtable.h @@ -77,15 +77,6 @@ static inline unsigned long pte_pfn(pte_t pte) { return pte_val(pte) >> PTE_RPN_SHIFT; } /* Generic modifiers for PTE bits */ -static inline pte_t pte_wrprotect(pte_t pte) -{ - pte_basic_t ptev; - - ptev = pte_val(pte) & ~(_PAGE_RW | _PAGE_HWWRITE); - ptev |= _PAGE_RO; - return __pte(ptev); -} - static inline pte_t pte_mkclean(pte_t pte) { return __pte(pte_val(pte) & ~(_PAGE_DIRTY | _PAGE_HWWRITE)); @@ -96,25 +87,6 @@ static inline pte_t pte_mkold(pte_t pte) return __pte(pte_val(pte) & ~_PAGE_ACCESSED); } -static inline pte_t pte_mkwrite(pte_t pte) -{ - pte_basic_t ptev; - - ptev = pte_val(pte) & ~_PAGE_RO; - ptev |= _PAGE_RW; - return __pte(ptev); -} - -static inline pte_t pte_mkdirty(pte_t pte) -{ - return __pte(pte_val(pte) | _PAGE_DIRTY); -} - -static inline pte_t pte_mkyoung(pte_t pte) -{ - return __pte(pte_val(pte) | _PAGE_ACCESSED); -} - static inline pte_t pte_mkspecial(pte_t pte) { return __pte(pte_val(pte) | _PAGE_SPECIAL); -- 2.13.3