Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp636241imm; Wed, 17 Oct 2018 06:05:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV63ppHOduM8D6XC+85AKOUga1nYhCQCkZf0fi8jlMG1utRlvtPINw9t94yRCv/6nd5cKmjqS X-Received: by 2002:a62:5ac6:: with SMTP id o189-v6mr26900993pfb.40.1539781537193; Wed, 17 Oct 2018 06:05:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539781537; cv=none; d=google.com; s=arc-20160816; b=uCksT7V+5lSJyX5kY9GaSBdUcn/lKlkUTevmBsfkM0Fsk07l20IAxuqB71JCnIsgbU 7qy2IMSvcp4E04ZLp2L4pW3lgdq5E6GmJaYKdzHDdKXlWrRuSgI44lm5WB5A4Fq102iv uM47+Ky5YFiF6x64GDJt6eL6L+7rBZAEzeVftP6lWZA3yUXCipdzCDkgS6JHJlY9SfrD H32ZGFVHRndM/Wioml/PN7PDf0rOdGwAd2toYk+U5+jTs58D2TLyR4l60gAfoxpyUQS4 t0GrcicrO+xBIl6+2TV7L5hI58hRroZvroShDvTEk98BGZQX29eqfTdL1xE3rFeXLyrT X4zA== 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:message-id; bh=05qr4A4QHRAbvLBzJFhyTOjrzgKm7cHoNatdbPQ9Nlk=; b=XvIXAJUrGWLixetMbkVnRU+hfT8mLablnWIgqlMRNTqJfzjnrHCC2wGw3BOhH6nJXN JvCyesB7LfZoay5nuDE2OVqG2l4sT/1FlH0Kr+XdDadWkMHd6zAhb6HmyiycHsmn5SGA JPADK8vqWEcx7MhoRsg/ctJJV+ZpCOMFp/hmPEk/2rymozTTg3PsKTFrru7QPEesykA6 F9fHbznOChgI4LbhNJGHqgAyjM1EbkhfFdBgXhSzu0dK8mHhu3bgL3FuijzGcLiFaU6z sUFxzvUJOkMnMxDk0tMQf6+mJU5T5I55ya/MATdbydMV46lFjTZ60q8PgeeX3UF9QEWa ZjRA== 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 m37-v6si11109889pla.421.2018.10.17.06.05.21; Wed, 17 Oct 2018 06:05:37 -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 S1727129AbeJQU7I (ORCPT + 99 others); Wed, 17 Oct 2018 16:59:08 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:2594 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727000AbeJQU7H (ORCPT ); Wed, 17 Oct 2018 16:59:07 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 42Zsmq21XKz9ttFX; Wed, 17 Oct 2018 15:03:23 +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 qX0Jd8w8HOGm; Wed, 17 Oct 2018 15:03:23 +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 42Zsmq16XSz9ttBT; Wed, 17 Oct 2018 15:03:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 715AD8B7FF; Wed, 17 Oct 2018 15:03:23 +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 rXdIlUx1zF0d; Wed, 17 Oct 2018 15:03:23 +0200 (CEST) Received: from pc13168vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4BD6B8B7F2; Wed, 17 Oct 2018 15:03:23 +0200 (CEST) Received: by pc13168vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 216A66F4CD; Wed, 17 Oct 2018 13:03:22 +0000 (UTC) Message-Id: <19885260cc71182f8c03840204e2553ef42acb67.1539781367.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH] powerpc/book3e: redefine pte_mkprivileged() and pte_mkuser() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , aneesh.kumar@linux.ibm.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Wed, 17 Oct 2018 13:03:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Book3e defines both _PAGE_USER and _PAGE_PRIVILEGED, so the nohash default pte_mkprivileged() and pte_mkuser() are not usable. This patch redefines them for book3e. In theorie, only pte_mkprivileged() needs to be redefined because _PAGE_USER includes _PAGE_PRIVILEGED, but it is less confusing to redefine both. Fixes: a0da4bc166f2 ("powerpc/mm: Allow platforms to redefine some helpers") Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/pte-book3e.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/powerpc/include/asm/nohash/pte-book3e.h b/arch/powerpc/include/asm/nohash/pte-book3e.h index 58eef8cb569d..fa1451e15b4e 100644 --- a/arch/powerpc/include/asm/nohash/pte-book3e.h +++ b/arch/powerpc/include/asm/nohash/pte-book3e.h @@ -109,5 +109,21 @@ #define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER) #define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) +#ifndef __ASSEMBLY__ +static inline pte_t pte_mkprivileged(pte_t pte) +{ + return __pte((pte_val(pte) & ~_PAGE_USER) | _PAGE_PRIVILEGED); +} + +#define pte_mkprivileged pte_mkprivileged + +static inline pte_t pte_mkuser(pte_t pte) +{ + return __pte((pte_val(pte) & ~_PAGE_PRIVILEGED) | _PAGE_USER); +} + +#define pte_mkuser pte_mkuser +#endif /* __ASSEMBLY__ */ + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_NOHASH_PTE_BOOK3E_H */ -- 2.13.3