Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5644556imm; Wed, 12 Sep 2018 08:59:56 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdai2qoVwJv8gJRzLfXd/BDFksvSFoq9ka509oZblnBeyc3ALyUsDx7Qywj1MX0dlSzEpRXJ X-Received: by 2002:a17:902:6808:: with SMTP id h8-v6mr3067319plk.27.1536767996495; Wed, 12 Sep 2018 08:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536767996; cv=none; d=google.com; s=arc-20160816; b=bVIQU9yp8P6bl+bnOuTlBT7XJLgkw2uQH2bcC557BjWGlJy43vxxWoPJbsbPHql7R2 MNDhBbJnKbPYOJrCT+bRqJPC8ViKc0ICBK3K3TiZ0ueHGrY1f6DtzbllLX1TskpiXVDY nILY+UurcVpEr8oFOurwKX7sRAVKdiurukMKe9yVCYXqv0rFvcUIewJiDFCc0+nS2N/0 G4N3eN5MKElWPcXUlwnDYfseIhZxEWcs+M78KeMfCY/s6D9oUtE9MXOfXiH4ScWQLyjR wtkturhPKdXelffFh9SXOoeJ3MOrzfdDmgLCn2emaWIdrehdtAuc/0mFjPYv56Fm4voM YDiw== 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=85BDyejDpsP7D09+aPA8c9YP7uJZ1e8HJ/PtwebKgaA=; b=uNaSeELq6d5p4Dv8TTaX75o/g8tyygaxPhmE7Y1Y/DHak0GZVEci9fSLO0W7SpMt4B olL6R4TAhQWcV+59oqFpr+NY8jJQYsTL+Qb2rkBoHozmxBd4dMc+MvJ4D8zVVcGe7cwf gJRBI8hOCDkmZtcYRMKu+YF9XGBxSbl1QsdGpVoPlcolwQZfMku9KWGqsuNEQXwdRTQ9 JdcpuR/QySQ4rHmNxZIJVw/EkmkE9i/c6/cwbiC2oK+B0tdx/EmBo0GT5qHtnFxmZcU5 rVuESvQ9qPrGTIA8XkI+uRbcOlquM1JeIo39QzQgoJy+1E6qJK9T5yACULQX9UBo8sbm ZiKw== 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 y8-v6si1163646pll.74.2018.09.12.08.59.33; Wed, 12 Sep 2018 08:59:56 -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 S1728397AbeILVEC (ORCPT + 99 others); Wed, 12 Sep 2018 17:04:02 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:12281 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbeILVEB (ORCPT ); Wed, 12 Sep 2018 17:04:01 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 429RKQ1v9vz9ttRk; Wed, 12 Sep 2018 17:58:50 +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 k8WqTKpRL66J; Wed, 12 Sep 2018 17:58:50 +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 429RKQ1Kd1z9ttRt; Wed, 12 Sep 2018 17:58:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 676718B873; Wed, 12 Sep 2018 17:58:50 +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 gkGAHxIVFo8z; Wed, 12 Sep 2018 17:58:50 +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 60B368B874; Wed, 12 Sep 2018 17:58:48 +0200 (CEST) Received: by pc16082vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 89AB171913; Wed, 12 Sep 2018 15:58:48 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 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: Wed, 12 Sep 2018 15:58:48 +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 92def7088054..a4c31b829071 100644 --- a/arch/powerpc/include/asm/nohash/pgtable.h +++ b/arch/powerpc/include/asm/nohash/pgtable.h @@ -47,6 +47,16 @@ static inline int pte_present(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