Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4895118imm; Tue, 9 Oct 2018 06:53:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV63dW7nXLtKEqH1qkZpCMyFZJrDaoUFFtjDMYMa97PDTry67dxHeHyEwSh56XYJ25a2cQsw+ X-Received: by 2002:a63:510a:: with SMTP id f10-v6mr25597291pgb.31.1539093203606; Tue, 09 Oct 2018 06:53:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539093203; cv=none; d=google.com; s=arc-20160816; b=cGvz5WPUw5aM5J/XfRdFj7COJh6PQxn6m4zFYeyDdYZrVPxQ0m16FOZ1LSDfBFy+Fp 3RtERJQgesPvneouipDgHn2p2jgqblr/LF8XogBpCwW47lSQ3SZyvzYXmAtreUZX60qC 5y7LASA4OelX9mSE2mfW2RL7YL+HyPy+/sq1BW+m5d+dgA1aQkZsLfu4pWe0RYoIrHZm MG9GBu6n0/IRGbWqCEzkAOuN7wVt7lAy/2PlKL24bj8QA44xGEd/ijb0LLtEFGDRpq4f 9ZSH/q89srZZGOfEc+TLl4hFXcUsVJcQT19vKIQZeJIEiYce9pc5V4uJO0C2PrVv6Kgx BOaQ== 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=RaBjswpLwCdXiPaU+fw8QZcyKjWkG59LIS6Ctdzth5c=; b=mctUhVmpIYVmqz3em4mIAlCfYAwbEKltUkUmv/cNr9CqH58c+1Ym18Tnr8wSbAmexJ HD2MgVIHDqSxua7Hg+/55PIH8HQTwtUXYQ6Ox9ltI90D6Llm/N56mDxID+fvoBFdBeY9 Wk5Iwz+Ms2tH0mJE+CoJZwTOxL4MLKOgU80VaM/RVy4VyXyWo53CMm+Z1q6YOmZR5jua vCsHry6vfDX0R7Tc1lapmHA8QcqYXsgaQUPT9VgJOHemPE6enqkfPnVDmLGJayEHDI9V JuE7SQCycSqA1+mecJlu3f4cLTCvZjspuk83X4geT22wofo9yTQfrW6CIQMVvPqe+0NK +7wA== 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 f10-v6si19995189pgl.148.2018.10.09.06.53.09; Tue, 09 Oct 2018 06:53:23 -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 S1727658AbeJIVJV (ORCPT + 99 others); Tue, 9 Oct 2018 17:09:21 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:4827 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727215AbeJIVJU (ORCPT ); Tue, 9 Oct 2018 17:09:20 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 42TzDX4xCdz9ttgG; Tue, 9 Oct 2018 15:51:56 +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 QRQW5HDR3oRx; Tue, 9 Oct 2018 15:51:56 +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 42TzDX4NLdz9ttfw; Tue, 9 Oct 2018 15:51:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 171478B80D; Tue, 9 Oct 2018 15:52:08 +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 iBvCyLoNiyQl; Tue, 9 Oct 2018 15:52:08 +0200 (CEST) Received: from pc13168vm.idsi0.si.c-s.fr (unknown [192.168.232.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1E2158B80B; Tue, 9 Oct 2018 15:52:07 +0200 (CEST) Received: by pc13168vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 3EA9C6F444; Tue, 9 Oct 2018 13:52:06 +0000 (UTC) Message-Id: <8549b86165e90d6f3a2b0423fc731048358e1aa1.1539092112.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v3 17/24] powerpc/mm: Move pte_user() into nohash/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: Tue, 9 Oct 2018 13:52:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now the pte-common.h is only for nohash platforms, lets move pte_user() helper out of pte-common.h to put it together with other helpers. Reviewed-by: Aneesh Kumar K.V Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/pgtable.h | 10 ++++++++++ arch/powerpc/include/asm/pte-common.h | 13 ------------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h index 062d96233673..8de3b7eb88b0 100644 --- a/arch/powerpc/include/asm/nohash/pgtable.h +++ b/arch/powerpc/include/asm/nohash/pgtable.h @@ -52,6 +52,16 @@ static inline bool pte_hw_valid(pte_t pte) } /* + * Don't just check for any non zero bits in __PAGE_USER, since for book3e + * and PTE_64BIT, PAGE_KERNEL_X contains _PAGE_BAP_SR which is also in + * _PAGE_USER. Need to explicitly match _PAGE_BAP_UR bit in that case too. + */ +static inline bool pte_user(pte_t pte) +{ + return (pte_val(pte) & (_PAGE_USER | _PAGE_PRIVILEGED)) == _PAGE_USER; +} + +/* * We only find page table entry in the last level * Hence no need for other accessors */ diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h index 3a8ec18ffd22..556a914ff845 100644 --- a/arch/powerpc/include/asm/pte-common.h +++ b/arch/powerpc/include/asm/pte-common.h @@ -66,19 +66,6 @@ #define _PTE_NONE_MASK 0 #endif -#ifndef __ASSEMBLY__ - -/* - * Don't just check for any non zero bits in __PAGE_USER, since for book3e - * and PTE_64BIT, PAGE_KERNEL_X contains _PAGE_BAP_SR which is also in - * _PAGE_USER. Need to explicitly match _PAGE_BAP_UR bit in that case too. - */ -static inline bool pte_user(pte_t pte) -{ - return (pte_val(pte) & (_PAGE_USER | _PAGE_PRIVILEGED)) == _PAGE_USER; -} -#endif /* __ASSEMBLY__ */ - /* Location of the PFN in the PTE. Most 32-bit platforms use the same * as _PAGE_SHIFT here (ie, naturally aligned). * Platform who don't just pre-define the value so we don't override it here -- 2.13.3