Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2835712pjo; Mon, 16 Mar 2020 05:37:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt2VR41PJUQnB9JkQ9+1SgHzLiI8iXG00+hI2ZffW9K6U2p3jrTA2sdIxLCbKzz4Vx/IPI3 X-Received: by 2002:a9d:228:: with SMTP id 37mr23220277otb.52.1584362223609; Mon, 16 Mar 2020 05:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362223; cv=none; d=google.com; s=arc-20160816; b=iDNI7hCclnJFC3tp4Z4KR5f0X2vrJmSCkSBGLq7xc3Kbfm5RwTVO1uCC263Rg3y0gZ XBuYyZj9HDNyaPQS89v2JRSL8nSd1JawoA1p3Il1H8+XCw5Srtigt15K9170iE57MI0c f+OstxDBli/t/BvmqMpnhXMhnGaDFkJ8SV0ApR7t8+JzoGc1mmJ9UAyfOSgurJoEOFk2 6XglYZij80kbep1FN8bodMXUwaLrkJPpdTCm4EkMG4x6nH5lnOiJSqWzI+ZXSis7KfsE V5vvQMmsO9/saV1HGf3mlu2Ldx2U2MkqF55nuyR9p+3/QANhGMZWtnbSnDX4MHobgRsd ShKQ== 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:dkim-signature; bh=OLAdxcq58x2Sc5fHm3L8aoAlKF1oe1HdFOktLEbcqyE=; b=FQ/1r1hPUBLp+M0GAfg7It0cJ1NVDitcZstUdvKg+yq5fchta+Q6eAjVcOlNpix5xw 4WgSYMU3gvxQRkBcUV8luu5eBz+KNhm+Mro4epvw/yHUmTpZC0uH1vaY00FJiUES8KYt 08EyHzjQOJd3v52gkk53fJKrwScHY0DhxnYWids3dK1+vRT3NRJHgDwwdHkz/cZFqQAi TLvSSbTDHepBRXeM5yPo223lNlaflHqzHaieD37+LruWWGigxVnxR0PWrR7PyF183ymi QscJoYjXD67TkOC/oYr0xSmvaYWjKRtan3EdXkimEmnUNG3Y0xtEv5+w9/0dYEOqGW0l 4WAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=Nh8+zLFA; 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 y7si6946831otb.91.2020.03.16.05.36.49; Mon, 16 Mar 2020 05:37:03 -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; dkim=pass header.i=@c-s.fr header.s=mail header.b=Nh8+zLFA; 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 S1731187AbgCPMgM (ORCPT + 99 others); Mon, 16 Mar 2020 08:36:12 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:7673 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731133AbgCPMgG (ORCPT ); Mon, 16 Mar 2020 08:36:06 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48gwl372CVz9v02n; Mon, 16 Mar 2020 13:35:59 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=Nh8+zLFA; dkim-adsp=pass; dkim-atps=neutral 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 10_gpVPgn_Tl; Mon, 16 Mar 2020 13:35:59 +0100 (CET) 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 48gwl3622gz9v02f; Mon, 16 Mar 2020 13:35:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584362159; bh=OLAdxcq58x2Sc5fHm3L8aoAlKF1oe1HdFOktLEbcqyE=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=Nh8+zLFANRR8tJFVtfkKnxBwFwF3ctO1DP3wBBS08mj3QtsGe0GSj3kH5MmM1zE0e y0OOo9ty6KC6y1L28SlMv9im+sQoY+GyeuyAI9o1GsaH3KshvB68u+upyeeF0M14Ix DLXrxpRoa0gCfwlWmDa0O8ip12pVZG/HBZYFJ96s= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C3DE68B7D2; Mon, 16 Mar 2020 13:36:04 +0100 (CET) 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 ULtLSELN7RhB; Mon, 16 Mar 2020 13:36:04 +0100 (CET) Received: from pc16570vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 994A18B7D0; Mon, 16 Mar 2020 13:36:04 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 9025165595; Mon, 16 Mar 2020 12:36:04 +0000 (UTC) Message-Id: <3b050565d0e03c2c9ae65e409ab292d5cb206a41.1584360344.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 19/46] powerpc/mm: Refactor pte_update() on nohash/32 To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 16 Mar 2020 12:36:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_PTE_64BIT is set, pte_update() operates on 'unsigned long long' When CONFIG_PTE_64BIT is not set, pte_update() operates on 'unsigned long' In asm/page.h, we have pte_basic_t which is 'unsigned long long' when CONFIG_PTE_64BIT is set and 'unsigned long' otherwise. Refactor pte_update() using pte_basic_t. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/pgtable.h | 26 +++----------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index 523c4c3876c5..9eaf386a747b 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -222,12 +222,9 @@ static inline void pmd_clear(pmd_t *pmdp) * to properly flush the virtually tagged instruction cache of * those implementations. */ -#ifndef CONFIG_PTE_64BIT -static inline unsigned long pte_update(pte_t *p, - unsigned long clr, - unsigned long set) +static inline pte_basic_t pte_update(pte_t *p, unsigned long clr, unsigned long set) { -#ifdef PTE_ATOMIC_UPDATES +#if defined(PTE_ATOMIC_UPDATES) && !defined(CONFIG_PTE_64BIT) unsigned long old, tmp; __asm__ __volatile__("\ @@ -241,8 +238,8 @@ static inline unsigned long pte_update(pte_t *p, : "r" (p), "r" (clr), "r" (set), "m" (*p) : "cc" ); #else /* PTE_ATOMIC_UPDATES */ - unsigned long old = pte_val(*p); - unsigned long new = (old & ~clr) | set; + pte_basic_t old = pte_val(*p); + pte_basic_t new = (old & ~(pte_basic_t)clr) | set; #if defined(CONFIG_PPC_8xx) && defined(CONFIG_PPC_16K_PAGES) p->pte = p->pte1 = p->pte2 = p->pte3 = new; @@ -257,21 +254,6 @@ static inline unsigned long pte_update(pte_t *p, #endif return old; } -#else /* CONFIG_PTE_64BIT */ -static inline unsigned long long pte_update(pte_t *p, - unsigned long clr, - unsigned long set) -{ - unsigned long long old = pte_val(*p); - *p = __pte((old & ~(unsigned long long)clr) | set); - -#ifdef CONFIG_44x - if ((old & _PAGE_USER) && (old & _PAGE_EXEC)) - icache_44x_need_flush = 1; -#endif - return old; -} -#endif /* CONFIG_PTE_64BIT */ #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG static inline int __ptep_test_and_clear_young(unsigned int context, unsigned long addr, pte_t *ptep) -- 2.25.0