Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2837202pjo; Mon, 16 Mar 2020 05:38:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsSG0/80wDpGDFbJTrL1ZO9zqaclKyVGY9P3j2zZo+yuT6coN0GXHmRcxaLamIa9ch8YDRc X-Received: by 2002:a9d:5e82:: with SMTP id f2mr21336656otl.240.1584362317770; Mon, 16 Mar 2020 05:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362317; cv=none; d=google.com; s=arc-20160816; b=qWcHc7pwwxUUad8Y/QyaE0uHR6zQg1LsdArZWEQYelj6Hi2XgEdLstN6rWan+PFRd6 OJea08sOJy6KKsNzeDrDvJpfOfq46Eu7ed6z09FP/gBJl+C84aQ6X3arUGsaeVcBmCLU Ts9+gAMNFmnsx/RzbxXZAd44cGTE5em0JKp8JCkQyq8Fv+JcdM+ouTKyoklzNze9O7/a ou5vRV+vAdnGL6we8/4NWA4NiNuy+j5bIhZzRlfH2M32BiE3OdJ67Umg4m53AtKT9kGr yrgsDvlgsLWx1kE+CAgDBLKdM3Up3Hap3X+Jjx+yFpqhbB11AcudtfGkxueP8rZzhJle mBuA== 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=0tJ0WB/5uzTckZ9SMU6pQ/bfE9wsFb+7jM/11D7Mn1c=; b=ekpHwEWwYnl75YyjP4NTgKtvQzAX3h1rrDtcVv3Y7x0KJLQNFNmvgTmyIZJkhP0/bq MLIbz5QgFpry5UHd9rwn9O4SRuFmG/c/dmtBhscFhtOgfydiMpt8NN+NUYA2QnpEZCPX k8+g1JQYzMLPvVswlUtfsQYHXbekrUyq/BayRFx3/60t2zmdhuh0VeI79i7XxfPWfqJQ NDL3DAlMQ4iMF9YocPpa8b0boNLUnk7NPlEYbFLCkcaAChTqtqO3Tk/WrI1maEcFXtaO jFolEvvKgisgAHVnYsVkDYsifRWvPZKdcHO0uORJavyi5HDluY9+8VNgqWdPiKeX80Jq O9Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=YBHsm6Wh; 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 y17si9734998oto.70.2020.03.16.05.38.25; Mon, 16 Mar 2020 05:38: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; dkim=pass header.i=@c-s.fr header.s=mail header.b=YBHsm6Wh; 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 S1731198AbgCPMgO (ORCPT + 99 others); Mon, 16 Mar 2020 08:36:14 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:25118 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731138AbgCPMgH (ORCPT ); Mon, 16 Mar 2020 08:36:07 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48gwl46c8lz9v02p; Mon, 16 Mar 2020 13:36:00 +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=YBHsm6Wh; 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 R-NZpdYz0vBx; Mon, 16 Mar 2020 13:36:00 +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 48gwl45bgrz9v02f; Mon, 16 Mar 2020 13:36:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584362160; bh=0tJ0WB/5uzTckZ9SMU6pQ/bfE9wsFb+7jM/11D7Mn1c=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=YBHsm6WhoAaOichbtG+iBHQjZjzrWyJIVEDsiTLXXiEwYogqMnjX+Dzndm+Y88SKF YGMeyt1jIjK+8mgREAaGU9+YlMphf21ijUb9Wc5zJB/wIA1kJE106e8mnMmwvq0kzs XTR3sLjPw+QsiKXuGvZwimS4++/0QvzX45n0wZjQ= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BCD0A8B7D0; Mon, 16 Mar 2020 13:36:05 +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 x7ik7fBzb_6O; Mon, 16 Mar 2020 13:36:05 +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 9FAF78B7CB; Mon, 16 Mar 2020 13:36:05 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 9613965595; Mon, 16 Mar 2020 12:36:05 +0000 (UTC) Message-Id: <837fabbbced9974dc557ec66eeafd3b2cddd0a47.1584360344.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 20/46] powerpc/mm: Refactor pte_update() on book3s/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:05 +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. While we are at it, drop the comment on 44x which is not applicable to book3s version of pte_update(). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/pgtable.h | 58 +++++++------------- 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index 7549393c4c43..d1108d25e2e5 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -253,53 +253,35 @@ extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, * and the PTE may be either 32 or 64 bit wide. In the later case, * when using atomic updates, only the low part of the PTE is * accessed atomically. - * - * In addition, on 44x, we also maintain a global flag indicating - * that an executable user mapping was modified, which is needed - * 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) { - unsigned long old, tmp; - - __asm__ __volatile__("\ -1: lwarx %0,0,%3\n\ - andc %1,%0,%4\n\ - or %1,%1,%5\n" -" stwcx. %1,0,%3\n\ - bne- 1b" - : "=&r" (old), "=&r" (tmp), "=m" (*p) - : "r" (p), "r" (clr), "r" (set), "m" (*p) - : "cc" ); - - 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_basic_t old; unsigned long tmp; - __asm__ __volatile__("\ -1: lwarx %L0,0,%4\n\ - lwzx %0,0,%3\n\ - andc %1,%L0,%5\n\ - or %1,%1,%6\n" -" stwcx. %1,0,%4\n\ - bne- 1b" + __asm__ __volatile__( +#ifndef CONFIG_PTE_64BIT +"1: lwarx %0, 0, %3\n" +" andc %1, %0, %4\n" +#else +"1: lwarx %L0, 0, %3\n" +" lwz %0, -4(%3)\n" +" andc %1, %L0, %4\n" +#endif +" or %1, %1, %5\n" +" stwcx. %1, 0, %3\n" +" bne- 1b" : "=&r" (old), "=&r" (tmp), "=m" (*p) - : "r" (p), "r" ((unsigned long)(p) + 4), "r" (clr), "r" (set), "m" (*p) +#ifndef CONFIG_PTE_64BIT + : "r" (p), +#else + : "b" ((unsigned long)(p) + 4), +#endif + "r" (clr), "r" (set), "m" (*p) : "cc" ); return old; } -#endif /* CONFIG_PTE_64BIT */ /* * 2.6 calls this without flushing the TLB entry; this is wrong -- 2.25.0